Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Column Names and Data Types | Analyzing the Data
Pandas First Steps

bookColumn 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
Task

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 the column_names variable.
  • Get the data types of these columns from this DataFrame and store the result in the data_types variable.

Solution

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 5
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

Suggested prompts:

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?

close

Awesome!

Completion rate improved to 3.03

bookColumn 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
Task

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 the column_names variable.
  • Get the data types of these columns from this DataFrame and store the result in the data_types variable.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 5
single

single

some-alt