EnergySystemsModellingLab / MUSE_2.0

Welcome to the MUSE 2.0 repository
GNU General Public License v3.0
1 stars 0 forks source link

Convert column names to snake case #68

Closed alexdewar closed 3 months ago

alexdewar commented 3 months ago

Fixes EnergySystemsModellingLab/MUSE_2.0#66.

Along the way, I noticed that the CSV files have all been committed with Windows line endings, so I fixed that first, which is why it looks as if every single line in the CSV files has been changed. (NB: After this change, the line endings in the CSV files -- as with the other source files -- will still have Windows line endings on Windows, but they'll have Unix ones otherwise. For an explanation of this, see: https://www.aleksandrhovhannisyan.com/blog/crlf-vs-lf-normalizing-line-endings-in-git/)

My script also normalised the form of some of the floating-point values (e.g. 1 becomes 1.0). (Given EnergySystemsModellingLab/highs-example-rust#2, this is probably a good thing.)

I used the following Python script to convert the column names automatically:

import pandas as pd

def to_snake(name: str):
    return name.lower().replace(' ', '_')

def main(path):
    df = pd.read_csv(path)
    df.rename(columns=to_snake, inplace=True)
    df.to_csv(path, index=False)

if __name__ == "__main__":
    import sys
    for path in sys.argv[1:]:
        main(path)
codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 81.81%. Comparing base (9f6ec67) to head (1782028). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main EnergySystemsModellingLab/MUSE_2.0#68 +/- ## ======================================= Coverage 81.81% 81.81% ======================================= Files 7 7 Lines 77 77 ======================================= Hits 63 63 Misses 14 14 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.