lib5c.parsers.util module

Module containing utility functions for file parsing.

lib5c.parsers.util.null_value(dtype)[source]

Utility method to get the appropriate null value given a numpy dtype.

Pandas has some logic for this, see http://pandas.pydata.org/pandas-docs/stable/missing_data.html

Parameters:dtype (np.dtype) – The dtype to return a null value for.
Returns:The default null value for this dtype.
Return type:Any
lib5c.parsers.util.parse_field(val)[source]

Utility function for parsing a value that could be an int, a float, or a string.

Parameters:val (str) – The value to parse.
Returns:The parsed value.
Return type:Union[int, float, str]