Python Pandas File I/O

The pandas module supports multiple helper commands to create a DataFrame from data files.


CSV

To import a CSV file:

import pandas as pd
data = pd.read_csv("example.csv", index_col="UniqueID")

If the index_col argument is left off, the DataFrame will be indexed by sequential integers.

Columns can be filtered with the usecols argument.

data = pd.read_csv("example.csv", usecols=["First"])


CategoryRicottone

Python/Pandas/FileIO (last edited 2024-01-15 21:54:12 by DominicRicottone)