Why resampling data over an interval fails sometimes and fills some columns with nan?

Course Name: Getting Market Data: Stocks, Crypto, News & Fundamental, Section No: 2, Unit No: 7, Unit type: Notebook

 

There is no personal notebook to follow, the code is same as in the notebook for this section and unit.

 

Whenever the resample method is used to resample minute date into 15 minutes, 1 hour or 4 hours intervals, some rows are filled with nan values. Why is that? Why does the resampling fail?

 

 

Hey Maxim,



If your input data has NaN values, the resampled data will also have NaN values. If you apply the dropna() method to your input data, the resampled data will not generate NaN values.



Hope this resolves your query.



Thanks,

Rushda Ansari

Hi Maxim,



Just wanted to mention another reason for getting NaN values. This can also happen because the resample method adds a timestamp even for off-market hours. So it's recommended that you apply the dropna() method after resampling your data, as shown in the notebook that you mentioned in your query.



Thanks,

Rushda