How can I take a string and create a data frame.
Let's say the string I have is the following.
ss = "This is a string"
If I do the following, it produced an error.
pd.DataFrame(ss)
Traceback (most recent call last):
File "<ipython-input-84-4694a8452254>", line 1, in <module>
pd.DataFrame(ss)
File "/Users/abrahammathew/anaconda3/lib/python3.6/site-packages/pandas/core/frame.py", line 404, in __init__
raise ValueError('DataFrame constructor not properly called!')
ValueError: DataFrame constructor not properly called!
However, if I try to create a series, it works.
pd.Series(ss)
Out[85]:
0 This is a string
dtype: object
pd.Series(ss).to_frame()pd.DataFrame([ss])