Closed jim-smith closed 7 months ago
This may be one solution: in-between output = table.to_string(justify="left") and as_strings = output.split("\n")
change the values in outputs to replace spaces with underscores ==> but we just want to focus on the column names.
something like this would strip out spaces from the ends of a common name
df.rename(columns=lambda x: x.strip(), inplace=True) print(df)
so can we adapt it to use x.replace(' ','_')
eg from stata: acro table year survivor