Spaces:
Sleeping
Sleeping
Download build/lib/src/data/utils.py from ServandoTorres/Relu: direct link, hf CLI and curl.
- Browser
- Download file 653 Bytes
-
https://huggingface.co/spaces/ServandoTorres/Relu/resolve/main/build/lib/src/data/utils.py
- Command line
-
hf download hf://spaces/ServandoTorres/Relu/build/lib/src/data/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/ServandoTorres/Relu/resolve/main/build/lib/src/data/utils.py
653 Bytes
| import numpy as np | |
| class Utils: | |
| def convert_to_float(value): | |
| if isinstance(value, float): | |
| return value | |
| try: | |
| return float(value.replace(',', '.')) | |
| except ValueError: | |
| return np.nan | |
| def convert_to_int(value): | |
| if isinstance(value, int): | |
| return value | |
| try: | |
| return int(value) | |
| except ValueError: | |
| return np.nan | |
| # create a function that adds "_" in every space for all columns in a dataframe | |
| def add_underscore(df): | |
| df.columns = df.columns.str.replace(' ', '_') | |
| return df | |