ARTIFICIAL CODEWALA
Menu
HOME
SITEMAP
CONTACT US
PRIVACY POLICY
SERIES CONCEPT OF ATTRIBUTES
ARTIFICIALCODEWALA
April 26, 2021
Attributes Uses in DataFrame
import pandas as pd
Ser_Weight= pd.Series(data=[42, 75, 56, 45, 55],
index =['Stud1', 'Stud2', 'Stud3', 'Stud4', 'Stud5'])
Ser_Age = pd.Series(data=[15, 17, 16, 15, 18],
index =['Stud1', 'Stud2', 'Stud3', 'Stud4', 'Stud5'])
Ser_Name= pd.Series(data=['Arnav', 'Kailash', 'Mohan' , 'Manavi' , 'Kavya'],
index =['Stud1', 'Stud2', 'Stud3', 'Stud4', 'Stud5'])
dtf1 =pd.DataFrame({'Weight' : Ser_Weight, 'Age' :Ser_Age, 'Name': Ser_Name})
print(dtf1)
#print(dtf1.T)
#print(dtf1.index)
#print(dtf1.columns)
#print(dtf1.axes)
#print(dtf1.dtypes)
#print(dtf1.size)
#print(dtf1.shape)
#print(dtf1.ndim)
#print(dtf1.empty)
#print(dtf1.count())
#print(dtf1.count(1))
#print(dtf1.T)
#print(dtf1[['Weight', 'Name']])
#print(dtf1.loc['Stud1': 'Stud3'])
#print(dtf1.iloc[0:4, 0:3])
#print(dtf1.Name['Stud3'])
#print(dtf1.at['Stud1', 'Age'])
#print(dtf1.iat[0,2])
#dtf1.Name['Stud3']='Akash'
#print(dtf1)
#dtf1['Subject']=['English', 'Maths', 'Chemistry', 'Physics', 'IP' ]
#print(dtf1)
#dtf1.at['Stud3']='Bipul'
#print(dtf1)
#dtf1.loc['Stud3']='Bipul'
#print(dtf1)
#dtf1.at[ : , 'Age']=16
#print(dtf1)
#dtf1.loc[ : , 'Age']=16
#print(dtf1)
#deldtf1['Age']
#print(dtf1)
dtf1.pop('Weight')
print(dtf1)
dtf2=dtf1.drop(['Stud1'])
print(dtf2)
Attributes Uses in Series
import numpy as np
import pandas as pd
obj1=pd.Series(data=[0, 1, 2, 3, 4])
obj2=pd.Series(data=[2.5, 3.5, 4.5, 9.5], index=['a', 'b', 'c', 'd'])
#print(obj1)
#print(obj2)
#print(obj1.index)
#print(obj2.index)
#print(obj1.values)
#print(obj2.values)
#print(obj1.dtype)
#print(obj2.dtype)
#print(obj1.itemsize)
#print(obj2.itemsize)
#print(obj1.shape)
#print(obj2.shape)
#print(obj1.ndim)
#print(obj2.ndim)
#print(obj1.size)
#print(obj2.size)
#print(obj1.nbytes)
#print(obj2.nbytes)
0 Comments
Popular Posts
Matrix Multiplication in C
August 14, 2022
Email Newsletter
September 20, 2024
Square Root
August 24, 2022
SERIES CONCEPT OF ATTRIBUTES
April 26, 2021
CONVERT FLASH TO USB USING CMD
August 14, 2022
Categories
C Programming
11
C++
1
DSA
1
HTML
1
Java oops
1
MACHINE LEARNING
1
MYSQL
5
NATURAL LANGUAGE PROCESSING
1
Pen Drive
2
PYTHON
17
SHARING APP
1
UI/UX
3
Total Pageviews
0 Comments