Column Names and Data Types
To display all column names as a list, use the following line of code:
column_names = df.columns
To get a summary of all data types in the DataFrame, 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
DataFramecontains and store the result in thecolumn_namesvariable. - Get the data types of these columns from this
DataFrameand store the result in thedata_typesvariable.
Solution
Thanks for your feedback!
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
How can I display the column names as a list?
Can you explain what the output of `.dtypes` looks like?
What other useful attributes can I use to explore a DataFrame?
Awesome!
Completion rate improved to 3.03
Column Names and Data Types
Swipe to show menu
To display all column names as a list, use the following line of code:
column_names = df.columns
To get a summary of all data types in the DataFrame, 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
DataFramecontains and store the result in thecolumn_namesvariable. - Get the data types of these columns from this
DataFrameand store the result in thedata_typesvariable.
Solution
Thanks for your feedback!
single