Efficiently construct Pandas DataFrame from large list of tuples/rows

后端 未结 2 789
南笙
南笙 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:04
    pandas.DataFrame(initialload, columns=list_of_column_names)
    
    0 讨论(0)
  • 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')
    
    0 讨论(0)
提交回复
热议问题