danfojs icon indicating copy to clipboard operation
danfojs copied to clipboard

df.append method

Open onetonfoot opened this issue 2 years ago • 6 comments

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!

onetonfoot avatar May 20 '22 03:05 onetonfoot

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!

Thanks for these comments. I'm getting around tp fixing them now.

risenW avatar Sep 25 '22 11:09 risenW

When is this getting resolved? These errors are really making me move away from Danfo

velen-lqc avatar Sep 28 '23 10:09 velen-lqc

This bug its been around for some time is there any possible fix in the horizon? @risenW

germanamz avatar Nov 28 '23 04:11 germanamz

+1

priyankat99 avatar Jan 06 '24 01:01 priyankat99