Search code examples
jupyter-notebookgraphlab

Getting long integers when running graphlab.text_analytics.count_words in ipython, how to remove that?


I want to remove these long integer from my solution, please suggest something.

for example when I ran this :

sa = graphlab.SArray(["The quick brown fox jumps."])
graphlab.text_analytics.count_words(sa)

my output was:

dtype: dict
Rows: 1
[{'quick': 1L, 'brown': 1L, 'the': 1L, 'fox': 1L, 'jumps.': 1L}]

I don't understand why I am getting output like this with a L added to the value of the keys.


Solution

  • Is there a reason you can't have long integers here?

    The reason the integers are "long" instead of "int" is that GraphLab Create stores all integers as 64-bit signed integers, but on Windows the maximum value of the "int" type in Python is 2^32-1, so the int gets converted to a long regardless of value.