Given this Dask DataFrame :
Dask DataFrame Structure:
             date  value           symbol
npartitions=2                                
           object  int64  category[known]
...              ...
...              ...
Dask Name: from-delayed, 6 tasks2130
How can I set_index on 'symbol' column (which is category[known)?
df = df.set_index('symbol')
Traceback (most recent call last):
[...]
TypeError: Categorical is not ordered for operation max
you can use .as_ordered() to change the Categorical to an ordered one
                Categorical objects must be defined ordered before they can be indexed. The error message tells us to use the as_ordered(). This method comes from the cat structure:
df['symbol'] = df['symbol'].cat.as_ordered()
df = df.set_index('symbol')
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With