Code:
version 16.0 python: stata: sysuse auto, clear from sfi import Data import pandas as pd # Load dataset from Stata to Python df_data = pd.DataFrame(Data.get()) # Read column names from Stata and assign to dataframe columns df_data.columns = [ Data.getVarName(column_index) for column_index in range(len(df_data.columns)) ] print(df_data.columns) end
0 Response to Getting column names when using Python in Stata
Post a Comment