pandas-ai
pandas-ai copied to clipboard
Return dataframe
- [x] closes #201
- [x] Tests added and passed if fixing a bug or adding a new feature
- [x] All code checks passed.
As discussed in #201, when the model returns a data frame, we should return it to the user as a data frame for further operations. Results that have a dataframe (with or without index) will be returned as dataframe instead of a string.
country gdp happiness_index 0 United States 19294482071552 6.94 1 United Kingdom 2891615567872 7.16 2 France 2411255037952 6.66 3 Germany 3435817336832 7.07 4 Italy 1745433788416 6.38 5 Spain 1181205135360 6.40 6 Canada 1607402389504 7.23 7 Australia 1490967855104 7.22
Great job @navneetdesai, I'm just afraid it might be more involved trying to fix this. In fact, when the df is converted to a string some of the info might be lost and re-converting to df only works for some kind of df. Did you test your solution with bigger dataframes (i.e. more rows or columns?).
From my understanding, it's probably necessary to intervene before it's even converted to a string
please refer to PR #223
Closing the PR for now.