Given two DataFrames
np.random.seed(0)
df1 = pd.DataFrame(np.random.choice(10, (5, 4)), columns=list(\'ABCD\'))
df2 = pd.DataFrame(np.random.choice(10, (5,
Great tutorial already, but bear in mind that before jumping wildly into the usage of eval/query
attracted by its simpler syntax, it has severe performance issues if your dataset has less than 15,000 rows.
In that case, simply use df.loc[mask1, mask2]
.
Refer: https://pandas.pydata.org/pandas-docs/version/0.22/enhancingperf.html#enhancingperf-eval