Blog
How to Solve Python ValueError: unconverted data remains
If you want to format a datetime using datetime.strptime(), the format needs to match the original string. If there is a mismatch between the format and the original string, strptime will not be able to parse the string and will raise the ValueError: unconverted data...
How to Solve Python AttributeError: ‘DataFrame’ object has no attribute ‘concat’
A DataFrame is a two-dimensional, mutable tabular data structure like an Excel spreadsheet. If you want to concatenate pandas objects using the method concat(), you must use the built-in pandas method. DataFrame does not have concat as an attribute. If you try to call...
How to Convert a Tensor to a Numpy Array in TensorFlow
The simplest way to convert a TensorFlow Tensor to a Numpy array is to use the numpy() method. For example, numpy_array = tensor.numpy(). This tutorial will go through how to convert a TensorFlow Tensor to a NumPy array for both TensorFlow 2.x and 1.x with the help of...
How to Solve Python AttributeError: ‘DataFrame’ object has no attribute ‘unique’
A DataFrame is a two-dimensional, mutable tabular data structure like an Excel spreadsheet. If you want to find the unique values in a DataFrame using the method unique(), you must call the method on a Series object. If you try to call unique() on a DataFrame object,...
How to Solve Python AttributeError: Can only use .str accessor with string values!
The string accessor .str is an attribute of the Pandas Series class and provides functions to work with string data. If you try to use the .str accessor attribute on a column of a Pandas DataFrame or a Series and the values are not strings, you will raise the...
How to Solve Python AttributeError: ‘DataFrame’ object has no attribute ‘str’
A DataFrame is a two-dimensional, mutable tabular data structure like an Excel spreadsheet. If you want to use a string method on DataFrame, for example, using str.contains() to check if a DataFrame contains a specific string, you have to use the string accessor...
How to Solve Python AttributeError: ‘Series’ object has no attribute ‘strip’
In Python, a Pandas Series is a one-dimensional labelled array capable of holding data of any type. Pandas Series is the same as a column in an Excel spreadsheet. If you have string entries in a Series object that you want to strip of whitespace or specified...
How to Solve Sklearn ValueError: Unknown label type: ‘continuous’
There are two types of supervised learning algorithms: regression and classification. Classification problems require categorical or discrete response variables (y variable). If you try to train a scikit-learn imported classification model with a continuous variable,...
How to Solve Python AttributeError: ‘Series’ object has no attribute ‘to_datetime’
n Python, a Pandas Series is a one-dimensional labelled array capable of holding data of any type. Pandas Series is the same as a column in an Excel spreadsheet. If you have values in a Series that you want to convert to datetime, you cannot use to_datetime() directly...
How to Solve Python AttributeError: ‘Series’ object has no attribute ‘to_numeric’
In Python, a Pandas Series is a one-dimensional labelled array capable of holding data of any type. Pandas Series is the same as a column in an Excel spreadsheet. If you have a Series containing string values that you want to convert to numeric values, you cannot call...
Suf is a senior advisor in data science with deep expertise in Natural Language Processing, Complex Networks, and Anomaly Detection. Formerly a postdoctoral research fellow, he applied advanced physics techniques to tackle real-world, data-heavy industry challenges. Before that, he was a particle physicist at the ATLAS Experiment of the Large Hadron Collider. Now, he’s focused on bringing more fun and curiosity to the world of science and research online.