Turns out my version doesn't look like a Haskell module! However I do think it is more readable. It looks more like an exploratory exercise, and one can omit steps and see the broken results. I initially tried doing that with your tutorial, and that's where I found the most trouble. Also, folium's API seems to change often (at least twice since you wrote your notebook). This will work with the latest in PyPI.
If I really wanted to make it functional, I would move the pure functions up and group the mutations into a big function that would poop the final object for (a) display within Jupyter and (b) saving the HTML file. Or else group mutations in smaller functions that would accept an object as an argument and poop out a copy (as in pd.DataFrame.copy()) of the object with the mutations. This is very important, as I think I noticed you were mutating DataFrames within your functions without first copying them. Not mutating objects is good hygiene. Copying and then creating a new version with the desired changes is allowed.
Hi, Andrew.
Turns out my version doesn't look like a Haskell module! However I do think it is more readable. It looks more like an exploratory exercise, and one can omit steps and see the broken results. I initially tried doing that with your tutorial, and that's where I found the most trouble. Also, folium's API seems to change often (at least twice since you wrote your notebook). This will work with the latest in PyPI.
If I really wanted to make it functional, I would move the pure functions up and group the mutations into a big function that would poop the final object for (a) display within Jupyter and (b) saving the HTML file. Or else group mutations in smaller functions that would accept an object as an argument and poop out a copy (as in
pd.DataFrame.copy()
) of the object with the mutations. This is very important, as I think I noticed you were mutating DataFrames within your functions without first copying them. Not mutating objects is good hygiene. Copying and then creating a new version with the desired changes is allowed.Anyway, hope you find it useful,
Daniel.