danfojs
danfojs copied to clipboard
df.append method
I found some bugs whilst using .append
which I'll try to summarize using shortcode snippets.
In addition, some things I found a little unintuitive with the API which could perhaps be improved. I'm running the latest version 1.1.1
The first append fails for empty dataframe
df = new DataFrame([], {columns: ["x"]})
df.append([[1]], [0])
However this works
df = new DataFrame([{x: 1}])
df.append([[1]], [1])
Rather oddly the same code fails when using inplace
df = new DataFrame([{x: 1}])
df.append([[1]], [1], {inplace: true})
I'm not sure if you'd consider these bugs but personally, I found it quite unintuitive
df = new DataFrame([{x: 1}])
# this append fails
df.append([{x: 2}], [1])
# however creating a dataframe first works
df.append(new DataFrame([{x: 2}]), [1])
I guess I was expecting that anything that is valid to construct a dataframe from would also work with append. Lastly, I found it odd that I had to pass an index for append in the first place, as append
already implies the last place.
Thanks for your help and work so far, it's great to have a good DataFrame library in JS!
I found some bugs whilst using
.append
which I'll try to summarize using shortcode snippets. In addition, some things I found a little unintuitive with the API which could perhaps be improved. I'm running the latest version1.1.1
The first append fails for empty dataframe
df = new DataFrame([], {columns: ["x"]}) df.append([[1]], [0])
However this works
df = new DataFrame([{x: 1}]) df.append([[1]], [1])
Rather oddly the same code fails when using inplace
df = new DataFrame([{x: 1}]) df.append([[1]], [1], {inplace: true})
I'm not sure if you'd consider these bugs but personally, I found it quite unintuitive
df = new DataFrame([{x: 1}]) # this append fails df.append([{x: 2}], [1]) # however creating a dataframe first works df.append(new DataFrame([{x: 2}]), [1])
I guess I was expecting that anything that is valid to construct a dataframe from would also work with append. Lastly, I found it odd that I had to pass an index for append in the first place, as
append
already implies the last place.Thanks for your help and work so far, it's great to have a good DataFrame library in JS!
Thanks for these comments. I'm getting around tp fixing them now.
When is this getting resolved? These errors are really making me move away from Danfo
This bug its been around for some time is there any possible fix in the horizon? @risenW
+1