nameerror: name plot_cases_simple is not defined error is a generic name error. Here plot_cases_simple is just a placeholder. This place holder can be a function name, variable name, or Python module. In this article, we will resolve this error in a generic way by putting plot_cases_simple as a dummy name. Let’s start !!
nameerror: name plot_cases_simple is not defined ( Solution ) –
As I already explained at the start. There are three possible scenarios with nameerror exception –
Case 1 : Due to undefined variable ( plot_cases_simple ) –
Suppose you are using any variable plot_cases_simple that you have not already defined. You will get this error. Let’s practically see it –
print(plot_cases_simple)
If you run this directly at the interpreter, It will throw you the same error.

Here since we did not define this “plot_cases_simple ” and directly calling as a variable. This is why we are getting this error.

Again there we can use any variable name in the place of “plot_cases_simple”. The namerror will be the same and the solution will be generic.
Case 2: Due to undefined function( plot_cases_simple ) –
As a developer, we can create any user-defined function and call them. But in some practical scenarios, We forget to define them but we call them. Just like above, it will throw the same nameerror. The solution is also the same. We have to first define the function plot_cases_simple(). Then call it. This is also again generic, You can choose a different function name.
Case 3: Due to undefined module ( plot_cases_simple ) –
Sometimes we write code in modules and whenever we need them, we import them. But for importing, It should present in the correct path with the correct name. If we mistake there, We will get this error. All we need to be careful with relative imports.
I think now we can easily fix the above error.
Thanks
Data Science Learner Team
Join our list
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.