Pandas provides several useful functions.
head()
- Displays the first five rows by default.
print(df.head())
tail()
- Displays the last five rows.
print(df.tail())
shape
- Shows the number of rows and columns.
print(df.shape)
columns
- Displays all column names.
print(df.columns)
dtypes
- Shows the data type of each column.
print(df.dtypes)
info()
- Provides important information about the DataFrame.
df.info()
- Number of rows
- Column names
- Data types
- Non-null values
- Memory usage
describe()
- Provides statistical information for numerical columns.
print(df.describe())
- Count
- Mean
- Standard deviation
- Minimum
- Maximum
- Quartiles
Top comments (0)