bug with SFrame.flat_map

User 690 | 1/2/2015, 10:31:29 AM

x=gl.SFrame({'a':range(15)}) y=x.flatmap(['a'],lambda x:[[x['a']]] if x['a']>9 else []) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/hdfs/graphlab/lib/python2.7/site-packages/graphlab/datastructures/sframe.py", line 2008, in flatmap raise TypeError("Mapped rows must have the same length and types") TypeError: Mapped rows must have the same length and types y=x.flatmap(['a'],lambda x:[[x['a']]] if x['a']>8 else [])

Comments

User 690 | 1/2/2015, 10:38:51 AM

It looks like there is a bug if the 9 entries returned from the function passed to SFrame.flatmap is an empty list, then flatmap crashes with the above error.


User 690 | 1/3/2015, 12:38:05 AM

Hi Brian, Do you notice that second example I gave does work and give expected results ! the only difference is that "9" has been replaced with "8". Thanks, Sunil.