Cudf: [QST] Appending Dataframe Rows

Created on 11 Nov 2019  路  3Comments  路  Source: rapidsai/cudf

I'm using cuDF v0.10.0 and trying to append two dataframes (adding rows, not joining columns.) In pandas, I might do something like this:

df1 = df = pd.DataFrame({"a":[1, 2, 3, 4], "b":[5, 6, 7, 8]})
df2 = pd.DataFrame({"a":[1, 2, 3], "b":[5, 6, 7]})
df.append(df2, ignore_index = True)

I'm trying to find similar functionality with cuDF. I looked on the docs and the "concat" function seems to offer this:
https://rapidsai.github.io/projects/cudf/en/0.10.0/api.html#cudf.core.reshape.concat

However, I cannot find the concat function. Is there a sample invocation to demonstrate this?

? - Needs Triage question

Most helpful comment

Please feel free to file a feature request for .append, or comment on an append issue if one exists. This would be a valuable addition.

We expose concat as a module-level function like pandas.

import pandas as pd

df = pd.DataFrame({"a":[1, 2, 3, 4], "b":[5, 6, 7, 8]})
df2 = pd.DataFrame({"a":[1, 2, 3], "b":[5, 6, 7]})
pd.concat([df, df2], ignore_index = True)
import cudf

df = cudf.DataFrame({"a":[1, 2, 3, 4], "b":[5, 6, 7, 8]})
df2 = cudf.DataFrame({"a":[1, 2, 3], "b":[5, 6, 7]})
cudf.concat([df, df2], ignore_index = True)
聽 | a | b
-- | -- | --
1 | 5
2 | 6
3 | 7
4 | 8
1 | 5
2 | 6
3 | 7

You both may also be interested in 10 Minutes to cuDF from our API docs page, which covers some useful functionality like this.

All 3 comments

I am also struggling to use concat on rapids data frames.

Please feel free to file a feature request for .append, or comment on an append issue if one exists. This would be a valuable addition.

We expose concat as a module-level function like pandas.

import pandas as pd

df = pd.DataFrame({"a":[1, 2, 3, 4], "b":[5, 6, 7, 8]})
df2 = pd.DataFrame({"a":[1, 2, 3], "b":[5, 6, 7]})
pd.concat([df, df2], ignore_index = True)
import cudf

df = cudf.DataFrame({"a":[1, 2, 3, 4], "b":[5, 6, 7, 8]})
df2 = cudf.DataFrame({"a":[1, 2, 3], "b":[5, 6, 7]})
cudf.concat([df, df2], ignore_index = True)
聽 | a | b
-- | -- | --
1 | 5
2 | 6
3 | 7
4 | 8
1 | 5
2 | 6
3 | 7

You both may also be interested in 10 Minutes to cuDF from our API docs page, which covers some useful functionality like this.

Closing this issue as resolved.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

randerzander picture randerzander  路  3Comments

MurrayData picture MurrayData  路  3Comments

stevencarlislewalker picture stevencarlislewalker  路  3Comments

jangorecki picture jangorecki  路  4Comments

Polarbeargo picture Polarbeargo  路  3Comments