Closed schwabts closed 2 years ago
Thanks @schwabts for the question, sorry I did not answer earlier.
The answer found at https://stackoverflow.com/questions/4964388/is-there-a-way-to-disable-initial-sorting-for-jquery-datatables seems to apply here as well. You just need to pass order = []
to the datatables library.
One way to do this is by using show
from itables import show
show(df, order=[])
and the other way is to use a global option:
import itables.options as opt
opt.order = []
See the screenshot below:
Loading matrix data into a dataframe it automatically gets sorted when using itables. Of course, I'd use
numpy
when really working with matrices but I have already come across some (unsorted?) tables that were sorted by exotic orders for good reasons. (After all, every table is sorted even if the order is not obvious.)It must be possible to turn the feature off.
Code:
Result:
0 | 1 | 2 | 3 -- | -- | -- | -- 0.2 | 0.1 | 0.9 | 2.1 0.9 | 2.3 | 3.4 | 0.8 2.1 | 4.3 | 0.8 | 1.0 5.1 | 1.2 | 2.3 | 4.3 **Expected:** 0 | 1 | 2 | 3 -- | -- | -- | -- 0.9 | 2.3 | 3.4 | 0.8 5.1 | 1.2 | 2.3 | 4.3 2.1 | 4.3 | 0.8 | 1.0 0.2 | 0.1 | 0.9 | 2.1