Is there a faster way to find the length of the longest string in a Pandas DataFrame than what\'s shown in the example below?
import numpy as np
import panda
Just as a minor addition, you might want to loop through all object columns in a data frame:
for c in df:
if df[c].dtype == 'object':
print('Max length of column %s: %s\n' % (c, df[c].map(len).max()))
This will prevent errors being thrown by bool, int types etc.
Could be expanded for other non-numeric types such as 'string_', 'unicode_' i.e.
if df[c].dtype in ('object', 'string_', 'unicode_'):