2. Dimensions of a DataFrame
• Dimensions of a DataFrame
• To get shape or dimensions of a DataFrame in Pandas, use the
DataFrame.shape attribute. This attribute returns a tuple
representing the dimensionality of this DataFrame.
• The dimensions are returned as tuple (rows, columns).
3. Dimensions of a DataFrame
• In the following program, we take a DataFrame and find its
dimensionality using DataFrame.shape attribute.
4. Dimensions of a DataFrame
import pandas as pd
df = pd.DataFrame(
{'name': ["apple", "banana", "cherry"], 'quant': [40, 50, 60]})
print(df.shape)