Python Forum
Python write result of VAR to excel file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python write result of VAR to excel file
#5
(Jul-13-2019, 07:33 AM)perfringo Wrote: Maybe I don't comprehend the whole picture but there is input-output library of statsmodel - iolib

Quote:Users can also leverage the powerful input/output functions provided by pandas.io. Among other things, pandas (a statsmodels dependency) allows reading and writing to Excel, CSV, and HDF5 (PyTables).

Hi Mr,
first i would like to thank you for you help.
i checked the link that you had sent, and i make some modifications on my code so as it becomes as follow:

import pandas as pd
from statsmodels.tsa.base.datetools import dates_from_str
import numpy as np
from statsmodels.tsa.api import VAR, DynamicVAR
import matplotlib.pyplot as plt
import statsmodels.api as sm
from statsmodels.iolib.table import SimpleTable

data_NO_nan_neg=dta[ ['TMIN','TMAX','UMIN', 'UMAX','DD','FF' ,'RR' , 'TD','PS', 'PM'] ]
model =sm.tsa.VAR(data_NO_nan_neg)
results = model.fit(maxlags=7, method='ols', ic='aic', trend='c', verbose=False)
res2=results.summary()
results_as_csv=res2.tables[0].as_csv()
i re-run the model and i am getting the following error:
Error:
results_as_csv=res2.tables[0].as_csv() AttributeError: 'VARSummary' object has no attribute 'tables'
can you please help me to overpass this error.
Thank you a lot Mr.
Reply


Messages In This Thread
RE: Python write result of VAR to excel file - by wissam1974 - Jul-13-2019, 08:11 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Write from dictionary to excel divon 3 3,924 Jun-11-2023, 10:37 AM
Last Post: Larz60+
  Data Sorting and filtering(From an Excel File) PY_ALM 0 1,070 Jan-09-2023, 08:14 PM
Last Post: PY_ALM
  Split excel file and write output at specific row and set sheet position DSCA 0 2,023 May-12-2022, 07:29 PM
Last Post: DSCA
  [Pandas] Write data to Excel with dot decimals manonB 1 5,943 May-05-2021, 05:28 PM
Last Post: ibreeden
  Python - Merge existing cells of Excel file created with xlsxwriter manonB 0 3,762 Mar-10-2021, 02:17 PM
Last Post: manonB
  Creating more than one excel File at once malvarez1976 0 1,833 Dec-15-2020, 02:04 AM
Last Post: malvarez1976
  Convert Excel to .txt - Need each excel row to be separate .txt file cowboykevin05 2 4,838 Jan-03-2020, 06:29 PM
Last Post: Larz60+
  [split] Converting excel file to txt file unexceptionalhobby 2 4,393 Oct-16-2019, 06:34 PM
Last Post: unexceptionalhobby
  Read exel with merged cells and write to another excel SriMekala 0 3,016 Aug-10-2019, 07:14 AM
Last Post: SriMekala
  how read and write merged cells in excel SriMekala 1 15,200 Aug-07-2019, 11:27 PM
Last Post: scidam

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020