Skip to content

Commit

Permalink
fix(code_env) add numpy in the env by default (#1144)
Browse files Browse the repository at this point in the history
* fix(code_env) add numpy in the env by default

* add: numpy lib to the environment
  • Loading branch information
ArslanSaleem authored May 3, 2024
1 parent 6c671c4 commit 939bbff
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pandasai/helpers/optional.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from typing import TYPE_CHECKING, List

import matplotlib.pyplot as plt
import numpy as np
from pandas.util.version import Version

import pandasai.pandas as pd
Expand Down Expand Up @@ -56,6 +57,7 @@ def get_environment(additional_deps: List[dict]) -> dict:
return {
"pd": pd,
"plt": plt,
"np": np,
**{
lib["alias"]: (
getattr(import_dependency(lib["module"]), lib["name"])
Expand Down
1 change: 1 addition & 0 deletions tests/unit_tests/helpers/test_optional_dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,4 @@ def test_env_for_necessary_deps():
env = get_environment([])
assert "pd" in env
assert "plt" in env
assert "np" in env

0 comments on commit 939bbff

Please sign in to comment.