Skip to content

Tag: pandas

How do I name the dataframe index after a variable result?

I have a variable called ‘Specimen’ from a dataframe imported from a xlsx file, and I want to implement the result of this variable (in this case 25) in a new dataframe? What I have: array([[25.0]], dtype=object) What I want: I have tried But this gives the following error: TypeError: RangeIndex.n…

Count number of days in each continuous period pandas

Suppose I have next df N03_zero (date_code is already datetime): Millions of rows with date_code assigned to some item_code. I am trying to get the number of days of each continuous period for each item_code, all other similar questions doesn’t helped me. The expected df should be: Once days sequence br…