In [ ]:
import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
In [ ]:
df = pd.read_csv('ad_sales.csv')
df.head()
Out[ ]:
| ID | TV | Radio | Newspaper | Sales | |
|---|---|---|---|---|---|
| 0 | 1 | 230.1 | 37.8 | 69.2 | 22.1 |
| 1 | 2 | 44.5 | 39.3 | 45.1 | 10.4 |
| 2 | 3 | 17.2 | 45.9 | 69.3 | 9.3 |
| 3 | 4 | 151.5 | 41.3 | 58.5 | 18.5 |
| 4 | 5 | 180.8 | 12.8 | 58.4 | 12.9 |
In [ ]:
#1. Explore the distribution of sales in this dataset
In [ ]:
#sns.histplot(data= df, x= 'Sales', kde= True, color= '#d62828',
# binwidth= 5)
sns.histplot(data= df, x= 'Sales', kde= True)
plt.show()
In [ ]:
#2. What is the relationship between the amount of
#money spent on TV and the amount of money spent on Radio
In [ ]:
sns.scatterplot(data= df, x= 'TV', y= 'Radio')
plt.show()
There is no relationship.
In [ ]:
#3. What is the relationship between the amount
#of money spent on TV and the Sales?
In [ ]:
sns.scatterplot(data= df, x= 'TV', y= 'Sales')
plt.show()
theres a strong positive relationship
In [ ]:
#4. What is the relationship between the
# amount of money spent on Newspaper and the Sales?
In [ ]:
sns.scatterplot(data= df, x= 'Newspaper', y= 'Sales')
plt.show()
Theres a weak positive relationship
In [ ]:
#convert to HTML
In [ ]:
!jupyter nbconvert --to html Bana310_HW_01.ipynb
[NbConvertApp] Converting notebook Bana310_HW_01.ipynb to html [NbConvertApp] WARNING | Alternative text is missing on 4 image(s). [NbConvertApp] Writing 415999 bytes to Bana310_HW_01.html
In [ ]: