Format the CSV file of "National Holiday" of the Cabinet Office with pandas

That was hit on Twitter. I wondered what kind of terrible thing it was, and opened it with python pandas. This is the real thing

スクリーンショット 2017-02-23 0.52.30.png

I can't say anything because I don't know how to use this CSV file, but is this so terrible? I was hoping that the rows and columns would be out of alignment, and the date format would be different. Even if the date format is different, pandas has a function to unify the time series, so it can be solved relatively easily.

Let's shape it anyway.

スクリーンショット 2017-02-23 2.05.59.png

What was shaped -Delete the column where the missing value exists -Delete duplicate names -Change the date from string type to datetime type These are the three points.

Is this a little easier to see?

By the way, let's display whether there is a gap every year on that holiday.

スクリーンショット 2017-02-23 2.09.51.png

As a bonus, there is also a version in one row

スクリーンショット 2017-02-23 1.17.05.png

This kind of data formatting is easy with Pandas.

Recommended Posts

Format the CSV file of "National Holiday" of the Cabinet Office with pandas
When reading a csv file with read_csv of pandas, the first column becomes index
Check the existence of the file with python
Read and format a csv file mixed with comma tabs with Python pandas
Convert the character code of the file with Python3
Find the sum of unique values with pandas crosstab
I tried to touch the CSV file with Python
Read CSV file: pandas
Read the linked list in csv format with graph-tool
How to output CSV of multi-line header with pandas
Output the output result of sklearn.metrics.classification_report as a CSV file
Read the csv file with jupyter notebook and write the graph on top of it
[Memo] Load csv of s3 into pandas with boto3
Create a new csv with pandas based on the local csv
[Python] Read the csv file and display the figure with matplotlib
Read the GRIB2 file of the Japan Meteorological Agency with pygrib
Reformat the timeline of the pandas time series plot with matplotlib
Read csv with python pandas
Download csv file with python
The Power of Pandas: Python
Process the contents of the file in order with a shell script
The story of outputting the planetarium master in pdf format with Pycairo
I wrote the basic operation of Pandas with Jupyter Lab (Part 1)
The idea of feeding the config file with a python file instead of yaml
I wrote the basic operation of Pandas with Jupyter Lab (Part 2)
Format the Git log and get the committed file name in csv format
[pandas] .csv file reading and display method
[Note] File reading ~ Python ~
Read CSV file: pandas
python external file reading
Type after reading an excel file with pandas read_excel
AHC task (1) Reading CSV file
Pandas basics for beginners ① Reading & processing
Pandas
Format the CSV file of "National Holiday" of the Cabinet Office with pandas
Python CSV file reading and writing
[Python] Format when to_csv with pandas
Read and format a csv file mixed with comma tabs with Python pandas
Convert matplotlib graphs to emf file format
[Easy Python] Reading Excel files with pandas
Download Pandas DataFrame as a CSV file
Follow the file hierarchy with fts
Output to csv file with Python
Download the file deployed with appcfg.py
The story of the "hole" in the file
Open the file with the default app
[Python] Format when to_csv with pandas
Edit the file of the SSH connection destination server on the server with VS Code
How to put a line number at the beginning of a CSV file
[Python] How to read a csv file (read_csv method of pandas module)
Summary of processes often performed in Pandas 1 (CSV, Excel file related operations)
I made a mistake in fetching the hierarchy with MultiIndex of pandas