Skip to content

Tag: pandas

Plotting row based data

I have some data that looks something like this: What I would like to do is to plot the values of the header dates, but grouped by id and period. So essentially this would become 6 line plots, with the x-axis given as the dates. However, maybe I’m just tired, but this data set is weirdly put together im…

Group by column on basis of occurrences

This is my dataframe: This is how my dataframe looklike: I first counted the no of items for each user using the following code: This is how it looks: I want to remove a user who is coming 1 time and also observation is 1. For example user nemo and cokie. But I don’t want to remove user alex, even

pandas datetime doesn’t convert the dates properly in python

i have a dataframe data i want to convert the dat column to “YYYY-MM-DD” format which is currently in dd-mm-yy format Code using The output of this is coming out to be wrong Problems it was supposed to be giving output year as 1968 and not 2068 Months and date are also not coming in proper order R…

pandas consecutive Boolean event rollup time series

Here’s some made up time series data on 1 minute intervals: This is just some code to create some Boolean columns On my screen this prints: What I am trying to figure out is how to rollup per hour cumulative events (True or 1) but if there is no 0 between events, its the same event! Hopefully that makes…