Re:Ask HN: I am a data analyst and my code is a mess
by elliott34 on Wednesday December 03, 2014 @03:02PM
(#8696013)
Definitely see what you're saying with the prepare_data1()...prepare_data(2). Maybe a more functional approach would be suitable. At the end of the day, data goes into a tunnel and comes out in a different form, into a machine learning model. So perhaps I should look at functional programming styles in python. Thanks!
Re:Ask HN: I am a data analyst and my code is a mess
by TheLoneWolfling on Wednesday December 03, 2014 @10:51AM
(#8694300)
Python has a built-in map. Reduce is in functools. Filter is in itertools.
Between builtins, itertools, and functools, you pretty much have it covered.
Re:Ask HN: I am a data analyst and my code is a mess
by elliott34 on Wednesday December 03, 2014 @03:07PM
(#8696042)
Excuse my ignorance here: so are these functional programming paradigms?
Re:Ask HN: I am a data analyst and my code is a mess
by TheLoneWolfling on Wednesday December 03, 2014 @03:45PM
(#8696238)
Generally speaking, yes.
(Look here: https://en.wikipedia.org/wiki/Higher-order_function#General_... )
- python probably has a lib like underscore (reduce map filter etc), could help
- check out the quake source code, any version, its huge and the entire thing is not only readable but possibley a work of art.
- have you tried lambdas? to some its more readable.. ex:
personally when i have too complex process i like to go more functional, ex: that allows me to focus on only on building one step and still have readable code.many game-devs prefer breaking their project into many tiny files with a specific purpose instead of spaghetti, ex:
its also a bit easier to nav around the project and make sense of it this way. you might want to check out rust or D or F or another lang also.