I have a Python3.x pandas DataFrame whereby certain columns are strings which as expressed as bytes (like in Python2.x)
import pandas as pd df = pd.DataFrame
Combining the answers by @EdChum and @Yu Zhou, a simpler solution would be:
for col, dtype in df.dtypes.items(): if dtype == np.object: # Only process byte object columns. df[col] = df[col].apply(lambda x: x.decode("utf-8"))