Im having trouble using the api to analyse a dataframe, i can do counts/distinct counts of categorical fields fine but when i try to do a simple sum i get wrong output, here is a example, when running this i get a different sum each time, has anyone looked at this , ive tried using different engines & datatypes but to no avail. thanks
import openai
import pandas as pd
openai.api_key = ‘xx’
df = pd.DataFrame({‘Net_Revenue’: [5, 2, 10, 25, 10, 7, 10, 20, 20, 40, 10, 1]})
def summarize_dataframe(df, prompt):
response = openai.Completion.create(
engine="text-davinci-003",
prompt=f"{prompt}:\n{df}\n\n",
temperature=0,
max_tokens=2000
)
print(response["choices"][0]["text"])
summarize_dataframe(df, “Sum values in the column Revenue”)