StataReadOptions(column_names=ColumnNames.CLEANED)
Source¶
Settings of a Stata file (.dta) read by Table.from_stata.
Added in version 0.1.0
Parameters:
-
column_names(ColumnNames, default:ColumnNames.CLEANED)Whether the column names are cleaned,
ColumnNames.CLEANEDby default: the spaces, tabs and line breaks at the start and the end of each name are removed.ColumnNames.KEPTkeeps the names as written.
Raises:
-
InvalidTypeErrorWhen a setting is not of the type its annotation names.
Examples:
import tempfile
from pathlib import Path
import numdaplot as ndp
path = Path(tempfile.mkdtemp()) / "sales.dta"
ndp.Table.from_arrays({"price": ndp.Array.from_list([1.5])}).to_stata(path)
options = ndp.StataReadOptions(column_names=ndp.ColumnNames.KEPT)
ndp.Table.from_stata(path, options).column_names
# ['price']