Efficiently construct Pandas DataFrame from large list of tuples/rows

后端 未结 2 817
南笙
南笙 2020-12-31 03:37

I\'ve inherited a data file saved in the Stata .dta format. I can load it in with scikits.statsmodels genfromdta() function. This puts my data into

2条回答
  •  生来不讨喜
    2020-12-31 04:15

    Version 0.12 of pandas onwards should support loading Stata format directly (Reference).

    From the documentation:

    The top-level function read_stata will read a dta format file and return a DataFrame: The class StataReader will read the header of the given dta file at initialization. Its method data() will read the observations, converting them to a DataFrame which is returned:

     pd.read_stata('stata.dta')
    

提交回复
热议问题