Read CSV file with Python and convert it to DataFrame as it is

Introduction

--Summary of how to read data acquired by CSV for analysis in Python and hold it in Pandas Datafarame type.

Advance preparation

--Prepare the CSV file you want to analyze in the current directory --CSV file is premised on molding

code

import csv, os
import pandas as pd
import numpy as np

#Specify the path string of the target file
file_path = os.path.join(".","maerge_Machine11_trd.csv")
print("file name:" + file_path)

#Convert from CSV file to df
df = pd.read_csv(file_path)

#Display of read data
df.head()

#TODO:Getting the desired data from df
#TODO:Statistical analysis and visualization

Commentary

--Specify the file location with os.path.join () without depending on the environment --Open the file with pd.read_csv () and convert it to dataframe type ――After this, you can get the necessary rows and columns from df and perform statistical analysis and visualization.

Recommended Posts

Read CSV file with Python and convert it to DataFrame as it is
How to read a CSV file with Python 2/3
How to convert JSON file to CSV file with Python Pandas
[Python] Write to csv file with Python
Output to csv file with Python
Convert list to DataFrame with python
[Python] How to convert db file to csv
Read CSV file with python (Download & parse CSV file)
[Python] Convert csv file delimiters to tab delimiters
Read Python csv and export to txt
[Python] Convert CSV file uploaded to S3 to JSON file with AWS Lambda
Read big endian binary in Python and convert it to ndarray
Normalize the file that converted Excel to csv as it is.
[Python] How to read excel file with pandas
Convert svg file to png / ico with Python
Convert the spreadsheet to CSV and upload it to Cloud Storage with Cloud Functions
[Python] How to scrape a local html file and output it as CSV using Beautiful Soup
Read Python csv file
[Introduction to Pandas] Read a csv file without a column name and give it a column name
Since python is read as "Pichon", it can be executed with "Pichon" (it is a story)
I tried to touch the CSV file with Python
Read the csv file and display it in the browser
Read and write csv file
Read csv with python pandas
Download csv file with python
Compress variables such as DataFrame with joblib instead of pickle to read and write
Read the csv file with jupyter notebook and write the graph on top of it
It is easy to execute SQL with Python and output the result in Excel
After all it is wrong to cat with python subprocess.
How to convert Youtube to mp3 and download it super-safely [Python]
Convert video to black and white with ffmpeg + python + opencv
How to read an Excel file (.xlsx) with Pandas [Python]
Python CSV file reading and writing
[Python / Ruby] Understanding with code How to get data from online and write it to CSV
Reading and writing CSV with Python
[Python] What is a tuple? Explains how to use without tuples and how to use it with examples.
Precautions when inputting from CSV with Python and outputting to json to make it an exe
Extract bigquery dataset and table list with python and output as CSV
Made it possible to convert PNG to JPG with Pillow of Python
Create a temporary file with django as a zip file and return it
How to import CSV and TSV files into SQLite with Python
After calling the Shell file on Python, convert CSV to Parquet.
[Python] How to store a csv file as one-dimensional array data
[Python] Read a csv file with a large data size using a generator
Convert the result of python optparse to dict and utilize it
[Python] What is pip? Explain the command list and how to use it with actual examples
Process the gzip file UNLOADed with Redshift with Python of Lambda, gzip it again and upload it to S3
Read the old Gakushin DC application Word file (.doc) from Python and try to operate it.
[Python] What is pandas Series and DataFrame?
How to convert Python to an exe file
Convert from PDF to CSV with pdfplumber
Convert psd file to png in Python
Convert Excel data to JSON with python
Convert Hiragana to Romaji with Python (Beta)
Fractal to make and play with Python
Let's read the RINEX file with Python ①
Convert FX 1-minute data to 5-minute data with Python
[Python] Complete preprocessing Memo as it is
[Part1] Scraping with Python → Organize to csv!
Convert HEIC files to PNG files with Python
Convert Chinese numerals to Arabic numerals with Python