radis.io.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.
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)[source]¶
Parse a file under HITRAN
par
format. Parsing is done in binary format withnumpy.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.- Returns
df – dataframe with lines.
- Return type
pandas 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 slowobject
dtype.- Parameters
df (pandas Dataframe) –
branch
must be a column name.- Returns
df
is is modified in place- Return type
None