Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pressure unit: barg and bar_abs instead of bar #667

Open
jkisse opened this issue Nov 27, 2024 · 1 comment
Open

Pressure unit: barg and bar_abs instead of bar #667

jkisse opened this issue Nov 27, 2024 · 1 comment

Comments

@jkisse
Copy link
Collaborator

jkisse commented Nov 27, 2024

From the naming, it is not really clear whether the unit for pressure refers to absolute or relative pressure. It would be helpful to change the naming to barg (bar gauge) where applicable and use bar_abs where absolute pressure are meant.
As far as I understand, "bar" currently means "barg" but this should be stated in the documentation somewhere.

@jkisse
Copy link
Collaborator Author

jkisse commented Nov 27, 2024

It would probably a breaking change, but backward compatibility could be kept with some custom DF modifications, according to a ChatBot:...

import pandas as pd
import warnings

class CustomDataFrame(pd.DataFrame):
    @property
    def _constructor(self):
        return CustomDataFrame

    def __getitem__(self, key):
        if key == 'old_column_name':  # Replace with your old column name
            warnings.warn("The column 'old_column_name' is deprecated, use 'new_column_name' instead.", DeprecationWarning)
            return super().__getitem__('new_column_name')  # Replace with your new column name
        return super().__getitem__(key)

    def __getattr__(self, attr):
        if attr == 'old_column_name':  # Replace with your old column name
            warnings.warn("The column 'old_column_name' is deprecated, use 'new_column_name' instead.", DeprecationWarning)
            return self['new_column_name']  # Replace with your new column name
        return super().__getattr__(attr)

# Example usage
data = {'new_column_name': [1, 2, 3]}
df = CustomDataFrame(data)

# Accessing the new column
print(df.new_column_name)

# Accessing the old column (will raise a deprecation warning)
print(df.old_column_name)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant