Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

data sorting like in a table #332

Open
hschabel opened this issue Sep 5, 2024 · 1 comment
Open

data sorting like in a table #332

hschabel opened this issue Sep 5, 2024 · 1 comment

Comments

@hschabel
Copy link

hschabel commented Sep 5, 2024

Hi adamreeve,

I use the TDMS format due to its abilities to have properties which can be freely defined for each channel.

These properties are used for parametering of evaluation functions.

The data section itself is used like an EXCEL Table.

I need to find a solution to sort this like a table (in all channels exactly the same way).

In Diadem it's no problem at all, but in Python I found no solution. I have just found a function for one single channel:

RES = TdmsFile.read( DATEIPFAD_TDMS + ".TDMS" )
RES['group']['channel'].sort

Is there any option available?

Any help ist appreciated.

Regards
hschabel

@adamreeve
Copy link
Owner

adamreeve commented Sep 5, 2024

Hi @hschabel, I would recommend reading the channel data into a Pandas or Polars DataFrame if you want to treat it like a table. You could convert the file to a Pandas DataFrame with df = RES.as_dataframe() for example.

You can then sort with sorted = df.sort_values(by='column_to_sort_on') (see https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.sort_values.html)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants