halme commited on
Commit
55f3879
·
verified ·
1 Parent(s): 5524dda

Update DataLoader.py

Browse files
Files changed (1) hide show
  1. DataLoader.py +1 -2
DataLoader.py CHANGED
@@ -1,7 +1,6 @@
1
  #Class to fetch news and stock data from the web for a specific ticker and combine them into a dataframe.
2
 
3
  import pandas as pd
4
- import numpy as np
5
  import yfinance as yf
6
  from pygooglenews import GoogleNews
7
  from transformers import AutoTokenizer, AutoModelForSequenceClassification
@@ -104,6 +103,6 @@ class DataLoader:
104
  #We want to start from the oldest date and work our way to the newest date
105
  for i in range(1, len(combined_data)):
106
  for column in news_columns:
107
- if combined_data[column][i] == 0:
108
  combined_data[column][i] = combined_data[column][i-1] * decay_rate
109
  return combined_data
 
1
  #Class to fetch news and stock data from the web for a specific ticker and combine them into a dataframe.
2
 
3
  import pandas as pd
 
4
  import yfinance as yf
5
  from pygooglenews import GoogleNews
6
  from transformers import AutoTokenizer, AutoModelForSequenceClassification
 
103
  #We want to start from the oldest date and work our way to the newest date
104
  for i in range(1, len(combined_data)):
105
  for column in news_columns:
106
+ if combined_data[column][i] == 0 and combined_data[column][i-1] != 0:
107
  combined_data[column][i] = combined_data[column][i-1] * decay_rate
108
  return combined_data