by Suf | May 14, 2022 | Pandas, Programming, Python, Tips
This error occurs when you try to access vectorized string methods using str on a pandas DataFrame instead of a pandas Series. Series.str() provides vectorized string functions for Series and Index. To solve this error, ensure that when you are assigning column names...
by Suf | May 13, 2022 | Programming, R, Tips
This tutorial will go through counting the number of missing values or NAs in a data frame in R. Table of contentsExampleGet Airquality DataSolution #1: Use summarySolution #2: Use sum and is.naSolution #3: Use sum and is.na in FunctionSummary Example Let’s look...
by Suf | May 13, 2022 | Programming, Python, Tips
If you attempt to call the values() method on a NumPy array, you will raise the error AttributeError: ‘numpy.ndarray’ object has no attribute ‘values’. The values() method belongs to the DataFrame object. This error typically occurs when trying to...
by Suf | May 12, 2022 | Programming, Python, Tips
This error occurs when you try to get the content from a RESTful API request with the requests library. The read() method does not belong to the response object, it is a File method. You can solve this error by using text to get the string representation of the...
by Suf | May 12, 2022 | Programming, Python, Tips
This error occurs when you try to use the Dictionary method get() to access values from a Response object. You can solve this error by converting the Response object to a JSON object. Once you have a JSON object, you can access values using the get() method. This...
by Suf | May 11, 2022 | Programming, Python, Tips
This error occurs when you try to close a string instead of a File object. You can solve this error by keeping the open() call separate from the read() call so that the file object and file contents are under different variable names. Then you can close the file once...