2
Good morning, I’m having a major data failure problem in my df
. I need to find the value of CO2 similar to that of another time using conditions that I am not able to do with the information on the line. I own a df
of 1
year with values of 30 em 30 minutos
. the values of Temperature and Radiation do not have missing values, I only have missing values in CO2
.
import numpy as np
import pandas as pd
df = pd.read_hdf('./dados.hd5')
df.head()
Year_DoY_Hour Temperatura radiacao CO2
2016-01-01 00:00:00 22.44570 0 380
2016-01-01 00:30:00 22.445700 0 390
.
.
2016-01-15 00:00:00 22.88300 0 379
2016-01-15 00:30:00 22.445700 0 381
2016-01-15 01:00:00 22.388300 0 NaN
.
.
.
2016-01-30 00:00:00 22.400000 0 350
2016-01-30 00:30:00 16.393900 0 375
2016-01-30 01:00:00 17.133900 0 365
- (a)Temperature must be between
+- 2.5ºC
; - (b)Radiation
+- 50W/m²
; - I have to have a window of
-+ 3 dias
between the value withNaN
ofCO2
. - Average the values of
CO2
when(a)
and(b)
are accepted on condition and place where I have the missing data ofCO2
.
In the df
shown above we have to the day and time 2016-01-15 01:00:00
we have NaN
in the CO2
and then I can’t find a temp. and radia. to fill the value of CO2
.
I believe with conditions I can do it, but I’m not getting it.
Hello! Your question was not very clear. You want to be able to read your file and treat an exception when reading find the
NaN
?– Leonardo Pessoa
Hello! That’s right, when you find
NaN
in theCO2
he takes that same time the temperature and radiation and searches the last 3 days and the next similar values.– Lucas Fagundes