-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add range type #316
Comments
One solution for such a feature would be to add a |
I would not create an extra range type as I don't see immediate advantages of having it as an extra type, but would instead extend db.schemes['ordered_alphabet'] = audformat.Scheme('str', labels=['a', 'b', 'c'], ordered=True) If the labels are given as a misc table, the order of the index would then determine the order of the labels. |
I'm with @hagenw here and would not introduce a range type and propose we close the issue. |
What about the proposed ordering of the labels? It might be important to store information such as |
Ok, so that you can do something like this: db = audformat.testing.create_db(minimal=True)
db.schemes['scheme'] = audformat.Scheme(labels=[2, 1, 0])
db['table'] = audformat.Table(audformat.filewise_index(['f1', 'f2', 'f3']))
db['table']['column'] = audformat.Column(scheme_id='scheme')
db['table']['column'].set([0, 1, 2])
# force order
db['table'].df.column.dtype._ordered = True
y = db['table']['column'].get()
y.min()
Unfortunately, the ordering gets lost when you compare values directly: y[2] < y[0]
|
Mh, it's of cause a little bit unfortunate that >>> y[2] < y[0]
False is not working. Maybe users that work with this kind of data could provide some input if it would be beneficial for them if the labels are marked as ordered? /cc @monicagoma, @Pascal-H |
Feature
We can have a range type for the data, specified in string format, but also can be ordered.
For example, we don't want to be precise (or not allowed to, due to privacy) about the birth-year, and 10-year categories will do the job:
The text was updated successfully, but these errors were encountered: