Created
January 17, 2018 00:02
-
-
Save anonymous/101822913cd0c36e769330796ec5b56e to your computer and use it in GitHub Desktop.
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
dfdata= [('cat01','t1', 50), ('cat01','t2',60) ,('cat01','t3',70),('cat02','t1', 60), ('cat02','t2', 80)] | |
df = pd.DataFrame.from_records(data=dfdata, columns=['cat','term','value']) | |
df | |
cat term value | |
0 cat01 t1 50 | |
1 cat01 t2 60 | |
2 cat01 t3 70 | |
3 cat02 t1 60 | |
4 cat02 t2 80 | |
v = np.vectorize(mydata, otypes=[mydata]) | |
v(df.term, df.value).tolist() | |
[entry(term='t1', val=50), | |
entry(term='t2', val=60), | |
entry(term='t3', val=70), | |
entry(term='t1', val=60), | |
entry(term='t2', val=80)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment