flasc.data_processing.dataframe_manipulations.df_sort_and_fix_duplicates

flasc.data_processing.dataframe_manipulations.df_sort_and_fix_duplicates#

flasc.data_processing.dataframe_manipulations.df_sort_and_fix_duplicates(df: DataFrame | FlascDataFrame) DataFrame | FlascDataFrame[source]#

Sort dataframe and fill duplicates.

This function sorts the dataframe and addresses duplicate rows (i.e., rows in which the time index is equal). It does this by merging the two rows, replacing the 'nan' entries of one row with the non-'nan' entries of the other row. If someone both rows have different values for the same column, then an exception is thrown.

Parameters:

df (pd.Dataframe | FlascDataFrame) -- An (unsorted) dataframe

Returns:

A time-sorted Dataframe in which its duplicate rows have been merged.

Return type:

df (pd.Dataframe | FlascDataFrame)