namebrandon / Sparkov_Data_Generation

Synthetic Credit Card Transaction Generator used in the Sparkov program.
MIT License
141 stars 64 forks source link

bugfix: cities random lookup, age_gender lookup #5

Closed streamnsight closed 2 years ago

streamnsight commented 2 years ago

Using random in the lambda or list comprehension means a new random number is generated for each key of the object as we iterate over them. This is not what we want if we want to find the closest key to the random number

It is also very slow. So this 2 changes have the following effect:

Note 1 : the commented code was close, but wrong. My guess is the more complex code was written as a workaround, so this is the fix for it.

namebrandon commented 2 years ago

Awesome, much apprecaited!