CommencerCommencer gratuitement

From a CSV file

CSV files are a common way to store tabular data, and pandas is the easiest way to read them into Python. And easy is no exaggeration, you only need one function to import a CSV file with pandas, and it automatically converts the file to a DataFrame.

In this exercise, you are going to explore the pandas function read_csv() and its arguments to read in a CSV file, which contains records of wildlife strikes. Before starting, run help(pd.read_csv) in the console to view the arguments for the read_csv() function. There are many, but understanding your options will save you lots of time when importing your data.

Cet exercice fait partie du cours

Python for MATLAB Users

Afficher le cours

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Load strikes from strikes.csv
strikes = pd.read_csv('____')

print(strikes.head())
Modifier et exécuter le code