Home > database >  How to reindex pandas Series by removing nulls between different indices?
How to reindex pandas Series by removing nulls between different indices?

Time:07-06

I have a pandas Series that goes by 5 in indexes like the image;

A Pandas dataframe with indexes incrementing by 5

I want to transform this Pandas Series to;

  1. 20.883339
  2. 20.883386
  3. 20.883434

...

3652 21.053699

Can I transform my Pandas series like that without creating a new series?

CodePudding user response:

Resetting the index with drop=True will replace it with the default 0-indexed integer index:

y_pred = y_pred.reset_index(drop=True)
  • Related