def rprof(rproffile, colnames):
if not rproffile.is_file():<EOL><INDENT>return None, None<EOL><DEDENT>data = pd.read_csv(rproffile, delim_whitespace=True, dtype=str,<EOL>header=None, comment='<STR_LIT:*>', skiprows=<NUM_LIT:1>,<EOL>engine='<STR_LIT:c>', memory_map=True,<EOL>error_bad_lines=False, warn_bad_lines=False)<EOL>data = data.apply(pd.to_numeric, raw=True, errors='<STR_LIT>')<EOL>isteps, rows_to_del = _extract_rsnap_isteps(rproffile)<EOL>if rows_to_del:<EOL><INDENT>rows_to_keep = set(range(len(data))) - rows_to_del<EOL>data = data.take(list(rows_to_keep), convert=False)<EOL><DEDENT>id_arr = [[], []]<EOL>for istep, _, n_z in isteps:<EOL><INDENT>id_arr[<NUM_LIT:0>].extend(repeat(istep, n_z))<EOL>id_arr[<NUM_LIT:1>].extend(range(n_z))<EOL><DEDENT>data.index = id_arr<EOL>ncols = data.shape[<NUM_LIT:1>]<EOL>_tidy_names(colnames, ncols)<EOL>data.columns = colnames<EOL>df_times = pd.DataFrame(list(map(itemgetter(<NUM_LIT:1>), isteps)),<EOL>index=map(itemgetter(<NUM_LIT:0>), isteps))<EOL>return data, df_times<EOL>
Extract radial profiles data

    If :data:`colnames` is too long, it will be truncated. If it is too short,
    additional numeric column names from 0 to N-1 will be attributed to the N
    extra columns present in :data:`timefile`.

    Args:
        rproffile (:class:`pathlib.Path`): path of the rprof.dat file.
        colnames (list of names): names of the variables expected in
            :data:`rproffile` (may be modified).

    Returns:
        tuple of :class:`pandas.DataFrame`: (profs, times)
            :data:`profs` are the radial profiles, with the variables in
            columns and rows double-indexed with the time step and the radial
            index of numerical cells.

            :data:`times` is the dimensionless time indexed by time steps.