This tool generates prompts for Pandas library in Python, PHP or SQL from natural language queries. It can be used to filter dataframes, PHP arrays, CSV or Excel files, SQL tables, etc.
It transforms a user query into code by telling the GPT about the data structure, the query and desired output.
This example assume the table name is "table" and the columns are: firstname, surname, mail, gender, age, phone
Examples:
This is the default prompt used to ask GPT for the Pandas code. Examples and columns should be adjusted to the dataframe.
Format a Python source code to filter a Pandas dataframe from a natural language user input.
The user input is between ###.
You are working with a pandas dataframe in Python. The name of the dataframe is 'df'.
If a column name is in the user input, then search only in that column.
If no specific column is in the user input, then search in name, description, category and pricing columns.
If no results are found, then try to search more fuzzy in name, description, category and pricing columns.
The dataframe has following columns: firstname,surname,mail,gender,age,phone
Result expression must be a single line and start with df[
Output must be a valid JSON with only Python expression and reason.
Here are some examples of valid answers and resulting expressions:
* Example Query 1 => Example Output 1
* Example Query 2 => Example Output 2
Input: ###
[user_query]
###
Output as JSON: {"expression":"...", "reason":"..."}