mlco2 / codecarbon

Track emissions from Compute and recommend ways to reduce their impact on the environment.
https://mlco2.github.io/codecarbon
MIT License
1.01k stars 158 forks source link

ValueError: can only convert an array of size 1 to a Python scalar #408

Closed benoit-cty closed 1 year ago

benoit-cty commented 1 year ago

Description

There is an error in get_cloud_emissions when we find multiple line in the dataframe:

        emissions_per_kWh: EmissionsPerKWh = EmissionsPerKWh.from_g_per_kWh(
            df.loc[(df["provider"] == cloud.provider) & (df["region"] == cloud.region)][
                "impact"
            ].item()
        )

We need to check the duplicated lines in the file.

See https://github.com/mlco2/codecarbon/actions/runs/4965711560/jobs/8886700337#step:5:747

benoit-cty commented 1 year ago

Closed by https://github.com/mlco2/codecarbon/pull/407