write_csv_to_dataframe

parses the MORA Meldingen Openbare Ruimte Amsterdam once downloaded from objectstore.
Args:
file (csv): containing at least a date column datecol: in format %d-%m-%Y %H:%M:%S
Returns:
  • pd.DataFrame: cleaned data frame with datum and time column added
command line example:
read_mora_file(PATH_TO_MORA_FILE + MORA_FILE, datecol=’aa_adwh_datum_melding’)

usage: write_csv_to_dataframe [-h] file datecol

Positional Arguments

file MORA file to be loaded in
datecol date column from which the date and time are extracted and put into different columns. The mora date column in source file is ‘aa_adwh_datum_melding’

functions

datapunt_processing.extract.write_csv_to_dataframe.parser()

Parser function to run arguments from the command line and to add description to sphinx.

datapunt_processing.extract.write_csv_to_dataframe.read_crow_file(file, datecol)

parses the CROW afvaldata Args:

file (xls/xlsx): containing at least a date column datecol: ‘datum’ format %Y-m-%d %H:%M:%S
Returns:
  • pd.DataFrame: cleaned data frame with datum and time column added
datapunt_processing.extract.write_csv_to_dataframe.read_mora_file(file, datecol)

parses the MORA csv and transforms into clean Pandas Dataframe Args:

file (csv/xls/xlsx): containing at least a date column datecol: ‘aa_adwh_datum_melding’ format %Y-m-%d %H:%M:%S
Returns:
pd.DataFrame: cleaned data frame with datum and time column added
datapunt_processing.extract.write_csv_to_dataframe.strip_cols(df)

simple utility function to clean dataframe columns