User Tools

Site Tools


pandas

Pandas

Create Dataframe

data = {'col1': [1, 2], 'col2': [3, 4]}
df = pd.DataFrame(data=data)

Load and Save

Save to CSV

df.to_csv(<path_or_buffer>)

Without row names (index):

df.to_csv(<path_or_buffer>, index=False)

Load from CSV

df = pd.read_csv(
        <path_or_buffer>,
        sep=';',
        encoding='us-ascii',
        usecols=<col_list>,
        nrows=<number_of_rows_to_read>,
        )
pandas.txt · Last modified: 2020/07/26 11:50 by pmay