I am learning how to use the -sfi.Data- class when using Python in Stata. When I import the dataset from Stata to Python, the columns get numbered index, instead of keeping their variable names. I guess this is because [-sfi.Data.getVar()- returns a list. I propose one solution below, but does anyone know of an easier/built-in method?

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