0

Using Anaconda Spyder, Python 3.8.3, nltk 3.5. The code and output below:

from nltk.corpus import reuters
cfd = [('gas', word) for word in brown.words(categories='gas')]
print(cfd.tabulate(conditions=['gas'], samples=['gasoline', 'barrels']))

----------------
Output:
    gasoline  barrels 
gas       77       64 
None

How can I remove None from this output?

FYI - None is not in output when I use Jupyter notebook as below:

cfd = [('gas', word) for word in brown.words(categories='gas')]
cfd.tabulate(conditions=['gas'], samples=['gasoline', 'barrels']

----------------
Output:
    gasoline  barrels 
gas       77       64
vin
  • 1
  • 1
  • 5

1 Answers1

0

You don't need print to display the output. Just use

cfd.tabulate(conditions=['gas'], samples=['gasoline', 'barrels'])
help-info.de
  • 6,695
  • 16
  • 39
  • 41