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

Feature/save charts with User Defined Path #316

Merged
merged 10 commits into from
Jun 27, 2023

Conversation

amjadraza
Copy link
Contributor

@amjadraza amjadraza commented Jun 26, 2023

PR related to #271 . Below is the example to use.

import pandas as pd
import os
from data.sample_dataframe import dataframe

from pandasai import PandasAI
from pandasai.llm.openai import OpenAI

df = pd.DataFrame(dataframe)

llm = OpenAI()

user_defined_path = os.getcwd()
pandas_ai = PandasAI(llm, save_charts=True,
                     save_charts_path=user_defined_path,
                     verbose=True)
response = pandas_ai(
    df,
    "Plot the histogram of countries showing for each the gpd,"
    " using different colors for each bar",
)
# Output: check out $pwd/exports/charts/{hashid}/chart.png

Copy link
Contributor

@jonbiemond jonbiemond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! I reviewed the save_charts related features and had a couple thoughts.

.gitignore Outdated
.vscode

/exports/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exports/ can already be found on line 34.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted. However, it was not working for my Directory.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's surprising. It's formatted according to the docs: https://git-scm.com/docs/gitignore

pandasai/helpers/save_chart.py Show resolved Hide resolved
pandasai/__init__.py Outdated Show resolved Hide resolved
1. Ran `black` and pre-commit
2. Fixed .gitignore
3. added `pandasai.__version__` : Reading version from `pyproject.toml` file
@amjadraza
Copy link
Contributor Author

@jonbiemond addressed all your concerns.

  1. added pandasai.__version__ : Reading version from pyproject.toml file

@gventuri gventuri merged commit 1adbb09 into Sinaptik-AI:main Jun 27, 2023
3 checks passed
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 this pull request may close these issues.

Save charts to folder specified by user
3 participants