P: 1
| - import pandas as pd
-
import numpy as np
-
-
-
#Dataset 1
-
path="D:\\Data Science\\Python-Piyush\\Interview practice\\age.csv"
-
age=pd.read_csv(path)
-
age.head()
-
-
#1) To find mean age of dataset
-
a=(round(np.mean(age),5))
-
print(type(a))
-
print(a)
-
-
import pandas as pd
-
import numpy as np
-
-
-
#Dataset 1
-
path="D:\\Data Science\\Python-Piyush\\Interview practice\\age.csv"
-
age=pd.read_csv(path)
-
age.head()
-
-
#1) To find mean age of dataset
-
a=(round(np.mean(age),5))
-
print(type(a))
-
print(a)
-
-
#2)NO of entries that have age less than mean age
-
for i in age['Age']:
-
y=i<a
-
print(y)
-
print(type(y))
-
-
c=y.value_counts('True')for i in age['Age']:
-
y=i<a
-
print(y)
-
print(type(y))
-
-
c=y.value_counts('True')
| |
Share this question for a faster answer!