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
melt
function to reshape the DataFrame. KeepYear
as the identifier column (id_vars
) and transform selected pesticide-related columns (value_vars
) into a long format withPesticide Type
andUsage
columns. - Filter Rows: Exclude rows where the
Pesticide Type
column equals'Pesticides (total)'
. - Pivot Data: Transform the long-format DataFrame back into a wide format with
Year
as rows andPesticide Type
as columns. Aggregate usage values using thesum
function. - Save Transformed Data: Write the transformed dataset to a new CSV file (
modified_tableau_long_format_exclude_total.csv
).