Info
此问题已关闭。 请重新打开它进行编辑或回答。
Put NaN values to incomplete records
1 次查看(过去 30 天)
显示 更早的评论
Hello:
I have 3-hourly records for a daily time series records with lot of missing values for 30-yrs. Since 3-hourly records have 8 observations/day, I want to check for whether I have at least 4 records/day in the series. If I have less than that I want to discard that particular record and substitute NaN value. Could anyone please show how to achieve this. I am putting a reference series here.
3 个评论
Jan
2022-6-12
编辑:Jan
2022-6-12
You have posted a text file. can we assume, that you are able to import the data already? Does exporting the result belong to the problem?
You want to set what exactly to NaN? What is "that particular record", if there are less then 4 records?
As far as I can see, in the given example you want to set all values of the last 4 columns to NaN. Then this is not a useful example. Maybe this is clearer:
1992 4 12 0 NaN NaN NaN NaN
1992 4 12 3 NaN NaN NaN NaN
1992 4 12 6 49.96 15.60 5.20 10.17 % Keep: >= 4 records
1992 4 12 9 32.06 21.00 3.70 11.85 % Keep: >= 4 records
1992 4 12 12 32.06 21.00 3.70 11.85 % Keep: >= 4 records
1992 4 12 15 32.06 21.00 3.70 11.85 % Keep: >= 4 records
1992 4 12 18 NaN NaN NaN NaN
1992 4 12 21 89.18 10.00 8.30 9.10 % Remove: >= 4, but
1992 4 13 0 89.18 10.00 8.30 9.10 % not on one day
1992 4 13 3 89.18 10.00 8.30 9.10
1992 4 13 6 89.18 10.00 8.30 9.10
1992 4 13 9 NaN NaN NaN NaN
1992 4 13 12 NaN NaN NaN NaN
1992 4 13 15 22.96 25.00 2.40 12.98 % Remove: < 4 records
1992 4 13 18 NaN NaN NaN NaN
1992 4 13 21 NaN NaN NaN NaN
Ganesh Gudipati
2022-6-15
Hi Poulomi,
As per my understanding, the first 4 columns represents year, month,date and time. The next 4 columns represents the observations you are recording for every 3 hours. When they are NaN it means data is not recorded at that particular point of time. So if data recorded <4 times in day you want to make all the recodings on that particular day to NaN.
Is that what you wanted?
回答(0 个)
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!