0

I have a DataFrame with DateTime values as the index which should have daily entries. But in my case, a lot of days are missing from the index (not NaN - they don't exist), I'm assuming due to using dropna somewhere before. I want to add those rows back with NaN values for columns. I thought about creating a list that runs from the first date to the last date then looping, indexing, and adding non-existing rows manually. Is there a better way to do it?

tl;dr: I'm trying to reverse the result of dropna().

Thanks!

  • Try this: https://stackoverflow.com/questions/19324453/add-missing-dates-to-pandas-dataframe – Quixotic22 Dec 06 '21 at 10:32
  • Does this answer your question? [Opposite of dropna() in pandas](https://stackoverflow.com/questions/46626639/opposite-of-dropna-in-pandas) – cmosig Dec 06 '21 at 10:41

0 Answers0