datasloth icon indicating copy to clipboard operation
datasloth copied to clipboard

Not able to transpose table

Open shantanuo opened this issue 2 years ago • 2 comments

Great work. But when I tried to "transpose table" it did not get it. Then I tried...

sloth.query("columns in rows and rows in columns", show_query=True)

SELECT *
FROM (
  SELECT *
  FROM T
  LIMIT 10
)
PIVOT (
  COUNT(*)
  FOR column_name
  IN ('a', 'b', 'c')
)

Unsuccessful. Try rephrasing your query, or add additional table descriptions in df.sloth.description. You can inspect the generated prompt and GPT response in sloth.show_last_prompt().

sloth.show_last_prompt is not working by the way.

shantanuo avatar Jan 30 '23 08:01 shantanuo

After upgrading the package to use model "text-davinci-003" (instead of version 002) I get this query:

SELECT *
FROM df
PIVOT (
  COUNT(*)
  FOR b IN ('e', 'h')
)

But that is not working as well.

shantanuo avatar Jan 30 '23 08:01 shantanuo

Thanks for the info :) Seems like this might be a bit out of scope for Datasloth. In general, it is aimed more at answering "real" questions, instead of doing data transformations. But I will keep this in mind when making improvements.

Re. show_last_prompt, I will fix that, thanks!

ibestvina avatar Jan 30 '23 09:01 ibestvina