GSS-Cogs / databaker

Command line tool to convert spreadsheets to databases, made for the UK's Office for National Statistics.
Other
1 stars 0 forks source link

pass function to dimension constructor #27

Closed mikeAdamss closed 3 years ago

mikeAdamss commented 3 years ago

can we add an apply method to databaker dimension constructors, eg:

HDim(cells, "My Dim", CLOSEST, ABOVE, apply=my_function)

or even

HDim(cells, "My Dim", CLOSEST, ABOVE, apply=lambda x: x.strip())

So basically a databaker parallel of the pandas apply() function. I think it's both possible and relatively trivial and would allow us to make any string changes upstream (i.e before we pivot) which should be super efficient.

mikeAdamss commented 3 years ago

yeah was easy, have put it in pr: https://github.com/GSS-Cogs/databaker/pull/28

mikeAdamss commented 3 years ago

did it