danfojs icon indicating copy to clipboard operation
danfojs copied to clipboard

TypeError: Cannot read properties of undefined (reading '0')

Open applegrew opened this issue 3 years ago • 1 comments

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:

  1. Go to https://codesandbox.io/s/sleepy-mcclintock-tksp5f?file=/src/index.js
  2. The sample code in that url will run automatically.
  3. Check browser console.
  4. 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.

Screenshot 2022-07-18 at 4 20 33 PM

applegrew avatar Jul 18 '22 10:07 applegrew

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(.......

JagdishKolhe avatar Sep 15 '22 13:09 JagdishKolhe