Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 13981

Python calculate average my code is not working properly

$
0
0

I'm a beginner to Python (Jupyter notebook) I'm added my code and I'm not sure my code is correct becacue always my result is here

The average relative humidity is: nan%

any solution to resolved this?

contains hourly weather observations

my output answer here:The average relative humidity is: nan%

My csv file here : weather_2021-12.csv

AbbreviationMeaning
TATemperature Average
RHRelative Humidity
WSWind Speed
WDWind Direction
PRAPrecipitation Amount
PRIPrecipitation Intensity
PAPressure Average
WAWAMost Significant Weather Code

Calculate the average relative humidity over the full timespan covered in the data, dropping any NaN values.

Please also write a separate report (Jupyter notebook)

    import pandas as pd    data = pd.read_csv(r'C:\Users\Dataset\weather_2021-12.csv')average_relative_humidity = data[data['ParameterName'] == 'RH']['ParameterValue'].dropna().mean()

print(f'Average Relative Humidity: {average_relative_humidity}')

Thanks in advance


Viewing all articles
Browse latest Browse all 13981

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>