Tag Archives: programming

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 !

GIS Workshop – Intro to ModelBuilder I

GraphicOn Wednesday 6/22 starting at 10:30am will be part I of the Intro to ModelBuilder workshop. This will be a one hour hands-on workshop covering the basic concepts and best practices for working with ModelBuilder and how to create custom tools from models.

ModelBuilder is an application in ArcGIS used to create and edit models or workflows, stringing together geoprocessing tools. The models can either run in ModelBuilder, setup to run as a tool in ArcToolbox or even exported to a Python script.

All attendees must have some basic knowledge of ArcGIS, and at least know how to add data, save a project file (mxd), and access tools in ArcToolbox.

Workshop Registration

Python & Geoprocessing Workshop this Friday.

This Friday (4/17) between 10:30am – 1pm, EDS will host the new workshop ,”Introduction to Python & Geoprocessing.”  The workshop will be conducted by Sneha Rao from CIESIN.

The two and half hour workshop will give an overview of:
–     What is Geoprocessing?
–        Introduction to Python
–        Basic Data Types
–        Variables
–        Statements, Expressions and Functions
–        File Handling
–        Program Execution
–        Applying Python in Geoprocessing
–        Demo of Model Builder

There will be several examples and short hands-on exercises working with
Python 2.5 and a demo presentation of using scripts in Model Builder included in ESRI ArcMap
software.  Basic knowledge and understanding of GIS is recommended. The workshop is
meant for those without any programming/scripting experience or would like a refresher on
the basics. Register through the GIS Workshops page.