'cannot do two-way cluster standarded error in python

cluster_2ways_ols = sm.ols(formula='y ~ x', data=df).fit(cov_type='cluster', cov_kwds={'groups': np.array(df[['firmid', 'year']])}, use_t=True)

I try to use 'groups': np.array(df[['firmid', 'year']]), the error said : Cannot change data-type for object array.

I don't know what happen. But if I only use one series such as df['year'], it works.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source