Category Archives: Python

Data analysis and Visualization with Python

Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric Python packages. Pandas is one of those packages, and makes importing and analyzing data much easier. In this article, I have used Pandas to analyze data on Country Data.csv file from UN public Data Sets of a popular… Read More »

How to check if a string is a valid keyword in Python?

Defining a Keyword In programming, a keyword is a “reserved word” by the language which convey a special meaning to the interpreter. It may be a command or a parameter. Keywords cannot be used as a variable name in the program snippet. Keywords in Python:  Python language also reserves some of keywords that convey special… Read More »

Type Conversion in Python

Python defines type conversion functions to directly convert one data type to another which is useful in day to day and competitive programming. This article is aimed at providing the information about certain conversion functions. 1. int(a,base) : This function converts any data type to integer. ‘Base’ specifies the base in which string is if… Read More »

Graph Plotting in Python | Set 2

Graph Plotting in Python | Set 1  Subplots Subplots are required when we want to show two or more plots in same figure. We can do it in two ways using two slightly different methods. Method 1 Output: Let us go through this program step by step: plt.style.use(‘fivethirtyeight’) The styling of plots can be configured… Read More »

Python | sep parameter in print()

The separator between the arguments to print() function in Python is space by default (softspace feature) , which can be modified and can be made to any character, integer or string as per our choice. The ‘sep’ parameter is used to achieve the same, it is found only in python 3.x or later. It is… Read More »

Output of Python program | Set 5

Predict the output of the following programs: Program 1: Output: cool Explanation: There is a docstring defined for this method, by putting a string on the first line after the start of the function definition. The docstring can be referenced using the __doc__ attribute of the function. And hence it prints the indexed string. Program… Read More »

Working with zip files in Python

This article explains how one can perform various operations on a zip file using a simple python program. What is a zip file? ZIP is an archive file format that supports lossless data compression. By lossless compression, we mean that the compression algorithm allows the original data to be perfectly reconstructed from the compressed data.… Read More »

Graph Plotting in Python | Set 1

This series will introduce you to graphing in python with Matplotlib, which is arguably the most popular graphing and data visualization library for Python. Installation Easiest way to install matplotlib is to use pip. Type following command in terminal: pip install matplotlib OR, you can download it from here and install it manually. Getting started… Read More »

Working with csv files in Python

This article explains how to load and parse a CSV file in Python. First of all, what is a CSV ? CSV (Comma Separated Values) is a simple file format used to store tabular data, such as a spreadsheet or database. A CSV file stores tabular data (numbers and text) in plain text. Each line… Read More »

GET and POST requests using Python

This post discusses two HTTP (Hypertext Transfer Protocol) request methods  GET and POST requests in Python and their implementation in python. What is HTTP? HTTP is a set of protocols designed to enable communication between clients and servers. It works as a request-response protocol between a client and server. A web browser may be the client,… Read More »

Programs for printing pyramid patterns in Python

Patterns can be printed in python using simple for loops. First outer loop is used to handle number of rows and Inner nested loop is used to handle the number of columns. Manipulating the print statements, different number patterns, alphabet patterns or star patterns can be printed. Some of the Patterns are shown in this… Read More »