-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Misleading error message when an invalid y column name is provided to px.line #4040
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
Comments
Yes, we should definitely find a way to give you a better hint there that there's a typo in the contents of |
The reason it's tricky is that we land deep in that |
Hi, was exploring this issue a bit. So the build_dataframe function has another function is_col_list to check if the supplied argument for x/y is a list or not (hence wide-form) https://github.com/plotly/plotly.py/blob/master/packages/python/plotly/plotly/express/_core.py#L1339 Now this is_col_list function has a check inside it to see if a column is present in the dataframe, and if not it returns wide_mode as false. Here, in the is_col_list functionwe can catch the erroneous column name and give the user a more helpful error message. So I tried to make 2 changes,
Could anyone kindly provide any feedback if this seems like the right approach? |
When attempting to plot multiple y values using px.line (or similar), erroneous column names lead to a misleading error message that states that the length of the arguments is incorrect, when in fact the problem is that there the column name is wrong.
Simple to reproduce:
The text was updated successfully, but these errors were encountered: