Throughout this lesson, you’ll use Seaborn to visualize a Pandas DataFrame.
DataFrames contain data structured into rows and columns. DataFrames look similar to other data tables you may be familiar with, but they are designed specifically to be used with Python.
You can create a DataFrame from a local CSV file (CSV files store data in a tabular format).
To create a DataFrame from a local CSV file you would use the syntax:
df = pd.read_csv('file_name.csv')
The code above creates a DataFrame saved to a variable named
df. The data inside of the
df DataFrame comes from the data in the local CSV file named
Once you have prepared and organized a Pandas DataFrame with your chosen dataset, you are ready to plot with Seaborn!
In script.py you can see
pd.read_csv() is used to ingest the data stored in a file named survey.csv. If you’d like, you can inspect the contents of survey.csv in the file system of your workspace. We will explain the context of survey.csv in more detail in the next exercise. For now, focus on the syntax used to create a DataFrame from a CSV file.
Inspect the DataFrame by printing the first 5 rows of