pharmpy.data.read module¶
- class pharmpy.data.read.NMTRANDataIO(filename_or_io, ignore_character='#')[source]¶
Bases:
_io.StringIO
An IO class that is a prefilter for pandas.read_table. Things that must be done before using pandas will be done here. Currently it takes care of filtering out ignored rows and handles special delimiter cases
- pharmpy.data.read.convert_fortran_number(number_string)[source]¶
This function will try to convert the number_string from the general fortran exponential format into an np.float64. It covers “1d1”, “1D1”, “a+b”, “a-b”, “+” and “-”. All other cases will return None to signal that the number_string is not of the special form.
Move somewhere else. Will be used in output parsing as well
- pharmpy.data.read.infer_column_type(colname)[source]¶
If possible infer the column type from the column name else use unknown
- pharmpy.data.read.read_csv(path_or_io, raw=False, parse_columns=())[source]¶
Read a csv with header into a PharmDataFrame
- pharmpy.data.read.read_nonmem_dataset(path_or_io, raw=False, ignore_character='#', colnames=(), coltypes=None, drop=None, null_value='0', parse_columns=(), ignore=None, accept=None)[source]¶
- Read a nonmem dataset from file
column types will be inferred from the column names
raw - minimal processing, data will be kept in string format. ignore_character colnames - List or tuple of names to give each column given in order. Names need to be unique drop - A list or tuple of booleans of which columns to drop null_value - Value to use for NULL, i.e. empty records or padding parse_columns - Only applicable when raw=True. A list of columns to parse. ignore/accept - List of ignore/accept expressions
The following postprocessing operations are done to a non-raw dataset 1. Convert ordinary floating point numbers to float64 2. Convert numbers of special fortran format to float64 3. Convert None, ‘.’, empty string to the NULL value 4. Convert Inf/NaN properly 5. Pad with null_token columns if $INPUT has more columns than the dataset 6. Strip away superfluous columns from the dataset