python - Cant save the dataframe to excel, atribute error -


i have 2 dataframes imported quandl, i'm having trouble saving results excel file. keep getting error

attributeerror: series object has no attribute to_excel

however, before did division of columns excel writing working fine, cant figure out whats wrong

if comment out part of code, .to_excel works fine

result['snp/gld'] = result['settle1'] / result['settle']  result = result['snp/gld'] 

...

from pandas import excelwriter  import pandas pd import quandl import unicodecsv import datetime dt  gld = quandl.get("chris/cme_gc1") snp = quandl.get("chris/cme_es1")  snp.rename(columns = {'open' : 'open1', 'high' : 'high1', 'low' : 'low1', 'last' : 'last1', 'change' : 'change1', 'settle' : 'settle1', 'volume' : 'volume1',        'open interest' : 'open interest1'}, inplace = true)   result = snp.join(gld, how = 'outer')  result['snp/gld'] = result['settle1'] / result['settle']  result = result['snp/gld']  result.to_csv('snpgldspread.csv')  writer = excelwriter('snpgldspread.xlsx') result.to_excel(writer) writer.save() 


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -