AttributeError: 'list' object has no attribute 'isdigit'
<p>I want to extract POS in pandas. I do as below</p>

<pre><code>import pandas as pd
from nltk.tag import pos_tag
df = pd.DataFrame({'pos': ['noun', 'Alice', 'good', 'well', 'city']})
s = df['pos']
tagged_sent = pos_tag(s.str.split())
</code></pre>

<p>but get a traceback:</p>

<pre><code>Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "../lib/python2.7/site-packages/nltk/tag/__init__.py", line 111, in pos_tag
    return _pos_tag(tokens, tagset, tagger)
  File "../lib/python2.7/site-packages/nltk/tag/__init__.py", line 82, in _pos_tag
    tagged_tokens = tagger.tag(tokens)
  File "/Users/mjpieters/Development/venvs/stackoverflow-2.7/lib/python2.7/site-packages/nltk/tag/perceptron.py", line 152, in tag
    context = self.START + [self.normalize(w) for w in tokens] + self.END
  File "../lib/python2.7/site-packages/nltk/tag/perceptron.py", line 224, in normalize
    elif word.isdigit() and len(word) == 4:
AttributeError: 'list' object has no attribute 'isdigit'
</code></pre>

<p>What's wrong? </p>

<p>The expression <code>s.str.split()</code> is a <code>list</code> of strings, not a string (expected by <code>pos_tag</code>. Because <code>isdigit</code> is a method of <code>str</code>. </p>

python nltk pos-tagger