Revision 4 as of 2020-04-08 16:04:08

Clear message

Description

Pandas is a fast, powerful, flexible and easy to use open source data analysis and manipulation tool, built on top of the Python programming language.

Snippets

Standard import

   1 import numpy as np
   2 import pandas as pd

Read CSV file

   1 path = '/path/to/file(s)'
   2 df = pd.read_csv(path + 'name.csv', sep=';', header=0, dtype={'Force String Column': str}, 
   3                  parse_dates=['Date Column'] encoding='utf-8')

Renaming Columns

   1 dt.rename(columns={'File column name 1': 'Column1', 'File column name 2': '2'}, inplace=True)

Do Y for each value in column X

   1 df.loc[:, ['X']] = df.loc[:, ['X']].apply(lambda x: x.Y)

Renaming Columns1

   1 dt.rename(columns={'File column name 1': 'Column1', 'File column name 2': '2'}, inplace=True)