appendix B On debugging ChatGPT’s code
Here is the full conversation leading to debugging the Generative AI-provided code.
B.1 Conversation recorded on April 3, 2023
I got the following error
"ValueError:
Could
not
interpret
input
'customer_state'"
. Can you please either correct the code (if it’s an error there) or propose some other library (if there is a chance that the error results from changes in how seaborn reads multi-indexed DataFrames)?
I apologize for the confusion. It seems the issue might be related to the column names or the structure of the
sales_by_region
DataFrame. To resolve this, let’s use the pivot_table()
function directly on the sales_by_region
DataFrame to create a new DataFrame with the necessary structure for the visualization. Then, we can use the updated column names with the seaborn library.
Here’s the updated code: