cymetric.tools - Tools

General cymetric tools.

cymetric.tools.add_missing_time_step(df, ref_time)

Add the missing time step to a Panda Data Frame.

Parameters:

df : Pandas Data Frame

ref_time : of the time step references (Coming from TimeStep metrics)

cymetric.tools.dbopen(fname)

Opens a Cyclus database.

cymetric.tools.ensure_dt_bytes(dt)

Ensures that a structured numpy dtype is given in a Python 2 & 3 compatible way.

cymetric.tools.format_nucs(nucs)

format the nuclide provided by the users into a standard format: ZZAASSSS.

Parameters:

nucs : of nuclides

cymetric.tools.merge(df, base_col, add_df, add_col)

Merge some additionnal columns fram an additionnal Pandas Data Frame onother one and then remove the second base column (keeping SimID information).

Parameters:

df: Pandas Data Frame

base_col: of the base columns names

add_df: Pandas Data Frame to add in the df one

add_col: columns to be added

cymetric.tools.merge_and_fillna_col(left, right, lcol, rcol, how='inner', on=None)

Merges two dataframes and fills the values of the left column with the values from the right column. A copy of left is returned.

Parameters:

left : pd.DataFrame

The left data frame

right : pd.DataFrame

The right data frame

lcol : str

The left column name

rcol : str

The right column name

how : str, optional

How to perform merge, same as in pd.merge()

on : list of str, optional

Which columns to merge on, same as in pd.merge()

cymetric.tools.raise_no_graphviz(msg, have_graphviz=False)

Raise an error when Graphviz cannot be found.

cymetric.tools.raise_no_pyne(msg, have_pyne=False)

Raise an error when PyNE cannot be found.

cymetric.tools.raw_to_series(df, idx, val)

Convert data frame to series with multi-index.

cymetric.tools.reduce(df, rdc_)

Filter the df Pandas Data Frame according to the rdc_ (list of item in the corresponding columns).

Parameters:

df: Pandas Data Frame

rdc_: list of pair of string and string list.