Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resultset are indistinguishable from pandas data frames #468

Closed
edublancas opened this issue Apr 28, 2023 · 3 comments · Fixed by #655
Closed

resultset are indistinguishable from pandas data frames #468

edublancas opened this issue Apr 28, 2023 · 3 comments · Fixed by #655
Assignees

Comments

@edublancas
Copy link

ResultSet (the data structure we use by default to store db results), is currently indistinguishable from pandas data frames:

image

this can confuse users, as they might think the're data frames. we should ensure they look different. perhaps add result set at the bottom.

maybe we should also detect when they try do perform pandas-like operations? e.g.,

df.head()

Error should be: head is not a valid operation, you can convert this into a pandas data frame by calling .DataFrame() or a polars data frame by calling .PolarsDataFrame()

@edublancas
Copy link
Author

another thing we can do is add a little message at the bottom of the table saying: "to convert to pandas, call .DataFrame()"

@bbeat2782
Copy link

bbeat2782 commented Jun 21, 2023

Sorry for working on the problem before describing the AC

Acceptance Criteria:

  1. Add string below ResultSet representation indicating it is a ResultSet object and not pd.DataFrame
  2. Add "to convert to pandas, call .DataFrame() or to polars, call .PolarsDataFrame()" next to the string created above
  3. Raise an AttributeError with the error message (head is not a valid operation, you can convert this into pandas data frame by calling .DataFrame() or a polars data frame by calling .PolarsDataFrame()) when an invalid operation is performed on the ResultSet object
  4. Modify tests to include 1) and 2)
  5. Add test function for testing the error in 3)

About the 3rd criterion, do I show the same error message when non pandas-like operations (either by typo such as hea() or by intention) are performed?

@edublancas
Copy link
Author

for 2) we can also mention they can call .PolarsDataFrame() to convert to polars

About the 3rd criterion, do I show the same error message when non pandas-like operations (either by typo such as hea() or by intention) are performed?

No, no need to cover typos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants