Question

B. (3 points) Using Python, parse the provided CSV file and do the following: 1. Calculate the mean, median, and mode of eachuse numpy

% growth of Weight Watchers Stock Daily # of Walmart Toy Units Sold
1.937 1
0.334 4
0.913 4
0.771 4
0.346 7
0.913 2
4.242 3
2.595 6
0.526 5
0.807 3
0.076 3
2.355 4
0.98 4
0.605 5
2.192 4
0.1 3
0.457 2
0.099 2
0.461 3
4.253 1
1.151 5
2.19 5
0.463 7
2.802 2
0.395 3
0.739 6
1.186 3
0.661 4
0.347 6
0.206 3
1.153 3
1.167 5
1.064 9
0.406 4
0.15 2
0.272 3
0.133 3
0.138 0
1.756 5
0.162 5
0.041 5
0.261 3
0.134 8
2.697 3
0.436 3
0 0
Add a comment Improve this question Transcribed image text
Answer #1

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy import stats
dataset=pd.read_csv(r"C:\Users\MAHE\Desktop\data.csv")
##part 1
col1=dataset['% growth of Weight Watchers Stock']
col2=dataset['Daily # of Walmart Toy Units Sold']
print('mean of % growth of Weight Watchers Stock: ',np.mean(col1))
print('mean of Daily # of Walmart Toy Units Sold: ',np.mean(col2))
print('median of % growth of Weight Watchers Stock: ',np.median(col1))
print('median of Daily # of Walmart Toy Units Sold: ',np.median(col2))
print('mode of % growth of Weight Watchers Stock: ',stats.mode(col1)[0])
print('mode of Daily # of Walmart Toy Units Sold: ',stats.mode(col2)[0])

##part 2
print('variance of % growth of Weight Watchers Stock: ',np.var(col1))
print('variance of Daily # of Walmart Toy Units Sold: ',np.var(col2))
print('standard deviation of % growth of Weight Watchers Stock: ',np.std(col1))
print('standard deviation of Daily # of Walmart Toy Units Sold: ',np.std(col2))

###part 3
print('no of data points:', len(col1))

##part4
print('min of % growth of Weight Watchers Stock: ',np.min(col1))
print('min of Daily # of Walmart Toy Units Sold: ',np.min(col2))
print('max of % growth of Weight Watchers Stock: ',np.max(col1))
print('max of Daily # of Walmart Toy Units Sold: ',np.max(col2))
print('range of % growth of Weight Watchers Stock: ',[np.min(col1),np.max(col1)])
print('range of Daily # of Walmart Toy Units Sold: ',[np.min(col2),np.max(col2)])

plt.scatter(col1,col2)
plt.xlabel(' % growth of Weight Watchers Stock')
plt.ylabel('Daily # of Walmart Toy Units Sold')
plt.grid()
plt.show()

mean of Daily # of Walmart Toy Units Sold: 3.888888888888889 median of % growth of Weight Watchers Stock: 0.605 median of Dai

Add a comment
Know the answer?
Add Answer to:
use numpy % growth of Weight Watchers Stock Daily # of Walmart Toy Units Sold 1.937...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT