Advertisement
sesquiipedalian

Untitled

Jul 29th, 2023
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.38 KB | None | 0 0
  1. import pandas as pd
  2.  
  3.  
  4. def predict(df):
  5.     last = df.columns[-1]
  6.     mp = df[last].mean()
  7.     return round(mp, 4)
  8.  
  9.  
  10. def main():
  11.     df = pd.read_csv("Equity.csv")
  12.     df['Date'] = pd.to_datetime(df['Date'])
  13.     df = df.sort_values('Date')
  14.  
  15.     prediction = predict(df)
  16.     print(f'Predicted "Adj Close" price = {prediction}')
  17.  
  18.  
  19. if __name__ == '__main__':
  20.     main()
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement