DataFrame Attributes
Attribute Description
index Return index of the DataFrame
columns Return the column labels of the DataFrame
dtypes Return the dtypes of data in DataFrame
size Return number of elements present in the DataFrame
Return a tuple which represents the dimensionality of
shape
DataFrame
values Return a NumPy representation of the DataFrame
Check if DataFrame is empty or not. Returns True if
empty
Dataframe is empty other returns False.
T Transpose the DataFrame
To display the first ‘n’ rows in the DataFrame. If the ‘n’ value
head(n)
is not given first 5 rows will be displayed by default.
To display the last ‘n’rows in the DataFrame. If the ‘n’ value is
tail(n)
not given last 5 rows will be displayed by default
Consider the below DataFrame named as, DF
1. Display the row labels of employees.
print([Link])
2. Display the column labels of employees.
print([Link])
3. Display the data types of each columns employees.
print([Link])
4. Find the dimensions of the employee dataframe.
print([Link])
5. Find the total number of elements in the dataframe employee.
print([Link])
6. Display all the values in the dataframe employee.
print([Link])
7. Check whether the employee dataframe is empty or not.
print([Link])
8. Display the dataframe by interchanging the rows into columns and
columns into rows.
print(DF.T)
9. Display the first 3 rows from the DataFrame employee.
print([Link](3))
10. Display the last 5 rows from the DataFrame employee.
print([Link]( ))