'Vaex copy columns between dataframes
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.
Solution 1:[1]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Joco |
