I have the following dataframe:
url='https://raw.githubusercontent.com/108michael/ms_thesis/master/crsp.dime.mpl.df.1'
df=pd.read_csv(url, index_col=0)
df=df.pivot_table(index='date',columns='cid', fill_value=0,aggfunc=np.mean)
df=df.T.to_panel()
df=df.transpose(2,0,1)
df
<class 'pandas.core.panel.Panel'>
Dimensions: 505 (items) x 10 (major_axis) x 19 (minor_axis)
Items axis: N00000010 to N00035686
Major_axis axis: 2005 to 2014
Minor_axis axis: candcfscore.dyn_static to dir_ind_expendituresfor
I need to run a panel regression on it. To do that I am using the following code:
reg = PanelOLS(y=df['billsum_support'],x=df[['years_exp', 'unemployment', 'dir_ind_expendituresfor']],time_effects=True)
reg
Which is giving me the following error: KeyError: 'billsum_support'
My understanding is that Items axis
represents different data frames. Within each data frame I have different endogenous
and exogenous
variables that I intend to implement for different regression outcomes.
I have looked and am continuing to look at some of the posts regarding Panel Fixed Effects in Pandas. It seems to be deprecated; does anyone has a clue on how to implement a simple Panel OLS in Pandas/Python?