Skip to content

Pandas doesn't allow columns to be created via a new attribute name #4

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

Open
FahimMohd opened this issue Jun 1, 2023 · 1 comment
Open

Comments

@FahimMohd
Copy link

conv_df = PandasLLM(data=df, llm_api_key = os.environ.get("OPENAI_API_KEY"))

/tmp/ipykernel_32725/1067823130.py:21: UserWarning: Pandas doesn't allow columns to be created via a new attribute name - see https://pandas.pydata.org/pandas-docs/stable/indexing.html#attribute-access
conv_df = PandasLLM(data=df, llm_api_key = os.environ.get("OPENAI_API_KEY"))

I get this error always, tried using the list instead of df, and removing api_key but still get the same error

@JunyiYe
Copy link

JunyiYe commented Aug 9, 2023

conv_df = PandasLLM(data=df, llm_api_key = os.environ.get("OPENAI_API_KEY"))

/tmp/ipykernel_32725/1067823130.py:21: UserWarning: Pandas doesn't allow columns to be created via a new attribute name - see https://pandas.pydata.org/pandas-docs/stable/indexing.html#attribute-access conv_df = PandasLLM(data=df, llm_api_key = os.environ.get("OPENAI_API_KEY"))
t> I get this error always, tried using the list instead of df, ahnd removing api_key but still get the same error

To fix this warning, the best practice when subclassing a DataFrame is to use the object attribute for custom attributes.

Replace the line self.llm_params = llm_params or {} in "init.py" to self.__dict__['llm_params'] = llm_params or {} solve this issue.

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

2 participants