radis.api.tools module

Created on Fri Jul 6 13:52:04 2018.

@author: erwan

drop_object_format_columns(df, verbose=True)[source]

Remove ‘object’ columns in a pandas DataFrame. If Vaex Dataframe, there is by construction no object in the Dataframe

They are not useful to us at this time, and they slow down all operations (as they are converted to ‘object’ in pandas DataFrame). If you want to keep them, better convert them to some numeric values

parse_hitran_file(fname, columns, count=-1, output='pandas')[source]

Parse a file under HITRAN par format. Parsing is done in binary format with numpy.fromfile() so it’s as fast as possible.

Parameters:
  • fname (str) – filename.

  • columns (dict) – list of columns and their format.

Other Parameters:
  • count (int) – number of lines to read. If -1 reads all file.

  • output (str) – specifies the output type

Returns:

df – dataframe with lines.

Return type:

pandas DataFrame or Vaex Dataframe

See also

Used

replace_PQR_with_m101(df)[source]

Return P, Q, R in column branch with -1, 0, 1 to get a fully numeric database. This improves performances quite a lot, as Pandas doesnt have a fixed-string dtype hence would use the slow object dtype.

Parameters:

df (pandas Dataframe or Vaex Dataframe) – branch must be a column name.

Returns:

df is is modified in place

Return type:

None