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

Dataframe Notes

informatics practices

Uploaded by

ananyag1407
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)
2 views3 pages

Dataframe Notes

informatics practices

Uploaded by

ananyag1407
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

Series

Generate a series with the help of an array


Stars= [Link]([“lana”, “dani”], index=[1,2])

Create a series from dictionary


Stars={1:”lana”, 2:”dani”}

New= [Link](stars)

Do slicing and show 5 num


Num=[Link](2,4,6,8,10,12,14)

Print(num[1:6])

Naming series or index


[Link]= ‘hxbh’

[Link]=’bcdb’

Print(num)

Display last or first 5 numbers


Print([Link](5))

Print([Link] (5))

Dataframe
Naming of dataframe’s column and index
Explain dataframe with example of an array, also show how to form
a dataframe from array
Dataframe is a 2D labeled structure capable of holding any datatype, it contains rows and
columns.

TO ADD A COLUMN
MyData[‘E’]= [5,5,5]

To delete a column
MyData= [Link]([‘C’], axis=1)

To rename a row
MyData= [Link]({‘B’:’Bhaloo’},axis=’columns’)

To add a row
[Link][‘d’]= [1,1,1]

To delete a row
MyData= [Link]([‘C’], axis=0)

To rename a row
MyData= [Link]({‘a’:’aloo’},axis=’index’)

indexing/ showing only one specific row


print( [Link][‘b’])

IT IS VERY IMPORTANT THAT U KNOW THAT THE KEY IN DICTIONARY


{2:_} BECOMES INDEX IN SERIES BUT COLUMN IN DATAFRAME.
Ques-

You might also like