When trying to run my code in GitPod I receive a ValueError for my y-axis value on the first figure. The problem seems to stem from Seaborn being unable to interpret my “total” column. I have attached a picture of my error below. I ran this exact code within VSCode and it outputs fine with no errors given.
Is there something incorrect about the way I went about renaming the column ? Or is the error something else?
Okay, I was able to find the guide for setting up a repo. I made a branch with my changes. The link to my github code is below. Please let me know if this works.
This is just a fork of the boilerplate, it’s empty:
# Import data
df = None
# Add 'overweight' column
df['overweight'] = None
# Normalize data by making 0 always good and 1 always bad. If the value of 'cholesterol' or 'gluc' is 1, make the value 0. If the value is more than 1, make the value 1.
# Draw Categorical Plot
def draw_cat_plot():
# Create DataFrame for cat plot using `pd.melt` using just the values from 'cholesterol', 'gluc', 'smoke', 'alco', 'active', and 'overweight'.
df_cat = None
# Group and reformat the data to
Did that link work? Please let me know if there is a guide somewhere on how to correctly share the code. Again, I apologize for all the trouble with this post.
However, here is my result running the same code using VScode (which is where I do all of my coding prior to copying it to GitPod). The code is the exact same between the two so I don’t know why it works locally on my PC but not in GitPod.
Here is a link to a “snapshot” of my workspace. If I am correct you should be able to open your own fresh copy of my workspace that is not linked and make any changes you deem necessary. Hopefully this overcomes the inactivity problem with the first link.
The versions are different between GitPod (1.5.3) and VScode (2.2.0). The requirements in the .txt file on GitPod are that Pandas be version 1.5.3 and seaborn be version 0.9.0. Given that, I opted to manually rename the columns and that did solve the initial problem and seaborn can now find the “total” column.
However, I am now given a new error regarding the “y” value that states numpy has no attribute ‘float’ (see image). I am not sure why since all of my values are int64 (except the variable names which are objects).
I attempted to manual set the type for ‘total’ to float and np.float64 and neither of those worked. I also attempted to upgrade numpy to the latest version, but when I did the terminal returns that the requirement is already satisfied.
I also tried to amend the requirements .txt to change seaborn and pandas version matching my VScode environment, and to upgrade python to 3.9. I was unable to get that to work.
Since the initial question was already answered, if it is best for me to mark that comment as the solution and to open up this question as a separate post please let me know. Thank you.
Read through the error message completely, the last sentences.
It sounds to me like the automated tests are using np.float but this was deprecated in numpy version 1.20. You may need to install an older version, instead of upgrading it.
Mine seems to work with 1.20.3. You can install it with this terminal command:
That allowed it to run. I am still receiving many errors that seem to be coming from the automated tests, but it does appear to at least complete all of the tests and output which ones were failed.
I think I can take it from here and troubleshoot on my own. If necessary, I can go through and rewrite parts of my code to be compatible with the versions being used. I appreciate the help!
Just remember that some errors might come from your code, but some errors might come from the tests. It could get a bit hairy but a careful reading of the errors will have a lot of information.
Lastly, you can still get some warnings or other messages about deprecation but still pass the tests. If it ends like this: