This function loads a series of daily csv files and combines them into a monthly dataframe
- Create an empty Pandas DataFrame
- append to empty DataFrame after each load.
Word of caution – the columns must be the same for all inputs.
One should test the columns to make sure you get what you expect.
def load_monthly_noaa_csv_files( dir, noaa_station, ext = "csv", tyear=2021, tmonth=0): file_list = gather_monthly_noaa_files( dir, noaa_station, ext, tyear, tmonth) month_df = pd.DataFrame() if len(file_list) > 0: for f in file_list: obs1 = read_weather_obs_csv( f ) print(obs1.head()) month_df = month_df.append(obs1,ignore_index=True) return month_df