Reading Data
Pandas can read data from many file formats. In the browser, we'll simulate loading data from strings.
Reading CSV Data
Use pd.read_csv() with a StringIO object to parse CSV strings:
Loading Pandas Playground...
CSV Options
Customize how CSV is parsed:
Loading Pandas Playground...
Reading JSON Data
Parse JSON strings or structures:
Loading Pandas Playground...
Inspecting Loaded Data
After loading, always inspect your data:
Loading Pandas Playground...
Exercise: Parse CSV
Loading Exercise...
Exercise: Inspect DataFrame
Loading Exercise...
Key Points
pd.read_csv()parses CSV data- Use
StringIOto read from strings in browser sep=parameter for custom delimiterspd.read_json()parses JSON data- Always inspect data with
.head(),.shape,.dtypes
Up next · Lesson 5 of 42
DataFrame Info & Stats
1 min read
4 of 42 lessons done

Ask Byte about this lesson
A private chat about this lesson. Byte has read the whole lesson, answers in seconds, and shows the section each answer comes from. Ask follow-ups in any language.
Questions & Answers
Public questions about this lesson. The AI Tutor answers right away in your language, the FreeAcademy team checks answers, and every learner can read them.

