XptReadOptions(encoding=Encoding.UTF_8, column_names=ColumnNames.CLEANED)
Source¶
Settings of a SAS transport (XPT) file (.xpt) read by Table.from_xpt.
These files are read only.
The example reads paxraw_d_short.xpt, a SAS transport file of 100 rows.
Added in version 0.1.0
Parameters:
-
encoding(Encoding, default:Encoding.UTF_8)The text encoding of the texts stored in the file, UTF-8 by default.
-
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 numdaplot as ndp
latin_1 = ndp.XptReadOptions(encoding=ndp.Encoding.LATIN_1)
activity = ndp.Table.from_xpt("paxraw_d_short.xpt", latin_1)
activity.row_count
# 100
activity.column_names
# ['SEQN', 'PAXSTAT', 'PAXCAL', 'PAXDAY', 'PAXN', 'PAXHOUR', 'PAXMINUT', 'PAXINTEN', 'PAXSTEP']