diff --git a/nominal/_tdms.py b/nominal/_tdms.py index f2b62a0..d3c3cdb 100644 --- a/nominal/_tdms.py +++ b/nominal/_tdms.py @@ -14,10 +14,10 @@ def tdms_with_time_column_to_pandas(path: Path, timestamp_column: str) -> pd.DataFrame: group_dfs: list[pd.DataFrame] = [] - channels_to_export: dict[str, pd.Series[Any]] = {} with TdmsFile.open(path) as tdms_file: for group, time_channel in _get_groups_with_time_channel(tdms_file.groups(), timestamp_column): + channels_to_export: dict[str, pd.Series[Any]] = {} for channel in _get_export_channels(group.channels(), time_channel, timestamp_column): channel_name = _create_channel_name(group, channel) channels_to_export[channel_name] = pd.Series(data=channel.read_data(), index=time_channel.read_data()) @@ -27,7 +27,10 @@ def tdms_with_time_column_to_pandas(path: Path, timestamp_column: str) -> pd.Dat # format for nominal upload df = functools.reduce( - lambda left, right: pd.merge(left, right, left_index=True, right_index=True, how="outer"), group_dfs + lambda left, right: pd.merge( + left, right, left_index=True, right_index=True, how="outer", suffixes=["_repeated_1", "_repeated_2"] + ), + group_dfs, ) df.index = df.index.set_names(timestamp_column, level=None) df = df.reset_index()