Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions docs/examples/mobject/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,16 @@ def update_sales(self, store: str, amount: str):
header=0,
index_col=False,
)
print(f"testing123 changes {store} to {amount}")
# Remove unnamed columns and columns that don't exist.
table_df.drop(table_df.filter(regex="Unname").columns, axis=1, inplace=True)

# Sometimes extra whitespace gets added to the column names and row values. Remove it.
table_df.columns = table_df.columns.str.strip()
table_df = table_df.map(lambda x: x.strip() if isinstance(x, str) else x)

table_df.loc[table_df["Store"] == store, "Sales"] = amount
return MyCompanyDatabase(
table=table_df.to_csv(sep="|", index=False, header=True)
)
self.table = table_df.to_csv(sep="|", index=False, header=True)
return self

def transpose(self):
"""Transpose the table."""
Expand Down
3 changes: 3 additions & 0 deletions mellea/stdlib/funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ def chat(
user_message,
context=context,
backend=backend,
strategy=None,
format=format,
model_options=model_options,
tool_calls=tool_calls,
Expand Down Expand Up @@ -468,6 +469,7 @@ def query(
q,
context=context,
backend=backend,
strategy=None,
format=format,
model_options=model_options,
tool_calls=tool_calls,
Expand Down Expand Up @@ -511,6 +513,7 @@ def transform(
t,
context=context,
backend=backend,
strategy=None,
format=format,
model_options=model_options,
tool_calls=True,
Expand Down