Skip to content

Ruff Linter has flagged issues: Code problems? #209

Open
@ModeSevenIndustrialSolutions

Description

Looks like we have some issues with the code:

https://results.pre-commit.ci/run/github/706174425/1727689562.Ii0IujwCQHyhLM5ymbwhfQ

Output from the ruff linter below:

ruff.....................................................................Failed
- hook id: ruff
- exit code: 1

notebooks/03_vault_quant.ipynb:cell 26:2:1: F821 Undefined name `portfolio_df`
  |
1 | # portfolio_df[portfolio_df.company_name=='POSCO']
2 | portfolio_df.dropna(inplace=True)
  | ^^^^^^^^^^^^ F821
3 | portfolio_df.sort_values(by="company_name")
  |

notebooks/03_vault_quant.ipynb:cell 26:3:1: F821 Undefined name `portfolio_df`
  |
1 | # portfolio_df[portfolio_df.company_name=='POSCO']
2 | portfolio_df.dropna(inplace=True)
3 | portfolio_df.sort_values(by="company_name")
  | ^^^^^^^^^^^^ F821
  |

notebooks/03_vault_quant.ipynb:cell 27:1:19: F821 Undefined name `portfolio_df`
  |
1 | weight_for_WATS = portfolio_df["investment_value"].sum()
  |                   ^^^^^^^^^^^^ F821
2 | weight_for_WATS
  |

notebooks/03_vault_quant.ipynb:cell 28:1:1: F821 Undefined name `portfolio_df`
  |
1 | portfolio_df["WATS_weight"] = portfolio_df["pa_score"] * (
  | ^^^^^^^^^^^^ F821
2 |     portfolio_df["investment_value"] / weight_for_WATS
3 | )
  |

notebooks/03_vault_quant.ipynb:cell 28:1:31: F821 Undefined name `portfolio_df`
  |
1 | portfolio_df["WATS_weight"] = portfolio_df["pa_score"] * (
  |                               ^^^^^^^^^^^^ F821
2 |     portfolio_df["investment_value"] / weight_for_WATS
3 | )
  |

notebooks/03_vault_quant.ipynb:cell 28:2:5: F821 Undefined name `portfolio_df`
  |
1 | portfolio_df["WATS_weight"] = portfolio_df["pa_score"] * (
2 |     portfolio_df["investment_value"] / weight_for_WATS
  |     ^^^^^^^^^^^^ F821
3 | )
4 | portfolio_df.head()
  |

notebooks/03_vault_quant.ipynb:cell 28:4:1: F821 Undefined name `portfolio_df`
  |
2 |     portfolio_df["investment_value"] / weight_for_WATS
3 | )
4 | portfolio_df.head()
  | ^^^^^^^^^^^^ F821
  |

notebooks/03_vault_quant.ipynb:cell 29:2:52: F821 Undefined name `portfolio_df`
  |
1 | print(
2 |     f"Portfolio temperature score based on WATS = {portfolio_df['WATS_weight'].sum()}"
  |                                                    ^^^^^^^^^^^^ F821
3 | )
  |

notebooks/03_vault_quant.ipynb:cell 31:1:1: F821 Undefined name `portfolio_df`
  |
1 | portfolio_df["TETS_weight"] = vault_company_data.compute_portfolio_weights(
  | ^^^^^^^^^^^^ F821
2 |     portfolio_df["pa_score"], 2019, "emissions", EScope.S1S2
3 | ).astype("pint[delta_degC]")
  |

notebooks/03_vault_quant.ipynb:cell 31:2:5: F821 Undefined name `portfolio_df`
  |
1 | portfolio_df["TETS_weight"] = vault_company_data.compute_portfolio_weights(
2 |     portfolio_df["pa_score"], 2019, "emissions", EScope.S1S2
  |     ^^^^^^^^^^^^ F821
3 | ).astype("pint[delta_degC]")
4 | portfolio_df.head()
  |

notebooks/03_vault_quant.ipynb:cell 31:4:1: F821 Undefined name `portfolio_df`
  |
2 |     portfolio_df["pa_score"], 2019, "emissions", EScope.S1S2
3 | ).astype("pint[delta_degC]")
4 | portfolio_df.head()
  | ^^^^^^^^^^^^ F821
  |

notebooks/03_vault_quant.ipynb:cell 32:2:52: F821 Undefined name `portfolio_df`
  |
1 | print(
2 |     f"Portfolio temperature score based on TETS = {portfolio_df['TETS_weight'].sum()}"
  |                                                    ^^^^^^^^^^^^ F821
3 | )
  |

notebooks/03_vault_quant.ipynb:cell 34:1:1: F821 Undefined name `portfolio_df`
  |
1 | portfolio_df.dtypes
  | ^^^^^^^^^^^^ F821
  |

notebooks/03_vault_quant.ipynb:cell 35:11:5: F821 Undefined name `portfolio_df`
   |
 9 | for k, v in weighting_dict.items():
10 |     weight_column = f"{k}_weight"
11 |     portfolio_df[weight_column] = vault_company_data.compute_portfolio_weights(
   |     ^^^^^^^^^^^^ F821
12 |         portfolio_df["pa_score"], 2019, v, EScope.S1S2
13 |     )
   |

notebooks/03_vault_quant.ipynb:cell 35:12:9: F821 Undefined name `portfolio_df`
   |
10 |     weight_column = f"{k}_weight"
11 |     portfolio_df[weight_column] = vault_company_data.compute_portfolio_weights(
12 |         portfolio_df["pa_score"], 2019, v, EScope.S1S2
   |         ^^^^^^^^^^^^ F821
13 |     )
14 |     print(
   |

notebooks/03_vault_quant.ipynb:cell 35:15:55: F821 Undefined name `portfolio_df`
   |
13 |     )
14 |     print(
15 |         f"Portfolio temperature score based on {k} = {portfolio_df[weight_column].sum()}"
   |                                                       ^^^^^^^^^^^^ F821
16 |     )
   |

notebooks/03_vault_quant.ipynb:cell 35:18:1: F821 Undefined name `portfolio_df`
   |
16 |     )
17 | 
18 | portfolio_df
   | ^^^^^^^^^^^^ F821
   |

notebooks/03_vault_quant.ipynb:cell 37:1:1: F821 Undefined name `portfolio_df`
  |
1 | portfolio_df[portfolio_df.pa_score.isnull()]
  | ^^^^^^^^^^^^ F821
  |

notebooks/03_vault_quant.ipynb:cell 37:1:14: F821 Undefined name `portfolio_df`
  |
1 | portfolio_df[portfolio_df.pa_score.isnull()]
  |              ^^^^^^^^^^^^ F821
  |

notebooks/co2budget.ipynb:cell 12:45:42: F821 Undefined name `ureg`
   |
43 |         return pd.Series()
44 |     # Work-around for https://github.com/hgrecco/pint/issues/1687
45 |     return pd.Series(PA_(data, dtype=str(ureg.parse_units(units))), index=idx)
   |                                          ^^^^ F821
   |

notebooks/co2budget.ipynb:cell 13:81:25: F821 Undefined name `sector_ei_s1s`
   |
79 |         if sector_ei_s1 is not None:
80 |             bm_key = "BenchmarkS1"
81 |             sector_ei = sector_ei_s1s
   |                         ^^^^^^^^^^^^^ F821
82 |         else:
83 |             continue
   |

Found 21 errors.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions