[Introduction to Python] Combine Nikkei 225 and NY Dow csv data

[Introduction to Python] Combining the Nikkei 225 and NY Dow

I tried changing the title this time, but the content does not change much. I will continue from the last time.

Data preparation

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

#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. 2020-02-07.png

Try to plot

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)

2020-02-07 (1).png 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.

Chat

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

[Introduction to Python] Combine Nikkei 225 and NY Dow csv data
[Introduction to cx_Oracle] (Part 6) DB and Python data type mapping
[Introduction to Python3 Day 1] Programming and Python
[Introduction to Data Scientists] Basics of Python ♬ Functions and classes
Solving AOJ's Algorithm and Introduction to Data Structures in Python -Part1-
Solving AOJ's Algorithm and Introduction to Data Structures in Python -Part2-
Solving AOJ's Algorithm and Introduction to Data Structures in Python -Part3-
[Introduction to Data Scientists] Basics of Python ♬ Conditional branching and loops
[Introduction to Data Scientists] Basics of Python ♬ Functions and anonymous functions, etc.
[Introduction to Python3, Day 17] Chapter 8 Data Destinations (8.1-8.2.5)
[Introduction to Python3, Day 17] Chapter 8 Data Destinations (8.3-8.3.6.1)
[Introduction to Python3 Day 19] Chapter 8 Data Destinations (8.4-8.5)
[Introduction to Python3 Day 18] Chapter 8 Data Destinations (8.3.6.2 to 8.3.6.3)
Read Python csv and export to txt
Compress python data and write to sqlite
[Introduction to Data Scientists] Basics of Python ♬
Data analysis: Easily apply descriptive and inference statistics to CSV data in Python
Scraping tabelog with python and outputting to CSV
[Introduction to Python3 Day 12] Chapter 6 Objects and Classes (6.3-6.15)
[Python] How to read data from CIFAR-10 and CIFAR-100
[Introduction to Python3 Day 22] Chapter 11 Concurrency and Networking (11.1 to 11.3)
[Introduction to Udemy Python3 + Application] 64. Namespace and Scope
Write CSV data to AWS-S3 with AWS-Lambda + Python
[Python] From morphological analysis of CSV data to CSV output and graph display [GiNZA]
[Introduction to cx_Oracle] (Part 9) DB and Python data type mapping (version 8 or later)
[Python] How to name table data and output it in csv (to_csv method)
Introduction to Python language
Introduction to OpenCV (python)-(2)
[Introduction to Udemy Python3 + Application] 35. Comparison operators and logical operators
Full-width and half-width processing of CSV data in Python
[Introduction to Udemy Python3 + Application] 68. Import statement and AS
[Technical book] Introduction to data analysis using Python -1 Chapter Introduction-
[Introduction to Sound] Let's arrange the introduction to sounds of python and R ♬-Listen to the sound of the explosion of Nikkei 255-
Introduction to Python Django (2) Win
[Introduction to Data Scientists] Descriptive Statistics and Simple Regression Analysis ♬
[Introduction to Udemy Python3 + Application] 42. for statement, break statement, and continue statement
[Introduction to Udemy Python3 + Application] 39. while statement, continue statement and break statement
[Introduction to Udemy Python 3 + Application] 36. How to use In and Not
20200329_Introduction to Data Analysis with Python Second Edition Personal Summary
Introduction to serial communication [Python]
Build a Python environment and transfer data to the server
An introduction to statistical modeling for data analysis (Midorimoto) reading notes (in Python and Stan)
[Python / Ruby] Understanding with code How to get data from online and write it to CSV
Python code for writing CSV data to DSX object storage
Write to csv with Python
[Introduction to Udemy Python3 + Application] 50. Positional arguments, keyword arguments, and default arguments
[Introduction to Python] <list> [edit: 2020/02/22]
Introduction to Effectiveness Verification Chapters 4 and 5 are written in Python
Introduction to Python (Python version APG4b)
An introduction to Python Programming
[Python] Introduction to graph creation using coronavirus data [For beginners]
Get additional data to LDAP with python (Writer and Reader)
Introduction to Python For, While
A python script that converts Oracle Database data to csv
[Introduction to Python] How to get data with the listdir function
Extract csv data and calculate
"Introduction to data analysis by Bayesian statistical modeling starting with R and Stan" implemented in Python
processing to use notMNIST data in Python (and tried to classify it)
How to import CSV and TSV files into SQLite with Python
[Introduction to Python] I compared the naming conventions of C # and Python.
Introduction to Data Analysis with Python P32-P43 [ch02 3.US Baby Names 1880-2010]