0

I would like to know is there a way to pandas to detect if some date are missing from a datetime index ? I got two columns with some dates and a mileage of car. My goal is to complete my missing dataframes with an average of the miles by day on the missing days.

Actual
2020-10-26,2232
2020-10-27,2260
2020-12-27,4813
Objective
2020-10-26,2232
2020-10-27,2260
2020-10-28,
2020-10-29,
[...]
2020-12-26,
2020-12-27,4813
NathanRDN
  • 3
  • 1
  • 2
  • hmm, don't understand the actual question – billz Dec 28 '20 at 14:23
  • Maybe what you need is something like Series.reindex? https://stackoverflow.com/questions/19324453/add-missing-dates-to-pandas-dataframe – Lucas Infante Dec 28 '20 at 14:28
  • The idea is to complete the dataframe date by the missing one. I don't know if I'm clear but my aim objective is to have all the dates and recreate the missing ones – NathanRDN Dec 28 '20 at 14:28

1 Answers1

0

I believe what you want is something similar to the asfreq method. Documentation is here.

  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jun 13 '22 at 04:56