Skip to content
Justice Tech School

read_csv Options

sep, header, names, usecols, dtype and parse_dates tune reading.

Example
import io
text = "id;when;amount\n1;2026-01-05;9.5\n2;2026-02-10;7"
df = pd.read_csv(io.StringIO(text), sep=";", parse_dates=["when"])
print(df.dtypes.astype(str).tolist())
print(df["when"].dt.month.tolist())

Result

['int64', 'datetime64[us]', 'float64']
[1, 2]

Exercise

Change the separator.

read_csv(f, =";")

Quiz Test

What does parse_dates do?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.