Process csv data with python (count processing using pandas)

1 Target data

The Tokyo Metropolitan Government Building has released data on COVID-19 infected persons. Continuing from the last time, I would like to process this CSV data.

Infected person data published by the Tokyo Metropolitan Government https://catalog.data.metro.tokyo.lg.jp/dataset/t000010d0000000068/resource/c2d997db-1450-43fa-8037-ebb11ec28d4c (CSV file) https://stopcovid19.metro.tokyo.lg.jp/data/130001_tokyo_covid19_patients.csv

2 Program

The data released by the Tokyo Metropolitan Government include the age, gender, and date of publication of each person who tested positive for the new coronavirus. I would like to get the number of cases for each publication date, but for that purpose, it is necessary to perform processing such as GROUP BY or COUNT in SQL. The number of cases per day was obtained by the following program.

python


import pandas as pd
data = pd.read_csv('130001_tokyo_covid19_patients.csv',header=0) #header=0 Use the first line as the header
#Column to extract groupby in sql, count function
li = data[['No','Published_date']].groupby('Published_date').agg(['count'])        
print(li )

3 Referenced sites, etc.

[Python] Reading csv files using pandas https://qiita.com/f_kazqi/items/0e8e948be44ef2003f71

Read CSV with / without header with read_csv https://qiita.com/yuba/items/d09e387a1ec191eb2738

Select and get rows / columns with pandas index reference https://note.nkmk.me/python-pandas-index-row-column/

How to use the count function to count the number of data in Pandas https://deepage.net/features/pandas-count.html

Recommended Posts

Process csv data with python (count processing using pandas)
Read Python csv data with Pandas ⇒ Graph with Matplotlib
Read csv with python pandas
Data analysis using python pandas
Data processing tips with Pandas
[Python] Loading csv files using pandas
Process Pubmed .xml data with python
[Python] Various data processing using Numpy arrays
[Python] Read a csv file with a large data size using a generator
Example of efficient data processing with PANDAS
Process big data with Dataflow (ApacheBeam) + Python3
[Pandas] Basics of processing date data using dt
100 language processing knock-20 (using pandas): reading JSON data
Write CSV data to AWS-S3 with AWS-Lambda + Python
100 language processing knock-95 (using pandas): Rating with WordSimilarity-353
Processing datasets with pandas (1)
Processing datasets with pandas (2)
Data analysis using Python 0
Data cleaning using Python
Data visualization with pandas
Data manipulation with Pandas!
Image processing with Python
Shuffle data with pandas
Csv tinkering with python
Data analysis with Python
Convert csv, tsv data to matrix with python --using MovieLens as an example
Full-width and half-width processing of CSV data in Python
Get Amazon RDS (PostgreSQL) data using SQL with pandas
Collectively register data in Firestore using csv file in Python
Data analysis environment construction with Python (IPython notebook + Pandas)
How to convert JSON file to CSV file with Python Pandas
Make a CSV formatting tool with Python Pandas PyInstaller
[Python] A memo to write CSV vertically with Pandas
Image processing with Python (Part 2)
Sample data created with python
100 Language Processing with Python Knock 2015
"Apple processing" with OpenCV3 + Python3
[S3] CRUD with S3 using Python [Python]
Using Quaternion with Python ~ numpy-quaternion ~
Acoustic signal processing with Python (2)
Get Youtube data with python
[Python] Using OpenCV with Python (Basic)
Acoustic signal processing with Python
[Python] Change dtype with pandas
Image processing with Python (Part 1)
Image processing with Python (Part 3)
Write to csv with Python
Download csv file with python
Using Python mode in Processing
Process feedly xml with Python.
Using OpenCV with Python @Mac
Send using Python with Gmail
[Python] Image processing with scikit-image
Read json data with python
Notes on importing data from MySQL or CSV with Python
Notes on handling large amounts of data with python + pandas
[Homology] Count the number of holes in data with Python
Graph time series data in Python using pandas and matplotlib
[Python] Random data extraction / combination from DataFrame using random and pandas
Play with YouTube Data API v3 using Google API Python Client
Harmonic mean with Python Harmonic mean (using SciPy)