Etl1 6
Etl1 6
CODE
import pandas as pd
print("Original series:")
print(str1)
ser = pd.Series(list(str1))
element_freq = ser.value_counts()
print(element_freq)
current_freq = element_freq.dropna().index[-1]
print(result)
OUTPUT
EX-2
CODE
import pandas as pd
df = pd.DataFrame({'X':[78,85,96,80,86],
'Y':[84,94,89,83,86],'Z':[86,97,96,72,83]});
print(df)
OUTPUT
EX-3
CODE
import pandas as pd
import numpy as np
exam_data={'name':['Anasstasia','Dima','Katherine','James','Emily','Michael',
'Matthew','Laura','Kelvin','Jonas'],'score':[12.5,9,16.5,np.nan,9,20,14.5,np.
nan,8,19],'attempts':[1,3,2,3,2,3,1,1,2,1],'qualify':['yes','no','yes','no','
no','yes','yes','no','no','yes']}
labels=['a','b','c','d','e','f','g','h','i','j']
df=pd.DataFrame(exam_data,index=labels)
print("Summary of the basic information about this DataFrame and its data:")
print(df.info())
OUTPUT
EX-4
CODE
import pandas as pd
pd.set_option('display.max_rows', None)
student_data = pd.DataFrame({
'date_Of_Birth':
['15/05/2002','17/05/2002','16/02/1999','25/09/1998','11/05/2002','15/09/1997
'],'roll_no': ['s001','s002','s003','s001','s002','s004'],'class': ['V',
'V','VI', 'VI', 'V', 'VI'],'age': [12, 12, 13, 13, 14, 12],'height': [173,
192, 186, 167, 151, 159],'weight': [35, 32, 33, 30, 31, 32],'address':
['street1', 'street2', 'street3', 'street', 'street2', 'street4']},
index=['S1', 'S2', 'S3', 'S4', 'S5', 'S6'])
print("Original DataFrame:")
print(student_data)
print('\nMean, min, and max value of age for each value of the school:')
print(grouped_single)
OUTPUT
EX-5
CODE
import pandas as pd
import numpy as np
pd.set_option('display.max_rows', None)
print(df)
print(df.isna().sum())
OUTPUT
EX-6
CODE
import pandas as pd
import numpy as np
np.random.seed(24)
df.iloc[0, 2] = np.nan
df.iloc[3, 3] = np.nan
df.iloc[4, 1] = np.nan
df.iloc[9, 4] = np.nan
print("Original DataFrame:")
print(df)
def highlight_max(s):
'''
'''
is_max = s == s.max()