Timestamp
1990-2022
Data source
Dataset
modified_flourish_long_format_exclude_total.csv
Protocol
Flourish + Python
Preprocessing steps:
- Load the Dataset: Read the CSV file (cleaned_dataset.csv) into a Pandas DataFrame.
- Reshape with Melt: Use the meltfunction to reshape the DataFrame. KeepYearas the identifier column (id_vars) and transform selected pesticide-related columns (value_vars) into a long format withPesticide TypeandUsagecolumns.
- Filter Rows: Exclude rows where the Pesticide Typecolumn equals'Pesticides (total)'.
- Pivot Data: Transform the long-format DataFrame back into a wide format with Yearas rows andPesticide Typeas columns. Aggregate usage values using thesumfunction.
- Save Transformed Data: Write the transformed dataset to a new CSV file (modified_tableau_long_format_exclude_total.csv).