by Suf | Aug 7, 2022 | Programming, Python, Tips
A common error you may encounter when using Python is modulenotfounderror: no module named ‘mako’. This error occurs if you do not install mako before importing it into your program or installing the library in the wrong environment. You can install mako...
by Suf | Aug 7, 2022 | Programming, Python, Tips
A common error you may encounter when using Python is modulenotfounderror: no module named ‘parso’. This error occurs if you do not install parso before importing it into your program or installing the library in the wrong environment. You can install...
by Suf | Aug 7, 2022 | Programming, Python, Tips
This error occurs when you try to call the string method replace() on a File object. You can solve this error by reading the file to get a string and calling the replace() method on the file content. For example: with open(‘artists.txt’, ‘r’)...
by Suf | Aug 7, 2022 | Pandas, Programming, Python, Tips
This tutorial will go three ways to replace negative values with zero in a Pandas DataFrame. This simplest way to do it is: # Import pandas module import pandas as pd # Create pandas DataFrame df = pd.DataFrame({“X”: [4, 5, -3, 4, -5, 6], “Y”:...
by Suf | Aug 7, 2022 | Programming, Python, Tips
This error occurs when the Python interpreter cannot detect the Crypto.Cipher package in your current environment. You can solve this error by uninstalling crypto and pycrypto (if you have them installed) then install pycryptodome. For example, python3 -m pip...
by Suf | Aug 7, 2022 | Programming, Python, Tips
This error occurs when you try to fit a regression model to data but do not convert categorical variables to dummy variables before fitting. You can solve the error by using the pandas method get_dummies() to convert the categorical variable to dummy. For example,...