Skip to content

Commit

Permalink
feat: reduce samples from 5 to 3 to save context
Browse files Browse the repository at this point in the history
  • Loading branch information
gventuri committed Nov 6, 2023
1 parent fa64a5a commit 9386751
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pandasai/helpers/data_sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(self, df: DataFrameType):
df = df.to_pandas()
self.df = df

def sample(self, n: int = 5) -> pd.DataFrame:
def sample(self, n: int = 3) -> pd.DataFrame:
"""Sample the dataframe.
Args:
Expand Down
2 changes: 1 addition & 1 deletion pandasai/smart_dataframe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ def _truncate_head_columns(self, df: DataFrameType, max_size=25) -> DataFrameTyp

def _get_sample_head(self) -> DataFrameType:
head = None
rows_to_display = 0 if self.lake.config.enforce_privacy else 5
rows_to_display = 0 if self.lake.config.enforce_privacy else 3
if self._sample_head is not None:
head = self.sample_head
elif not self._core._df_loaded and self.connector:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_query_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def test_add_dataframes(
# Check if the dataframe was added correctly
assert len(tracker._dataframes) == 1
assert len(tracker._dataframes[0]["headers"]) == 3
assert len(tracker._dataframes[0]["rows"]) == 5
assert len(tracker._dataframes[0]["rows"]) == 3

def test_add_step(self, tracker: QueryExecTracker):
# Create a sample step
Expand Down

0 comments on commit 9386751

Please sign in to comment.