text_plain_output_1.png
import matplotlib.pyplot as plt

import pandas as pd

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import seaborn as sns

asus = pd.DataFrame(pd.read_csv('/kaggle/input/advertising-sales-dataset/Advertising Budget and Sales.csv'))

asus.shape

asus.drop(columns=['Unnamed: 0'])

b = asus['Newspaper Ad Budget ($)'].quantile(0.98)
asus_new = asus[asus['Newspaper Ad Budget ($)'] < b]

asus_new.isnull().sum() * 100 / asus_new.shape[0]

asus_new.duplicated().sum()

asus_new.drop(columns=['Unnamed: 0'])

x = asus_new['TV Ad Budget ($)']
y = asus_new['Sales ($)']

from sklearn.model_selection import train_test_split
x_train = x[:137]
x_test = x[137:]
y_train = y[:137]
y_test = y[137:]

print('x_train Shape: ', x_train.shape)
print('x_test Shape: ', x_test.shape)
print('y_train Shape: ', y_train.shape)
print('y_test Shape: ', y_test.shape)