text_plain_output_1.png image_output_1.png
from sklearn import linear_model

from sklearn.model_selection import train_test_split

import matplotlib.pyplot as plt

import numpy as np

import pandas as pd

import seaborn as sns

df = pd.read_csv('/kaggle/input/btcusd/data1.csv')
df['Datetime'] = [i for i in range(len(df['Datetime']))]
new_df = df[['Open', 'Volume']]

x = np.array(new_df['Open']).reshape(-1, 1)
y = np.array(new_df['Volume']).reshape(-1, 1)
X_train, X_test, y_train, y_test = train_test_split(x, y, test_size=0.25)
regr = linear_model.LinearRegression()
regr.fit(X_train, y_train)
print(f'Regr-Test: {regr.score(X_test, y_test)}')
y_pred = regr.predict(X_test)
plt.scatter(X_test, y_test, color='b')
plt.plot(X_test, y_pred, color='r')
plt.show()