0% found this document useful (0 votes)
23 views2 pages

Pandas DataFrame Assignment

The document provides a step-by-step algorithm for using Python's Pandas library to create and display a DataFrame. It includes instructions for installing Pandas, importing it, and displaying various attributes of the DataFrame such as shape, columns, data types, and descriptive statistics. A sample program is provided that demonstrates these functionalities with a simple dataset.

Uploaded by

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

Pandas DataFrame Assignment

The document provides a step-by-step algorithm for using Python's Pandas library to create and display a DataFrame. It includes instructions for installing Pandas, importing it, and displaying various attributes of the DataFrame such as shape, columns, data types, and descriptive statistics. A sample program is provided that demonstrates these functionalities with a simple dataset.

Uploaded by

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

Python Pandas - DataFrame Attributes

Algorithm:

1. Install Pandas using pip.

2. Import Pandas.

3. Create a DataFrame.

4. Display the DataFrame and its attributes (shape, columns, dtypes, head, describe).

Program:

import pandas as pd

data = {'Name': ['A', 'B'], 'Age': [20, 21]}

df = pd.DataFrame(data)

print(df)

print(df.shape)

print(df.columns)

print(df.dtypes)

print(df.head())

print(df.describe())

Output:

Name Age

0 A 20

1 B 21

(2, 2)

Index(['Name', 'Age'], dtype='object')

Name object

Age int64
dtype: object

Name Age

0 A 20

1 B 21

Age

count 2.000000

mean 20.500000

std 0.707107

min 20.000000

max 21.000000

You might also like