0% found this document useful (0 votes)
2 views3 pages

Essential DataFrame Attributes Guide

The document outlines various attributes of a DataFrame in Python, including index, columns, dtypes, size, shape, values, and methods such as head and tail for displaying rows. It provides examples of how to use these attributes and methods to retrieve information about a DataFrame named DF. The document serves as a reference for manipulating and accessing data within a DataFrame.

Uploaded by

nicgerr328
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

Essential DataFrame Attributes Guide

The document outlines various attributes of a DataFrame in Python, including index, columns, dtypes, size, shape, values, and methods such as head and tail for displaying rows. It provides examples of how to use these attributes and methods to retrieve information about a DataFrame named DF. The document serves as a reference for manipulating and accessing data within a DataFrame.

Uploaded by

nicgerr328
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

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]( ))

You might also like