Guided Notes
Reading & Analyzing Data
Reading CSV and JSON, viewing large tables, and the first checks: head, tail, info, and describe.
Reading CSV files
Slide 1 / 5CSV (comma-separated values) is the simplest way to store big tables as plain text, and pandas reads it in one line:
df = pd.read_csv('data.csv')
The first line becomes the column names. Useful options: sep=';' for other delimiters, usecols=[β¦] to load only some columns, parse_dates=['date'] to read dates as dates, and nrows=1000 to preview a huge file.
df.to_csv('clean.csv', index=False) writes a DataFrame back out.
