To recap: For a DataFrame, .shape
returns a tuple with the number of rows and columns. For a Series, it returns the number of rows. Use .shape
to quickly check the size of your dataset or verify the results of filtering and selection. Also, remember that .shape
is an attribute, so you don’t need parentheses to access it.
Python Select Columns Tutorial
Use Python Pandas and select columns from DataFrames. Follow our tutorial with code examples and learn different ways to select your data today!
Updated Nov 25, 2024 · 7 min read
Learn Python From Scratch
Master Python for data science and gain in-demand skills.
Python Courses
course
Intermediate Python
4 hr
1.2M
course
Introduction to Python
4 hr
5.9M
course
Reshaping Data with pandas
4 hr
17.8K
See More
RelatedSee MoreSee More
cheat-sheet
Pandas Cheat Sheet for Data Science in Python
A quick guide to the basics of the Python data analysis library Pandas, including code samples.
Karlijn Willems
4 min
tutorial
Pandas Tutorial: DataFrames in Python
Explore data analysis with Python. Pandas DataFrames make manipulating your data easy, from selecting or replacing columns and indices to reshaping your data.
Karlijn Willems
20 min
tutorial
How to Drop Columns in Pandas Tutorial
Learn how to drop columns in a pandas DataFrame.
DataCamp Team
3 min
tutorial
Pandas Add Column Tutorial
You are never stuck with just the data you are given. Instead, you can add new columns to a DataFrame.
DataCamp Team
4 min
tutorial
Pandas Apply Tutorial
Learn what Python pandas .apply is and how to use it for DataFrames. Learn how to iterate over DataFrames using the .apply() function today!
DataCamp Team
3 min
tutorial
Joining DataFrames in pandas Tutorial
In this tutorial, you’ll learn various ways in which multiple DataFrames could be merged in python using Pandas library.
DataCamp Team
19 min