Column Names and Data Types
To see all the column names as a list, we have to use this line of code:
column_names = df.columns
We can also get a summary of all the types of data that are in the dataframe. For this, we have to use the following attribute: .dtypes
.
data_types = df.dtypes
Swipe to start coding
You are given a DataFrame
named wine_data
.
- Get the column names that this
DataFrame
contains and store the result in thecolumn_names
variable. - Get the data types of these columns from this
DataFrame
and store the result in thedata_types
variable.
Solution
Thanks for your feedback!
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
What does the output of `df.columns` look like?
Can you explain what the `.dtypes` attribute shows?
How can I use these attributes to better understand my dataframe?
Awesome!
Completion rate improved to 3.03
Column Names and Data Types
Swipe to show menu
To see all the column names as a list, we have to use this line of code:
column_names = df.columns
We can also get a summary of all the types of data that are in the dataframe. For this, we have to use the following attribute: .dtypes
.
data_types = df.dtypes
Swipe to start coding
You are given a DataFrame
named wine_data
.
- Get the column names that this
DataFrame
contains and store the result in thecolumn_names
variable. - Get the data types of these columns from this
DataFrame
and store the result in thedata_types
variable.
Solution
Thanks for your feedback!
single