Introduction to Python#
Why learn Python?
Because everything. Python is used for scripting, building and scraping websites, and pretty much anything else where performance isn’t critical. It is also the de facto standard in data science and machine learning. It’s also comparatively easy to learn. Python is the new BASIC. What’s more, Python skills actually help on a resume.
Perhaps more importantly, neuroscientists have been increasingly transitioning to Python for about a decade. This process has only accelerated as neural data analysis becomes more complex, since complex analyses often rely on shared open source tools, and these tools are almost exclusively built in Python.
If you’re coming to Python from a different language and want a quick overview, I highly recommend Jake Vanderplas’s Whirlwind Tour of Python. It’s perhaps a little more than what many scientists need to know to get started, but it’s free and excellent. For data science, the Python Data Science Handbook is by far the best resource.
In the rest of this chapter, we’ll work through a series of basic exercises to get you familiar with Python’s ecoystem, syntax, and basic data structures.