Vaex copy columns between dataframes

289 Views Asked by At

I have a dataframe that I performed a filter on and then added some virtual columns. I wish to add those columns back in with the original data frame. Here is my code.

original_df = ...
df = original_df.filter(f"my_col_{id}")
df["new_col"] = df["my_col_1"] > 10
df.drop_filter(inplace=True)
original_df.join(df, how = 'left', lsuffix = '_left', rsuffix = '_right', inplace=True)

I get the error ValueError: invalid literal for int() with base 10: '1_left'. Why am I getting this error and is it even the correct approach? Essentially I wish to filter a dataframe, pass it to a function for processing, then merge the data with the original, then in a parent function write to files.

1

There are 1 best solutions below

0
On

You do not specify on which column to do the joining.

Vaex can indeed join simply on row (if a join column is not specified), but in that case it is assumed that the two dataframes have equal number of rows.