Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Writing Data to CSV
#1
Hello,

I am trying to create data frame of Share prices based on data provided by vendor. I am getting an error message "'Series' object has no attribute 'close'" Can you please help me with this issue ?

import pandas as pd
from pandas import DataFrame
import quandl
import datetime as dt

stock_list = pd.read_csv(r"F:\Abhay_New\Abhay\Python\Project\SHARADAR_SF1.csv")
end_date = dt.date.today()
diff_year = dt.timedelta(days=365)
start_date = end_date - diff_year
path = (r"F:\Tradepoint\MyMkt")

for i in range(len(stock_list)):
    data = quandl.get_table('SHARADAR/SEP', date={'gte':start_date, 'lte':end_date}, ticker=stock_list.iloc[i])
    if len(data)>1:
        dict = {'Date':data['date'],'OPEN':data['open'],'HIGH':data['high'],'LOW':data['low'],'CLOSE':data['close'],'VOLUME':data['volume']}
        final_data = pd.DataFrame(dict,columns = ['Date','OPEN','HIGH','LOW','CLOSE','VOLUME'])
        final_data.to_csv(path + '\\' + stock_list.iloc[i] + '.csv', index = False, header = False)
        print(final_data).head()


AttributeError: 'Series' object has no attribute 'close'
Quote

Top Page

Messages In This Thread
Writing Data to CSV - by abhaydd - Aug-08-2019, 03:32 AM
RE: Writing Data to CSV - by Larz60+ - Aug-08-2019, 08:33 PM
RE: Writing Data to CSV - by DeaD_EyE - Aug-09-2019, 01:08 AM

Possibly Related Threads...
Thread Author Replies Views Last Post
  python openpyxl writing data Bikram 2 211 Oct-17-2019, 03:33 PM
Last Post: Bikram
  Who converts data when writing to a database with an encoding different from utf8? AlekseyPython 1 392 Mar-04-2019, 08:26 AM
Last Post: DeaD_EyE
  Help with Code (Writing Data File) caroline_d_124 3 486 Jan-06-2019, 09:17 PM
Last Post: caroline_d_124
  Recommend an Excel library for writing data? jonesin1974 1 846 Feb-09-2018, 10:28 PM
Last Post: Gribouillis
  Writing data from a DHT11 to LCD expplane 2 1,171 Aug-07-2017, 03:38 PM
Last Post: expplane

Forum Jump:


Users browsing this thread: 1 Guest(s)