NameError
is a common error in Python that occurs when a variable or function name is not defined in the current scope. Some common reasons why this error might occur include:
- Misspelling the variable or function name
- Forgetting to define the variable or function before using it
- Using a variable or function outside of its scope
- Not importing the right module that contains the variable or function
It’s important to carefully check your code for any typos or missing definitions when encountering a NameError
.
📚 Discover Online Data Science Courses & Programs (Enroll for Free)
Introductory ⭐
- Harvard University Data Science: Learn R Basics for Data Science
- Standford University Data Science: Introduction to Machine Learning
- UC Davis Data Science: Learn SQL Basics for Data Science
- IBM Data Science: Professional Certificate in Data Science
- IBM Data Analysis: Professional Certificate in Data Analytics
- Google Data Analysis: Professional Certificate in Data Analytics
- IBM Data Science: Professional Certificate in Python Data Science
- IBM Data Engineering Fundamentals: Python Basics for Data Science
Intermediate ⭐⭐⭐
- Harvard University Learning Python for Data Science: Introduction to Data Science with Python
- Harvard University Computer Science Courses: Using Python for Research
- IBM Python Data Science: Visualizing Data with Python
- DeepLearning.AI Data Science and Machine Learning: Deep Learning Specialization
Advanced ⭐⭐⭐⭐⭐
- UC San Diego Data Science: Python for Data Science
- UC San Diego Data Science: Probability and Statistics in Data Science using Python
- Google Data Analysis: Professional Certificate in Advanced Data Analytics
- MIT Statistics and Data Science: Machine Learning with Python - from Linear Models to Deep Learning
- MIT Statistics and Data Science: MicroMasters® Program in Statistics and Data Science
🔎 Find Data Science Programs 👨💻 111,889 already enrolled
Disclaimer: Data Science Parichay is reader supported. When you purchase a course through a link on this site, we may earn a small commission at no additional cost to you. Earned commissions help support this website and its team of writers.
The following tutorials cover some of the common NameErrors in Python and how to resolve them with the help of some examples.
- How to Fix – NameError name ‘strftime’ is not defined
- How to Fix – NameError name ‘glob’ is not defined
- How to Fix – NameError name ‘exit’ is not defined
- How to Fix – NameError: name ‘pickle’ is not defined
- How to Fix – NameError: name ‘zipfile’ is not defined
- How to Fix – NameError: name ‘uuid’ is not defined
- How to Fix – NameError: name ‘inaugural’ is not defined
- How to Fix – NameError name ‘gutenberg’ is not defined
- How to Fix – NameError name ‘brown’ is not defined
- How to Fix – NameError name ‘webtext’ is not defined
- How to Fix – NameError name ‘wordnet’ is not defined
- How to Fix – NameError name ‘stopwords’ is not defined
- How to Fix – NameError name ‘os’ is not defined
- How to Fix – NameError name ‘nltk’ is not defined
- How to Fix – NameError name ‘plt’ is not defined
- How to Fix – NameError: name ‘itertools’ is not defined
- How to Fix – NameError: name ‘logging’ is not defined
- How to Fix – NameError: name ‘secrets’ is not defined
- How to Fix – NameError: name ‘string’ is not defined
- How to Fix – NameError: name ‘json’ is not defined
- How to Fix – NameError: name ‘heapq’ is not defined
- How to Fix – NameError: name ‘textwrap’ is not defined
- How to Fix – NameError: name ‘re’ is not defined
- How to Fix – NameError name ‘datetime’ is not defined
- How to Fix – NameError: name ‘array’ is not defined
- How to Fix – NameError: name ‘copy’ is not defined
- How to Fix – NameError: name ‘pprint’ is not defined
- How to Fix – NameError: name ‘statistics’ is not defined
- How to Fix – NameError: name ‘random’ is not defined
- How to Fix – NameError: name ‘math’ is not defined
- How to Fix – NameError: name ‘scipy’ is not defined
- How to Fix – NameError: name ‘numpy’ is not defined
- How to Fix – NameError: name ‘pandas’ is not defined