I tried changing the title this time, but the content does not change much. I will continue from the last time.
This time we will use two csv data (Nikkei 225 and NY Dow).
nikkei = pd.read_csv("nikkei.csv", parse_dates=['Data date']) #Read csv data
nikkei.tail()
The NY data is as shown in the image.
NY = pd.read_csv("NYd.csv", parse_dates=['Data date'])
NY.head()
#Combine data
join_data = pd.merge(nikkei, NY[["Data date", "closing price", "Open price", "High price", "Low price"]], on="Data date", how = "left")
join_data.tail() #Try to display
Combine the NY Dow data with the Nikkei 225 data. Combined data dates as common. "~ _x" is the Nikkei average and "~ _y" is the NY Dow.
Plot it in the same way as last time (see past article).
nikkei_close = go.Scatter(x = join_data['Data date'][-200:],
y = join_data['closing price_x'][-200:],
name = "nikkei_close",
line = dict(color = '#000000'), #Make it a black line
opacity = 0.8)
NY_close = go.Scatter(x = join_data['Data date'][-200:],
y = join_data['closing price_y'][-200:],
name = "NY_close",
opacity = 0.8)
data = [nikkei_close, NY_close]
layout = dict(title = "Nikkei 225 and NY Dow", )
fig = dict(data = data, layout=layout)
iplot(fig)
It turned out to be something like this. There is no value for NY Dow here and there. There are so-called missing values. Maybe it's a holiday in the NY market. Is it a mystery for now? This time I just combined the data, but that's all for the code part.
This time we talked about data binding. However, there are some issues that can be seen just by combining them.
--What are the missing values in the graph? --I want to display the Nikkei 225 and NY Dow graphs on top of each other. -Is there a correlation (is it a heat map?) ――Can you analyze anything else?
What a place, such as. I will summarize it if I can solve it. : grin:
Recommended Posts