super_auto_comb.track_changes ============================= .. py:module:: super_auto_comb.track_changes .. autoapi-nested-parse:: This sub-package works with Pandas Dataframes whose first column is 'datetime'. They are interpreted as setup description (frequency, counter channels, etc..) from the given datetime to the datetime on the next row. These dataframes can me manipulated (loaded, merged, reduced, etc...) to keep track of only a subset of columns. For loading inputs, all changes are tracked (e.g., I need to know when a counter channel is changed). Outputs are instead customizable (e.g., I may or may not want to separate data based on which comb is used). A colum 'name' can be added to describe each row based on some columns. A column 'datetime_end' is always added to be equal to the datetime in the next row. Functions --------- .. autoapisummary:: super_auto_comb.track_changes.df_merge super_auto_comb.track_changes.df_fix_end super_auto_comb.track_changes.df_reduce super_auto_comb.track_changes.df_extract super_auto_comb.track_changes.df_add_name super_auto_comb.track_changes.df_load super_auto_comb.track_changes.df_limit super_auto_comb.track_changes.load_do_setup super_auto_comb.track_changes.df_from_cirt super_auto_comb.track_changes.format_possibly_changing_info Module Contents --------------- .. py:function:: df_merge(df1, df2) Merge two Dataframes tracking changes from both. .. py:function:: df_fix_end(df) Update or create the datetime_end column of the Dataframe to be the datetime of the following line (or np.inf) .. py:function:: df_reduce(df, subset) Return a new df with changes only tracked in the subset columns. .. py:function:: df_extract(df, cols) Extract columns from a DataFrame OR Series ignoring columns that do not exists .. py:function:: df_add_name(df, fix, var=[]) Add a name column to the Dataframe based on certain columns. Columns in fix will always be recorded in the name. Columns in var will be recorded only if some change is observed. .. py:function:: df_load(file) Load a Dataframe from a file. The first column in the file should be a ISO datetime. .. py:function:: df_limit(df, start, stop) mask the Dataframe from start to stop. .. py:function:: load_do_setup(do, dir) Load DO and Comb setups. Use Pandas for some magic in keeping track of changes. :param do: DO name :type do: str :param dir: working directory, by default '' :type dir: str, optional :returns: Pandas dataframe with DO and Combs tracked changes. :rtype: df .. note:: Load DO setups, combining it with comb setups (e.g., so if a DO has been measured with both comb1 and comb2, data is populated automatically). .. py:function:: df_from_cirt(start, stop) Return a Dataframe tracking changes in Circular T number. .. py:function:: format_possibly_changing_info(df, key) Return a single string from values in a Dataframe column that may be one or more.