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:")
print(df.columns)
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'], dtype='object')
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.
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://198.211.115.131/python-exercises/pandas/movies/python-pandas-movies-exercise-1.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics