Self-Learn Python | Week 1
What do I want to learn?
- Identify what I want to learn
- Start off with a small project
What do I want to learn?
This is important whenever you are starting out to learn something. Without having at least a broad idea or contour of what we want to learn, we’ll quickly become overwhelmed by the amount of resources available, and the various methods to learn them. I had to be sure of what I want to learn. To be clear, this list can change later, based on new knowledge or circumstances. The important thing is to not overburden ourselves at the beginning. So, after some thought, I decided I want to learn the following.
- Econometric analysis: I’ve always used STATA for econometric analysis. As mentioned previously, it’s an insanely expensive piece of software, closed-source, and definitely not a viable long term solution for me personally.
- Data visualisation: Excel, Tableau etc. were tools that I’ve used earlier. Again, they are expensive, closed-source, and non-customisable.
- Web Scraping: My work at CivicDataLab is powered by publicly available data. Gaurav and Shreya are masters at mining data from the web. However, I’d like to pick up that skill.
How should I learn?
In my previous attempts at learning Python, I started off with Chapter 1 of Volume 1 of Book 1. That approach failed me (or rather I failed that approach). We don’t learn the alphabets before we start talking, do we? I wanted to get my hands dirty by trying something I’ve never done before. I decided that I’ll start by trying to scrape data from a website. A bit of Googling, and multiple different tutorials later, I was able to come up with the following.
My first web scraper
Arguably, this is one of the easiest, and most definitely a useless web-scraper. This merely gets me a list of all bandhus at my company, CivicDataLab, that we can easily get by just going to the website directly. However, it was also instructive in how to do basic scraping from static html sites.
There are a few issues that I’m grappling with
- I have not documented the code well. Need to add comments to explain the code better.
- I couldn’t figure out how to get all the following details (apart from the name) - Bio, Email ID, and other social media IDs.
- Finally, I still haven’t figured out how to export it into a .txt or .csv file.
Targets for next week
This was the only successful scraper that I could code after my first on-and-off python lesson. My target for the next weekend are as follows
- Add comments to explain code better
- Get all details of all Bandhus at CDL
- Export it into a CSV file
These are baby steps. I’m not in a hurry as well. I want to take it slow and steady.
Resources used for this lesson
The following online tutorials were used by me. I can’t vouch for their quality. However, they did help me make my first ever web scraper.