Don’t be a Hammer Looking for a Nail

“Would you tell me, please, which way I ought to go from here?”
“That depends a good deal on where you want to get to,” said the Cat.
“I don’t much care where—” said Alice.
“Then it doesn’t matter which way you go,” said the Cat.
“—so long as I get somewhere,” Alice added as an explanation.
“Oh, you’re sure to do that,” said the Cat, “if you only walk long enough.” 

— Lewis Carroll, Alice in Wonderland

One time I had an idea for something I wanted to find out and I quickly dove into figuring out how I could do it in Python, because it was new to me and therefore flashy. After a couple of hours, I finished the task and got my results – and realized that I could have gotten the same results in a few minutes with Excel. I had fallen into the temptation of starting with the tool rather than starting with the problem and determining which tool is best to solve it.

My mistake was that I didn’t think carefully about the end result I was seeking – if I had, I would have realized there was a better way to get there. Now, sometimes there is a case for investing a lot of time up front with a new tool, in order to get through the learning curve and make it faster in the future. This wasn’t one of those cases.

Photo by Silvia Fang on Unsplash

Start with the problem, and figure out your method for solving it, not the other way around. Take a little time to plan your journey and you’ll be happier with where you end up.

How a city planner got started coding in Python

As an urban planning student, I learned some great technical skills and software but I didn’t prioritize learning much about coding at the time. A couple of years ago, though, I was looking for a challenge and started hearing about how learning to code could help me automate boring workflows, analyze data, customize my GIS maps. I figured it would be a fun thing to try, even if I didn’t know exactly what I would do with that knowledge. I am glad I did.

Photo by AltumCode on Unsplash

If you’re interested in getting started yourself, here’s what I did:

  • I took the first three courses of the “Python for everybody” specialization on Coursera. This was a great introduction to writing code, and I learned a lot of Python basics this way. You can audit the course for free and watch all the videos, or pay $49/month for access to quizzes and assignments, which will deepen your learning.
  • I then took a free data science bootcamp prep course online through the Flatiron School. Though it assumed no prior experience with Python, it was worth starting from the beginning because it filled in some gaps in my knowledge. This was a great introduction to Jupyter notebooks, a more interactive coding method, and their applications to data science specifically. I did not actually take the bootcamp itself, opting instead to see what else I could learn on my own.

Though it was tempting to just keep taking courses and learning, I felt at this point that it was time to start a project so I could apply what I was learning. I’ve heard it recommended that you do this as soon as possible.

I thought about what kind of data would be interesting to analyze. I looked around at the City of Seattle’s Open Data portal and found a dataset of pedestrian and bicycle counts at a local park which interested me, because I am a transportation planner. If you Google “open data” + your city’s name, you will probably find something similar.

The City of Seattle’s open data portal. Credit: City of Seattle

The courses I had taken helped me know where to start, but I still spent a great deal of time googling how to do things. Stack Overflow is a forum specific to coding questions and was a life-saver. Usually, when you have a question, somebody else has already asked it and other commenters often offer sample code that you can copy and use yourself.

I am still working on the project, and perhaps will always be improving it, but I publish my progress here on Github, a website for people to share their code. I also watched a video or two about how to use this site, as it’s an important way to get and share information with others.

As I look back, learning Python has not quite been what I expected. Here’s a slightly snarky graph that sums it up, with the code below.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

As I’ve continued learning, some other resources have been helpful as well:

  • The Planetizen course on Coding for Planners
  • Towards Data Science has been a good source of instruction and sample code for various problems I’ve faced, though the quality of the articles varies.
  • Mustafa Rezazada shared on LinkedIn that the EdX course Using Python for Research, offered through Harvard, was a great resource as well.

Not convinced that Python can add value to your work? My grad school friend Autumn Florek notes that the data analysis capabilities are great for cleaning up spatial data prior to mapping. In her example, she analyzed assessed values compared to market values of real estate parcels. Perhaps I’ll do another series on applications of Python for planners.

What resources have you found useful?

Reflecting on a Decade of Life-giving Detours

Growing up I had a lot of interests, but I have always loved math. In fifth grade I once spent an evening figuring out how to determine the measure of a polygon’s angles based on how many sides it has, and brought my math teacher an unsolicited page-long explanation the next day. It was fun for me, and my test scores backed it up.

Photo: Shutterstock

I’ve also always loved languages and cultures and had a heart for justice. Unfortunately, I had a misconception that math people sat hunched over crusty calculators all day while “people people” made the real difference in the world. Faced with this false choice, I shelved my calculus book after high school. I got a liberal arts degree and spent my first few years out of college teaching English to refugees, helping organize public housing residents, and running a tenants’ hotline in New York City. It stirred my heart, thickened my skin, and blew open my horizons. I loved being able to directly see the difference I was making. 

One of my English language classes in 2012

I never totally lost the itch, though, to be doing more of the thing I knew I was really good at. Have you ever had an itch like that? But I worried that I had missed the boat in college and could never make up for it. When I discovered transportation planning, I was relieved that it felt like the perfect way to blend a concern for social issues with analytical skills. Getting a master’s in the field helped, but I soon realized I still didn’t have the advanced quantitative skills I needed to really apply my natural strengths.

In pursuit of a challenge I taught myself to code in Python and dusted off old statistics notes. I hoped I could figure out how to apply these skills in transportation; I had no desire to join Big Tech. Last year I started seeking out people working at the intersection of data science and transportation. Somewhere in there, it clicked: I could both leverage my knowledge of transportation planning and do it in a more analytical career where I could help people make better use of transit data. And having experience in a specific industry could actually be a boost rather than a detour as I had feared. In a moment of clarity, I was finally able to articulate the niche I wanted at work. Now I just had to find it. 

I feel so fortunate that I didn’t have to look far: Last month I applied for and got an internal job where I am crunching numbers, conducting research and strategizing with others about how to improve data in transit. I have new energy as I continue to learn and build skills that are helping more people get to where they need to go. I have a lot to learn and will likely feel insufficient for a while. But I’m ok with that, because I finally feel on track.

My agency operates commuter rail, among other transit modes. Photo: Sound Transit

I sort of wish that I had figured this all out sooner, but then I’m not sure I would have traded any of my post-college adventures because they shaped me in unique ways. They were reroutes, not dead ends. I hope that if you are asking yourself what you should be doing, you have grace for yourself and also take the time to really listen if there is a voice in you that won’t go away. 

What’s your story? Maybe you haven’t gotten to the good part yet. I know I’m privileged to have a positive story arc from the past year. Wherever you’re at, I encourage you to share your story as well and to keep us updated. Also, if my story resonates with you at all and you want to chat, please reach out!