Skip to content

Tag: dataframe

Row wise operation in Pandas DataFrame

I have a Dataframe as I would like to have a lambda function in apply method to create a list of dictionary (including index item) as below If I use something like .apply(lambda x: <some operation>) here, x does not include the index rather the values. Cheers, DD Answer To expand Hans Bambel’s ans…

Explode a column with multiple values separated by comma

How are you? I have a database where some lines have more than one product and they are separated by a comma, as in the example below (there are other columns, but to make it more practical I only took these three). id produdct value 47 product1, product 2 12000.0 48 product3 48000.0 49 product4, product1, pr…