Skip to content

Commit 7eb1ebe

Browse files
committed
fix prompt to accomodate multiple table
1 parent 06a22ff commit 7eb1ebe

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

py-src/data_formulator/agents/agent_data_transform_v2.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
}
4646
```
4747
48-
2. Then, write a python function based on the refined goal, the function input is a dataframe "df" and the output is the transformed dataframe "transformed_df". "transformed_df" should contain all "output_fields" from the refined goal.
48+
2. Then, write a python function based on the refined goal, the function input is a dataframe "df" (or multiple dataframes based on tables presented in the [CONTEXT] section) and the output is the transformed dataframe "transformed_df". "transformed_df" should contain all "output_fields" from the refined goal.
4949
The python function must follow the template provided in [TEMPLATE], do not import any other libraries or modify function name. The function should be as simple as possible and easily readable.
5050
If there is no data transformation needed based on "output_fields", the transformation function can simply "return df".
5151
@@ -56,11 +56,15 @@
5656
import collections
5757
import numpy as np
5858
59-
def transform_data(df):
59+
def transform_data(df1, df2, ...):
6060
# complete the template here
6161
return transformed_df
6262
```
6363
64+
note:
65+
- if the user provided one table, then it should be def transform_data(df1), if the user provided multiple tables, then it should be def transform_data(df1, df2, ...) and you should consider the join between tables to derive the output.
66+
- try to use table names to refer to the input dataframes, for example, if the user provided two tables city and weather, you can use `transform_data(df_city, df_weather)` to refer to the two dataframes.
67+
6468
3. The [OUTPUT] must only contain a json object representing the refined goal (including "detailed_instruction", "output_fields", "visualization_fields" and "reason") and a python code block representing the transformation code, do not add any extra text explanation.
6569
'''
6670

src/views/EncodingShelfCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export const TriggerCard: FC<{className?: string, trigger: Trigger, hideFields?:
113113
let field = fieldItems.find(f => f.id == encoding.fieldID) as FieldItem;
114114
return [index > 0 ? '⨉' : '',
115115
<Chip
116-
key={`trigger-${channel}-${field.id}`}
116+
key={`trigger-${channel}-${field?.id}`}
117117
sx={{color:'inherit', maxWidth: '110px', marginLeft: "2px", height: 18, fontSize: 12, borderRadius: '4px',
118118
border: '1px solid rgb(250 235 215)', background: 'rgb(250 235 215 / 70%)',
119119
'& .MuiChip-label': { paddingLeft: '6px', paddingRight: '6px' }}}

0 commit comments

Comments
 (0)