Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Series
What DataFrames are
7. DataFrames basics
DataFrame columns
DataFrame rows
Filtering rows and columns
Filtering data frames
Sorting rows
Summary

Instruction

Good! Now that we've briefly introduced Series, it's time for the real fun: DataFrames.

A DataFrames resemble a table or Excel sheet: it contains columns and rows. Working with DataFrames is very intuitive. One of the easiest ways to create a DataFrame is by reading a CSV file:

hospital_data = pd.read_csv('hospitals.csv')

The code above will read the hospitals.csv file into a new variable named hospital_data.

In real life, CSV files often use separators other than commas. Luckily, you can specify the separator to meet your needs. For example, we can specify that the separator used in the file is the semicolon (;):

hospital_data = pd.read_csv('hospitals.csv', sep=';')

Exercise

In this part, you will be working with some basic demographic data about European Union states.

Create a variable named eu_states that will contain a DataFrame created from the file eu_states.csv.