Closed KingWebsites closed 2 years ago
Thanks for raising this issue, I’ll take a look ASAP.
@KingWebsites @michael-pont Can you install and use the latest Typescript version (v1.0.0). This has been fixed.
If you need help migrating to the latest version, see: https://danfo.jsdata.org/examples/migrating-to-the-stable-version-of-danfo.js
I believe the nunique function for a dataFrame is broken.
Steps to reproduce the behavior: If I add an extra item to each column of the test data then the nunique function creates an error.
Here's the new code adapted from the API Reference (browser) with an extra item added to each column:
Expected result: I expect to see a new single-column dataframe with rows containing the total number of unique items for that row.
But I get an error of: "IndexError: You provided an index of length 5 but Ndframe rows has lenght of 4"
I believe somewhere the count of rows and columns is getting swapped by mistake. If the dataset is turned back into a 4x4 grid it works. It just doesn't like this new 4x5 one. The test data is 4x4 so the error is never seen during test.
Suggested fix: Apologies for not having the skills to fix this myself but I think the fix is to change this conditional from 0 to 1 in both these files: danfojs/danfojs-browser/src/core/frame.js ln. 2019 danfojs/danfojs-node/src/core/frame.js ln. 2021
Change if (axis === 0) { to if (axis === 1) {
My rough fix by downloading the bundle.js and editing that conditional has fixed the issue for me.