Answers for "pandas recognize type from strings"

0

pandas recognize type from strings

import pandas as pd

df = pd.DataFrame({'A': [1, None, 'hello', True, 'world', 'mystr', 34.11]})

df['stringy'] = [isinstance(x, str) for x in df.A]

#        A stringy
# 0      1   False
# 1   None   False
# 2  hello    True
# 3   True   False
# 4  world    True
# 5  mystr    True
# 6  34.11   False
Posted by: Guest on July-07-2020

Code answers related to "pandas recognize type from strings"

Python Answers by Framework

Browse Popular Code Answers by Language