import sklearn
Maybe I'm not understanding something fundamental here, and I just don't know what that may be. How should I go about debugging this?
messages_tfidf = tfidf_transformer.transform(messages_bow)
print messages_tfidf
That part works fine, as intended. But I run into trouble when I test my understanding of .head()
print messages_tfidf.head()
Outputs the error
AttributeError Traceback (most recent call last) 1 messages_tfidf = tfidf_transformer.transform(messages_bow) 2 print messages_tfidf ----> 3 print messages_tfidf.head()
AttributeError: head not found
Can someone help me understand my logical gap here?
Head is a function of pandas DataFrame.
You can do something like that:
import pandas as pd
dframe = pd.DataFrame(messages_tfidf)
dframe.head()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With