
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 10476 Articles for Python

926 Views
Introduction..What is your most favorite chart type ? If you ask this question to management or a business analyst, the immediate answer is Pie charts!. It is a very common way of presenting percentages.How to do it..1. Install matplotlib by following command.pip install matplotlib2. Import matplotlibimport matplotlib.pyplot as plt3. Prepare temporary data.tennis_stats = (('Federer', 20), ('Nadal', 20), ('Djokovic', 17), ('Murray', 3), )4. Next step is to prepare the data.titles = [title for player, title in tennis_stats] players = [player for player, title in tennis_stats]5. Create the pie chart with the values as titles and labels as player names.autopct parameter - ... Read More

870 Views
Introduction..Scatter-plot are very useful when representing the data with two dimensions to verify whether there's any relationship between two variables. A scatter plot is chart where the data is represented as dots with X and Y values.How to do it..1. Install matplotlib by following command.pip install matplotlib2. Import matplotlibimport matplotlib.pyplot as plt tennis_stats = (('Federer', 20), ('Nadal', 20), ('Djokovic', 17), ('Sampras', 14), ('Emerson', 12), ('laver', 11), ('Murray', 3), ('Wawrinka', 3), ('Zverev', 0), ('Theim', 1), ('Medvedev', 0), ('Tsitsipas', 0), ('Dimitrov', 0), ('Rublev', 0))3. Next step is to prepare the data in any array format. We can also read the data from ... Read More

2K+ Views
Introduction...I will show you couple of methods to extract require data/fields from structured strings. These approaches will help, where the format of the input structure is in a known format.How to do it..1. Let us create one dummy format to understand the approach.Report: - Time: - Player: - Titles: - Country: Report: Daily_Report - Time: 2020-10-16T01:01:01.000001 - Player: Federer - Titles: 20 - Country: Switzerlandreport = 'Report: Daily_Report - Time: 2020-10-10T12:30:59.000000 - Player: Federer - Titles: 20 - Country: Switzerland'2. First thing I noticed from the report is the seperator which is "-". We will go ahead ... Read More

469 Views
Introduction...Being a Data Engineering specialist, I often receive test results from testers in Microsoft word. Sigh! they put so much information into word document right from capturing screen shots and very big paragraphs.Other day, I was asked by testing team to help them with a program to insert the tool generated Text and images (taken by automatic screen shots. Not covered in this article).MS Word document unlike others doesn't have the concept of a page, as it works in paragraphs unfortunately.So we need to use breaks and sections to properly divide a document.How to do it..1. Go ahead and install ... Read More

2K+ Views
Problem:One of the most challenging taks for a data sceintist is to collect the data. While the fact is, there is plenty of data available in the web it is just extracting the data through automation.Introduction..I wanted to extract the basic operations data which is embedded in HTML tables from https://www.tutorialspoint.com/python/python_basic_operators.htm.Hmmm, The data is scattered in many HTML tables, if there is only one HTML table obviously I can use Copy & Paste to .csv file.However, if there are more than 5 tables in a single page then obviously it is pain. Isn't it ?How to do it..1. I will ... Read More

4K+ Views
Introduction...The main purpose of charts is to make understand data easily. "A picture is worth a thousand words" means complex ideas that cannot be expressed in words can be conveyed by a single image/chart.When drawing graphs with lot of information, a legend may be pleasing to display relevant information to improve the understanding of the data presented.How to do it..In matplotlib, legends can be presented in multiple ways. Annotations to draw attention to specific points are also useful to help the reader understand the information displayed on the graph.1. Install matplotlib by opening up the python command prompt and firing ... Read More

1K+ Views
Introduction..One of the biggest advantage of writing an API is to extract current/live data, even when the data is rapidly changing, an API will always get up to date data. API programs will use very specific URLs to request certain information e.g. Topp 100 most played songs of 2020 in Spotify or Youtube Music. The requested data will be returned in an easily processed format, such as JSON or CSV.Python allows the user to write API calls to almost any URL you can think of. In this example I will show how to extract API results from GitHub and visualize ... Read More

3K+ Views
Introduction..In this example, we will create a task queue that holds all the tasks to be executed and a thread pool that interacts with the queue to process its elements individually.We will begin with the question, what is a Queue?. A queue is a data structure that is a collection of different elements maintained in a very specific order. Let me explain by taking a real life example.Assume you stand in line to pay your grocery billat a grocery shop counter, (don't ask me which grocery shop)In a line of people waiting to pay their bills, you will notice the ... Read More

819 Views
Problem..Assume you have a directory full of files with different formats, to search for a particular keyword.Getting ready..Install below packages.1. beautifulsoup42. python-docxHow to do it...1. Write a function to search for a string in CSV format. I will be using csv.reader module to go through the file and search for the string and return True when found else False.Exampledef csv_stringsearch(input_file, input_string): """ Function: search a string in csv files. args: input file , input string """ with open(input_file) as file: for row in csv.reader(file): for column in row: if input_string in column.lower(): return True return False2. Function to search a ... Read More

363 Views
Introduction..Sometimes, the programs require optional arguments when supplied will use them else go back to default declarations. We will see in this example on how to use them.The parameters that start with dashes (--) are identified as optional, so they can be left out, and they may have default values.Parameters that don’t start with dashes are positional and are usually required, so they do not have default values.How to do it...Exampleimport argparse parser = argparse.ArgumentParser(description='Optional Argument Example') parser.add_argument('-n', '--name', metavar='name', default='World', help='Say Hello to ') args = parser.parse_args() print(f"Hello {args.name}")The “metavar” will show up in the usage to describe the ... Read More