'I do not the understand why there is no output
I am trying to get a particular subset of rows from a dataset. The problem I'm facing is stated in the last paragraph. Firstly, I have done the following:
import pandas as pd
import statistics
df=pd.read_csv('Area(2).txt',delimiter='\t')
print(df.columns)
The dataset contains the hourly height for Area 2 measured in one month but some of the recordings/values are missing and the missing values have been recorded as "9999". Now, I want to get the rows of the heights for different time intervals. For example, below you can see how I got the height for the first 22 days and I also included the way I filtered out the missing values. This worked out fine at first. I could calculate the mean and standard deviation for this subset.
df2=df[df.Value!=9999]
print(df2)
# April 1-April 22 hourly height
df4=df2.iloc[0:530,5]
print(df4)
But when I tried to get hold of the values for the next two days, I don't get any output for some reason.
# April 23-April 25 hourly height
df5=df2.iloc[534:594,5]
print(df5)
Instead, I get the following as output instead of the required set of hourly height values like before.
df5=df2.iloc[534:594,5]
print(df5)
Series([], Name: Value, dtype: int64)
I am not sure what the part Series([], Name: Value, dtype: int64) means and how can I get rid of this problem to get the required subset for April 23-25? When I try to calculate the mean or standard deviation for this time interval I keep getting nan which should not be happening.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
