LoslegenKostenlos loslegen

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.

Diese Übung ist Teil des Kurses

Python for MATLAB Users

Kurs anzeigen

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

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

print(strikes.head())
Code bearbeiten und ausführen