danfojs
danfojs copied to clipboard
TypeError: Cannot read properties of undefined (reading '0')
Describe the bug
I am getting JS error in danfo js for a specific scenario - TypeError: Cannot read properties of undefined (reading '0').
The stack trace is as below.
TypeError: Cannot read properties of undefined (reading '0')
at _iloc (https://tksp5f.csb.app/node_modules/danfojs/dist/danfojs-base/core/indexing.js:150:56)
at DataFrame.query (https://tksp5f.csb.app/node_modules/danfojs/dist/danfojs-base/core/frame.js:2295:43)
To Reproduce Steps to reproduce the behavior:
- Go to https://codesandbox.io/s/sleepy-mcclintock-tksp5f?file=/src/index.js
- The sample code in that url will run automatically.
- Check browser console.
- You will notice the above JS error.
Expected behavior There should be no JS error.
Additional context Using version 1.1.1 of Danfo JS.
I think danfojs has some tight integration of index values while querying. Please try to resent the index, it might solve the issue. let df1 = df.query(.... df1.resetIndex({ inplace: true }) df1.query(.......