Skip to content

Tag: dataframe

Get cumulative sum in pandas

Context Datetime Campaign_name Status Open_time 2022-03-15 00:00 Funny_campaign Open 2022-03-15 01:00 Funny_campaign Continue 2022-03-15 02:00 Funny_campaign Continue 2022-03-15 03:00 Funny_campaign Continue 2022-03-15 04:00 Funny_campaign Close 2022-03-15 08:00 Funny_campaign Open 2022-03-15 09:00 Funny_camp…

Extracting features from dataframe

I have pandas dataframe like this For example if “ex” start to 533,535,545 new variable should be : Sample output : How can i do that ? Answer You can use np.where: Update You can also use your Phone column directly: Note: If Phone column contains strings you can safely remove .astype(str).