Created
July 30, 2016 12:17
-
-
Save anonymous/4f1f04859977a028f44c506bc34e5f2d to your computer and use it in GitHub Desktop.
How to transform pandas table
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import reduce | |
mylist1 = data[['category', 'frequency']].values | |
mylist2 = reduce(lambda x,y: x+y, [reduce(lambda x,y: [x]*y, l) for l in mylist1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment