Hello,
i would like to know if there is any documentation about importing data from python. I am using the code below. My issue is that when I use xget, the data is imported but the dates are not algined with the dates in my EViews workfile. Is there any way to import the data back where EViews can parse the dates/data and do the alignment?
xopen(p)
xrun "import pandas as pd"
xrun "import pyodbc"
xrun "conn = pyodbc.connect(connection string)"
sql_query="insert sql query here"
xrun df=df1 = pd.read_sql(sql_query,conn)
xrun df.set_index("series_value_date", inplace=True)
xget(name=series1,ptype=dataframe) df
xget pandas series/dataframe
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13317
- Joined: Tue Sep 16, 2008 5:38 pm
Re: xget pandas series/dataframe
All imports done via XGET are just a straight row-by-row insertion. There is no date matching done. Your best bet is to do the xget on a separate page, and then try to line up the dates with a copy.
Follow us on Twitter @IHSEViews
Re: xget pandas series/dataframe
ok thanks for the info. If i have 2 series, series_values and series_dates (dates can be an alpha series or a regular series), do you know of a simple way to make an eviews series out of them?
i was thinking along the lines of:
series new_series
for !i=1 to @ilast(series_dates)
new_series(!i)=series_values(!i)
next
But i am not sure how to set the dates. Maybe i can use the date series to set the range of the workfile?
i was thinking along the lines of:
series new_series
for !i=1 to @ilast(series_dates)
new_series(!i)=series_values(!i)
next
But i am not sure how to set the dates. Maybe i can use the date series to set the range of the workfile?
Re: xget pandas series/dataframe
this worked: pagestruct @date(series_date)
Thanks for the guidance
Thanks for the guidance
Who is online
Users browsing this forum: No registered users and 27 guests