Category Archives: Python

Learning Model Building in Scikit-learn : A Python Machine Learning Library

Pre-requisite: Getting started with machine learning scikit-learn is an open source Python library that implements a range of machine learning, pre-processing, cross-validation and visualization algorithms using a unified interface. Important features of scikit-learn: Simple and efficient tools for data mining and data analysis. It features various classification, regression and clustering algorithms including support vector machines,… Read More »

NumPy in Python | Set 2 (Advanced)

NumPy in Python | Set 1 (Introduction) This article discusses some more and a bit advanced methods available in NumPy. Stacking: Several arrays can be stacked together along different axes. np.vstack: To stack arrays along vertical axis. np.hstack: To stack arrays along horizontal axis. np.column_stack: To stack 1-D arrays as columns into 2-D arrays. np.concatenate:… Read More »

File Objects in Python

A file object allows us to use, access and manipulate all the user accessible files. One can read and write any such files. When a file operation fails for an I/O-related reason, the exception IOError is raised. This includes situations where the operation is not defined for some reason, like seek() on a tty device… Read More »

NumPy in Python | Set 1 (Introduction)

This article will help you get acquainted with the widely used array-processing library in Python, NumPy. What is NumPy? NumPy is a general-purpose array-processing package. It provides a high-performance multidimensional array object, and tools for working with these arrays. It is the fundamental package for scientific computing with Python. It contains various features including these… Read More »

Looping Techniques in Python

Python supports various looping techniques by certain inbuilt functions, in various sequential containers. These methods are primarily verya useful in competitive programming and also in various project which require a specific technique with loops maintaining the overall structure of code. Where they are used ? Different looping techniques are primarily useful in the places where… Read More »

Twitter Sentiment Analysis using Python

This article covers the sentiment analysis of any topic by parsing the tweets fetched from Twitter using Python. What is sentiment analysis? Sentiment Analysis is the process of ‘computationally’ determining whether a piece of writing is positive, negative or neutral. It’s also known as opinion mining, deriving the opinion or attitude of a speaker. Why… Read More »

reduce() in Python

The reduce(fun,seq) function is used to apply a particular function passed in its argument to all of the list elements mentioned in the sequence passed along.This function is defined in “functools” module. Working :  At first step, first two elements of sequence are picked and the result is obtained. Next step is to apply the… Read More »

Working with Images in Python

PIL is the Python Imaging Library which provides the python interpreter with image editing capabilities. It was developed by Fredrik Lundh and several other contributors. Pillow is the friendly PIL fork and an easy to use library developed by Alex Clark and other contributors. We’ll be working with Pillow. Installation: Linux: On linux terminal type… Read More »

Graph Plotting in Python | Set 3

Graph Plotting in Python | Set 1 Graph Plotting in Python | Set 2 Matplotlib is a pretty extensive library which supports Animations of graphs as well. The animation tools center around the matplotlib.animation base class, which provides a framework around which the animation functionality is built. The main interfaces are TimedAnimation and FuncAnimation and… Read More »

XML parsing in Python

This article focuses on how one can parse a given XML file and extract some useful data out of it in a structured way. XML: XML stands for eXtensible Markup Language. It was designed to store and transport data. It was designed to be both human- and machine-readable.That’s why, the design goals of XML emphasize… Read More »

struct module in Python

This module performs conversions between Python values and C structs represented as Python bytes objects. Format strings are the mechanism used to specify the expected layout when packing and unpacking data. Module struct is available in Python 3.x and not on 2.x, thus these codes will run on Python3 interpreter. Struct Functions struct.pack() Syntax: struct.pack(format,… Read More »