3 ms·
I see your pandas (even the arrow based pandas 2.0) and raise you polars. ;)
by gigatexal 4y ago
I see your pandas (even the arrow based pandas 2.0) and raise you polars. ;)
- brahbrah 4y agoI see your: ( polars_df1 .join(polars_df2, on=['state', 'county', 'timestamp'], suffix='_r') .with_column( ( pl.col('val') + pl.col('val_r')).alias('val') ) .select(['state', 'county', 'timestamp', 'val']) ) and raise you: pandas_df1 + pandas_df2
- gigatexal 4y agoHmmm touché
- brahbrah 4y agoFwiw I actually do prefer polars for standard long format relational operations. But sometimes it’s just more convenient to work with data in other ways. Another example: Polars: polars_df.with_column( pl.when(pl.col('timestamp').is_between( datetime('2023-03-01'), datetime('2023-03-31'), include_bounds=True )).then(pl.col('val') * 1.1) .otherwise(pl.col('val')) .alias('val') ) Pandas: pandas_df.loc['2023-03'] *= 1.1