javascriptdata / danfojs

Danfo.js is an open source, JavaScript library providing high performance, intuitive, and easy to use data structures for manipulating and processing structured data.
https://danfo.jsdata.org/
MIT License
4.81k stars 209 forks source link

Using instanceof Series or DataFrame to check the difference between the two does not work #346

Closed Devwulf closed 2 years ago

Devwulf commented 2 years ago

After upgrading to version 1.0.0, the type checks I have using instanceof Series or instanceof DataFrame does not seem to work anymore. This is especially useful not only for comparing the two against each other, but also against other types. Is there a better way of checking the difference between the two, besides using .$isSeries or counting columns? The former seems like an internal variable that shouldn't even be available outside, while the latter seems less clear about conveying the same meaning as instanceof Series or instanceof DataFrame.

Devwulf commented 2 years ago

I think I may have found the proper solution for it. Instead of importing both Series and DataFrame from danfojs, Series should instead be imported from danfojs/dist/danfojs-base/core/series while DataFrame should be imported from danfojs/dist/danfojs-base/core/frame. The first one seems to point to the browser typings, while the second ones point to the base typings instead.

I'll do some more testing just in case there are some other problems, and then close this issue if I don't find any.