Pandas: read and write csv
Date: April 3rd 2016
Last updated: April 3rd 2016
This is just the simplest command to get a pandas dataframe in and out of python. There are lots of options to change their performance. Most default options are what I want for now. E.g. default separator (comma).
import pandas as pd
# write
# DataFrame.to_csv(path_or_buffer='~/data.csv')
df.to_csv('~/data.csv')
# read
# pandas.read_csv(filepath_or_buffer='~/data.csv')
df = pd.read_csv('~/data.csv')
# do stuff with df (pandas dataframe)
Useful resources: