Pandas: Get the columns of the DataFrame

Pandas: IMDb Movies Exercise-1 with Solution

Write a Pandas program to get the columns of the DataFrame (movies_metadata.csv file).

Sample Solution:

Python Code:

import pandas as pd
import numpy as np
df = pd.read_csv('movies_metadata.csv')
print("Columns of the DataFrame:")

Sample Output:

Columns of the DataFrame:
Index(['adult', 'belongs_to_collection', 'budget', 'genres', 'homepage', 'id',
       'imdb_id', 'original_language', 'original_title', 'overview',
       'popularity', 'poster_path', 'production_companies',
       'production_countries', 'release_date', 'revenue', 'runtime',
       'spoken_languages', 'status', 'tagline', 'title', 'video',
       'vote_average', 'vote_count'],

Python-Pandas Code Editor:

Sample Table:

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Python Pandas Data Series, DataFrame Exercises Home.
Next: Write a Pandas program to get the information of the DataFrame (movies_metadata.csv file)including data types and memory usage.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.

Follow us on Facebook and Twitter for latest update.