Self Study Assignment Python II
Self Study Assignment Python II
import pandas as pd
import os
/Users/juhikulshreshtha
/Users/juhikulshreshtha/Downloads/Week_6_Data Set_Graded_Assignment_6_1.xlsm
TV Radio Newspaper Sales
import re
for m in months:
try:
result=re.search(r"\AJ",m)
if(result.start())==0:
print(m)
except AttributeError:
continue
January
June
July
2023-09-10
10
import math
print("Sq root of 367 is:", math.sqrt(367))
print("Factorial of 21 is:", math.factorial(21))
print("7th power of 367 is:", math.pow(367,7))
print("Ceiling of 20.8 is:", math.ceil(20.8))
print("Floor of 318.3 is:", math.floor(318.3))
import numpy as np
A=[[1,2,3],[4,5,6],[7,8,9]]
B=[[3,2,4],[5,5,5],[7,8,8]]
C=np.add(A,B)
print("Row Level Addition")
print(C)
a=np.transpose(A)
b=np.transpose(B)
c=np.add(a,b)
print("Column Level Addition")
print(c)
Describe Data:
DescribeResult(nobs=6, minmax=(3, 8), mean=5.166666666666667, variance=2.966666666666667, skewness=0.4954596832
389274, kurtosis=-0.5779573286201241)
Cumulative Freq:
CumfreqResult(cumcount=array([1., 1., 2., 2., 4., 5., 5., 5., 5., 6.]), lowerlimit=2.7222222222222223, binsize=
0.5555555555555554, extrapoints=0)
Harmonic Mean:
4.705882352941177
Geometric Mean:
4.93242414866094
IQR:
1.5
print("\n----------- Filter out the data set where sales is greater than 15 -----------\n")
res_df=df[df['Sales']>15]
res_df
/Users/juhikulshreshtha
/Users/juhikulshreshtha/Downloads/Week_6_Data Set_Graded_Assignment_6_1.xlsm
TV 147.0425
Radio 23.2640
Newspaper 30.5540
Sales 15.1305
dtype: float64
TV 149.75
Radio 22.90
Newspaper 25.75
Sales 16.00
dtype: float64
----------- Filter out the data set where sales is greater than 15 -----------
TV Radio Newspaper Sales rs
Loading [MathJax]/jax/output/CommonHTML/fonts/TeX/fontdata.js