Category : dataframe

I am experimenting with polars and would like to understand why using polars is slower than using pandas on a particular example: import pandas as pd import polars as pl n=10_000_000 df1 = pd.DataFrame(range(n), columns=[‘a’]) df2 = pd.DataFrame(range(n), columns=[‘b’]) df1p = pl.from_pandas(df1.reset_index()) df2p = pl.from_pandas(df2.reset_index()) # takes ~60 ms df1.join(df2) # takes ~950 ms df1p.join(df2p, ..

Read more

I have a pandas dataframe like this: A B C D E 0 aaa 5.56000000 0.01000000 1.00000000 0.00001000 1 bbb 0.49000000 0.00100000 0.01000000 0.00010000 2 ccc 1.70000000 0.10000000 0.10000000 0.00100000 3 ddd 5.35000000 0.00001000 0.00001000 0.01000000 4 eee 6.00000000 16.00000000 0.00000100 1.00000000 I need remove trailing zeros and at the same time, round values after ..

Read more

i face a problem with pivot in pandas , the total_profit and numberofgoodsold columns are located above company row. i need the company row to be at the top. in each company the total_profit and the goodsold columns should came under. this is my code: data = {‘company’: [‘AMC’, ‘ER’,’CRR’ , ‘TYU’], ‘Reg-ID’: [‘1222′,’2334′,’3444’, ‘4566’], ..

Read more