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

93 Views Asked by At

The file named

[CSV_NAME]

contains hourly weather observations from Jyväskylä, Finland.

Abbreviation Meaning
TA Temperature Average
RH Relative Humidity
WS Wind Speed
WD Wind Direction
PRA Precipitation Amount
PRI Precipitation Intensity
PA Pressure Average
WAWA Most Significant Weather Code

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

Please write the answer in number only

Didn’t understand what written about csv_name. What does it mean?

1

There are 1 best solutions below

0
Poshak Pathak On

You can use pandas to read CSV files, read RH and drop NA Values.

import pandas as pd
file_path = 'filename.csv'
df = pd.read_csv(file_path) //put CSV into a data frame
clean_RH = df['RH'].dropna() //goes over the entire RH column and drops NA values
average_RH = clean_RH.mean()

Didn’t understand what written about csv_name. What does it mean?

I am not entirely sure what you're trying to ask here but I'm pretty sure csv_name is just trying to refer to the name of the CSV file.

You might find this thread helpful: Calculate the weighted average in pandas with NaN values