Graphlab SFrame constructor converting NumPy S1 dtype to int

User 5150 | 4/26/2016, 8:45:56 AM

Cross posted from here.

Here is an example:

import graphlab as gl
import numpy.random as npr    
npr.choice(['a', 'b', 'c', 'd'], size = 100, replace=True).dtype
df_so = gl.SFrame({"col1": npr.randint(low = 1, high = 3, size = 100), 
               "col2": npr.randint(low = 1, high = 10, size = 100), 
               "col3": npr.choice(['a', 'b', 'c', 'd'], size = 100, replace=True)})
df_so.column_types

I would like to understand:

  • why?
  • if there is a way to prevent this.

Comments

User 16 | 4/27/2016, 1:10:09 AM

Hi @tchakravarty -

Where are you seeing the NumPy S1 dtype?

In [1]: import graphlab as gl In [2]: import numpy.random as npr In [3]: col1 = npr.randint(low = 1, high = 3, size = 100) In [4]: col2 = npr.randint(low = 1, high = 10, size = 100) In [5]: col3 = npr.choice(['a', 'b', 'c', 'd'], size = 100, replace=True) In [6]: print(col1.dtype, col2.d, col3) In [7]: sf = gl.SFrame({'col1': col1, 'col2': col2, 'col3': col3}) This commercial license of GraphLab Create is assigned to engr@dato.com. 2016-04-26 18:05:46,816 [INFO] graphlab.cython.cy_server, 176: GraphLab Create v1.9 started. Logging: /tmp/graphlab_server_1461719146.log In [10]: sf.column_types() Out[10]: [int, int, str]

I'm not seeing a S1 dtype and all the type conversion look good to me.


User 5150 | 4/27/2016, 5:51:50 AM

@Toby, @EvanSamanas said something similar on SO, and I have posted my environment there. It is a brand new installation of Anaconda and GL, so not sure how I am getting the results that I am getting. I will post the output in my environment in some time.