wizzseen commited on
Commit
3f94b22
·
1 Parent(s): 2a3fc46

Create main.py

Browse files
Files changed (1) hide show
  1. main.py +28 -0
main.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ from sklearn.model_selection import train_test_split
3
+ from sklearn.linear_model import LinearRegression
4
+ import numpy as np
5
+ import subprocess
6
+ subprocess.call(["pip", "install", "scikit-learn"])
7
+
8
+ df=pd.read_csv('GOOG.csv')
9
+ p=df.drop('Close',axis=1)
10
+ q=p.drop('Date',axis=1)
11
+ gw=q.drop('High',axis=1)
12
+ g=q.drop('Adj Close',axis=1)
13
+ x=g
14
+
15
+ x_train,x_test,y_train,y_test = train_test_split(x,y,test_size=0.2,random_state=100)
16
+
17
+ lr=LinearRegression()
18
+ lr.fit(x_train,y_train)
19
+ y_lr_train_pred=lr.predict(x_train)
20
+ y_lr_test_pred=lr.predict(x_test)
21
+ a = np.array(list(map(float,input().split(","))))
22
+
23
+
24
+ a_reshaped = a.reshape(1, -1)
25
+
26
+ prediction = lr.predict(a_reshaped)
27
+
28
+ print(prediction)