I have to ask for your help because I am frustrated now.
I am doing the Medical Data Visualizer and trying to run the solution, but it is failing constantly in the checking stage.
This is the failing line:
counta=df_cat.value_counts([‘cardio’,‘varios’,‘value’]) (using value counts with those three values I get the total amount per situation)
I use “value_counts” method to sum calculate the total amount and for some reason, I keep having the error ‘DataFrame’ object has no attribute ‘value_counts’"
But what is frustrating is that I have tested this code on Visual Studio and Jupyter Notebook and it works!
Could it be a problem with the interpreter? Could be something else?
Kind regards and thank you in advance.
German Linares
Your code so far
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36
Challenge: Data Analysis with Python Projects - Medical Data Visualizer
There was a similar post recently and you have the same problem with your dependencies. This error is due to numpy not being installed. It works locally presumably because you have numpy installed locally. The solution is the same; set your python version to 3.8 or better (on repl.it) and use the packager tool to uninstall everything except seaborn, which will pull everything else in as dependencies.
Once you get numpy, you still have several other issues with the code to fix it appears.
Quick update:
I have uninstalled numpy and resinstalled it again (version upgrade from 1.17 to 1.23) but it still does not work.
Also I read an error message before which I had not noticed before (it was running some poetry file)
"–> python3 -m poetry add numpy
Using version ^1.23.2 for numpy
Updating dependencies
Resolving dependencies…
SolverProblemError
The current project’s Python requirement (>=3.7,<4.0) is not compatible with some of the required packages Python requirement:
- numpy requires Python >=3.8, so it will not be satisfied for Python >=3.7,<3.8
Because no versions of numpy match >1.23.2,<2.0.0
and numpy (1.23.2) requires Python >=3.8, numpy is forbidden.
So, because root depends on numpy (^1.23.2), version solving failed."
I don’t understand what this really means as the console is telling me the Python version is: 3.8.12, not 3.7
The python version I’m referring to is in the poetry configuration (pyproject.toml) and is independent of the actual interpreter version during poetry’s solving phase where it’s just checking dependencies.
Yesterday I forked your project, made the changes to pyproject.toml indicated and uninstalled all the packages via repl.it’s packaging system (it’s a poetry front-end anyway; it’s the cube icon, third from the top on the left side menu on repl.it). Then I ran the project and repl.it ran poetry first and installed everything as it should be. The pyproject.toml file:
[tool]
[tool.poetry]
authors = ["Your Name <you@example.com>"]
name = "root"
version = "0.0.0"
description = ""
[tool.poetry.dependencies]
python = "^3.8"
seaborn = "*"
numpy = "^1.23.2"
The package menu shows seaborn 0.11.2 and numpy 1.23.2 installed. I believe you can remove the numpy line and numpy package as it should pull in as a seaborn dependency.
This allows me to run your code without the numpy error from earlier. You may have to remove all the packages and fix your pyproject.toml file to get a clean slate before it works. When I forked, there were multiple versions of several packages that appeared to be installed.