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

A value is trying to be set on a copy of a slice from a DataFrame #133

Closed
lgabs opened this issue Feb 24, 2024 · 0 comments · Fixed by #132
Closed

A value is trying to be set on a copy of a slice from a DataFrame #133

lgabs opened this issue Feb 24, 2024 · 0 comments · Fixed by #132

Comments

@lgabs
Copy link
Contributor

lgabs commented Feb 24, 2024

When reunning dialog service, a pandas warning appears warning about changing a copy of a slice dataframe. To avoid this, we can explicitly declare df_filtered a copy.

➜  dialog git:(luan/adopt-lcel-pt1) ✗ docker compose up dialog
[+] Building 0.0s (0/0)                                                                                  docker:desktop-linux
[+] Running 2/2
 ✔ Container dialog-db-1      Running                                                                                    0.0s
 ✔ Container dialog-dialog-1  Created                                                                                    0.1s
Attaching to dialog-dialog-1
dialog-dialog-1  | INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
dialog-dialog-1  | INFO  [alembic.runtime.migration] Will assume transactional DDL.
dialog-dialog-1  | /app/src/load_csv.py:4: DeprecationWarning:
dialog-dialog-1  | Pyarrow will become a required dependency of pandas in the next major release of pandas (pandas 3.0),
dialog-dialog-1  | (to allow more performant data types, such as the Arrow string type, and better interoperability with other libraries)
dialog-dialog-1  | but was not found to be installed on your system.
dialog-dialog-1  | If this would cause problems for you,
dialog-dialog-1  | please provide us feedback at https://github.com/pandas-dev/pandas/issues/54466
dialog-dialog-1  |
dialog-dialog-1  |   import pandas as pd
dialog-dialog-1  | Generating embeddings for new questions...
dialog-dialog-1  | New questions: 0
dialog-dialog-1  | /app/src/load_csv.py:52: SettingWithCopyWarning:
dialog-dialog-1  | A value is trying to be set on a copy of a slice from a DataFrame
dialog-dialog-1  |
dialog-dialog-1  | See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
dialog-dialog-1  |   df_filtered.drop(columns=["primary_key"], inplace=True)
dialog-dialog-1  | INFO:     Will watch for changes in these directories: ['/app/src']
dialog-dialog-1  | INFO:     Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
dialog-dialog-1  | INFO:     Started reloader process [44] using WatchFiles
dialog-dialog-1  | INFO:     Started server process [46]
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

Successfully merging a pull request may close this issue.

1 participant