-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpreprocessing.py
45 lines (35 loc) · 1 KB
/
preprocessing.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import pandas as pd
import matplotlib.pyplot as plt
import chart_studio.plotly as py
import plotly.graph_objects as go
import seaborn as sns
import numpy as np
import random
import plotly
import plotly.express as px
import json
#datetime
from datetime import datetime
"""def getdataset():
df50=pd.read_csv("NIFTY 50.csv")
df50.head()
df50.fillna(method="ffill", inplace=True)
df50['year'] = pd.DatetimeIndex(df50['Date']).year
df50['Date']=df50['Date'].apply(lambda x:datetime.strptime(x,'%Y-%m-%d'))
df50['TrendValue'] = 0
for i in range(1, len(df50['High'])):
df50['TrendValue'][i] = df50['High'][i]-df50['High'][i-1]
df50['Trend'] = 0
i=0
for val in df50['TrendValue']:
if val>0:
df50['Trend'][i] = 'Uptrend'
elif val==0:
df50['Trend'][i] = 'No change'
else:
df50['Trend'][i] = 'Downtrend'
i = i+1
return df50
df50 = getdataset()"""
def getdataset():
return pd.read_csv('NIFTY 50.csv')