Author Archives: Kunal Baweja

Python Open Labs

In the penultimate session of Python Open Labs we had a brief review of csv concepts and XML parsing with BeautifulSoup Library.

A boiler plate code for practise can be obtained below from the Google Drive link, filed under Session-19 folder.

All of the course slides and examples are made available on: https://goo.gl/YP0c2E

Next week on April 21, I will going over the basic concepts and some practise problems from the python concepts that we looked into !

Python Open Labs – CSV Files

As we move towards the end of Spring semester, having covered most of the basics in Python, the recent sessions have been focusing on introducing python modules requested by attendees.

Last week had a second session on web-scraping with BeautifulSoup, I have updated the practice code for the same in Session-17 folder of the google drive link mentioned below.

This week, on April 7, 2017 I introduced the Python CSV module for reading and writing data from csv files. A very easy module primarily for reading CSV data, it requires the user to understand only a few of the details. The relevant sample code and a practise csv file can be found on the google drive link below, under Session-18 folder.

All of the course slides and examples are made available on: https://goo.gl/YP0c2E

Next week’s topic is XML file parsing !

See you next Friday from 1:30 PM – 3:30 PM at DSSC (Room – 215), Lehman Library at Columbia SIPA !

Python Open Labs – Web Scraping

For those who have been following this blog series, sorry for a late post on the updates about Python Open Labs.

Last week we covered some basics about web scraping with python, but before I start let me make a customary disclaimer.

Make sure that any of the websites that you want to scrape have granted you the required permissions to do so. Make sure you are not violating any terms of use by doing so.

So, getting along with the updates. In a nutshell web scraping can be described as a way of extracting useful relevant information from web pages i.e html pages. This can be abstracted into following steps:

  1. Downloading the web page content (user urllib or requests module in python)
  2. View page source in a web browser to examine the html structure of web page and locate information of interest for your task at hand
  3. Try to figure out the html structuring such as class, id, html tag etc that will help your python script locate the information.
  4. Use the beautifulsoup python module to parse and reach as close as possible to the relevant information in the html page structure and then extract the information using string methods.

The steps 2 – 4 go hand in hand, i.e one helps you build more upon the other. For example, the more you understand about the html structure surrounding your page the more specific inputs you can provide to beautifulsoup methods to extract out the information.

For the previous I have uploaded the sample python files with commented code lines on the Google Drive link mentioned below which you can access under Session – 16 folder. Make sure you work through those. Doubts, queries, feedbacks are always welcome 🙂

All of the course slides and examples are made available on: https://goo.gl/YP0c2E

We will be continuing with the web scraping lecture on march 31, 2017 after which I will also upload a comprehensive document with some additional relevant sources and more interesting code.

Happy Scraping !

See you next Friday from 1:30 PM – 3:30 PM at DSSC (Room – 215), Lehman Library at Columbia SIPA !

Python Open Labs – Format Strings

Hi

In the 15th session of Python Open Labs, this week we looked at some miscellaneous topics and revision of basic concepts of file reading and string handling from previous sessions. We also briefly looked into format strings / format specifiers for string construction in Python. The relevant slides are available on the Session – 15 folder on the google drive link mentioned below.

All of the course slides and examples are made available on: https://goo.gl/YP0c2E

As always, please keep up with your programming practise, a suggested link for the same is: https://www.hackerrank.com/domains/python/py-introduction

See you next Friday from 1:30 PM – 3:30 PM at DSSC (Room – 215), Lehman Library at Columbia SIPA ! We will be covering some basics about web scraping.

Python Open Labs – Object Oriented Programming

Hi

In this session we looked at simple concepts of object oriented programming, including the basics of creating classes, object instances, attributes and methods.

All of the course slides and examples are made available on: https://goo.gl/YP0c2E

Meanwhile, continue to practise and brush up your skills on: https://www.hackerrank.com/domains/python/py-introduction

See you next Friday from 1:30 PM – 3:30 PM at DSSC (Room – 215), Lehman Library at Columbia SIPA !

Python Open Labs – Session 12 (Review)

Hi

Today we had a brief review session of all the basics of programming that we have covered so far in the Python Open Labs series. During this review we went over reading and writing files, conditional statements, for loops and while loops and various other specifics of programming with Python. This marks a major milestone in the series as all of the material covered so far should be sufficient for basic programming/scripting tasks that you may need

All of the course slides are made available on: https://goo.gl/YP0c2E

Meanwhile, continue to practise and brush up your skills on: https://www.hackerrank.com/domains/python/py-introduction

In the next session I will introduce Object Oriented Design with Python.

For those who are getting started with Python, please watch this space for a concise blog post on basics of Python Installation, IDE set up etc in the coming week !

See you next Friday from 1:30 PM – 3:30 PM at DSSC (Room – 215), Lehman Library at Columbia SIPA !

Link

Hi

 

In this session of Python Open Labs we looked at python dictionaries, one of the most powerful data types built into python, optimal for storing in-memory look up tables for fast lookups and search queries.

In the next session we will go through some of the previous concepts as revision and introduce Object Oriented Design with Python.

All of the course slides are made available on: https://goo.gl/YP0c2E

Meanwhile, continue to practise and brush up your skills on: https://www.hackerrank.com/domains/python/py-introduction

For those who are getting started with Python, please watch this space for a concise blog post on basics of Python Installation, IDE set up etc in the coming week !

See you next Friday from 1:30 PM – 3:30 PM at DSSC (Room – 215), Lehman Library at Columbia SIPA !

Python Open Labs – Revisiting Session 1

Hi

Welcome back to Python Open Labs at DSSC (Lehman Library, SIPA). This semester we will be moving ahead with our weekly lecture-cum-practise open labs on Python so do join us on Fridays every week from 1:30 PM – 3:30 PM.

In the first session for Spring 2017 semester we revisited some of the concepts on arithmetic operations, conditional statements, assignments statements, operators and basic control flow and function definitions which we had covered in first five sessions of Python Open Labs in Fall 2016 series.

All of the course slides are made available on: https://goo.gl/YP0c2E

I further encourage you to practice various topics online on: https://www.hackerrank.com/domains/python/py-introduction

For those who are getting started with Python, please watch this space for a concise blog post on basics of Python Installation, IDE set up etc in the coming week !

See you next Friday !

Python Open Labs – Session 9

Hi Everyone

Hope you all had a great thanksgiving !

Today we had the last session of Python Open Labs for Fall 2016 at the DSSC. We will be continuing with the same through the next semester, so do watch this space for further announcements on schedule or free feel to shoot me a mail.

In today’s session we covered lists in python, working around various possibilities of accessing, creating and modifying lists. Please checkout the lecture slides and practice !!

Lecture slides (all open labs): https://goo.gl/YP0c2E

I further encourage you to practice various topics online on: https://www.hackerrank.com/domains/python/py-introduction

Thanks !

See you next semester

Python Open Labs – Session 7

Strings form an important data type in any programming language, especially involving text, processing files such as log files, articles etc. Python provides a string as a built-in data type supported with strong library functions that we looked at in today’s session.

The course material for the same can be accessed on: https://goo.gl/YP0c2E

Next week we will move ahead with handling files in python and extracting data from text files, so knowing strings before that class will come in really handy to get you up to speed.

See you next Friday, November 18th at 11:00 AM at DSSC Lehman Library 🙂