Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Server Side Programming Articles
Page 88 of 2109
Plotting the Growth Curve of Coronavirus in various Countries using Python
Explore the dynamic world of COVID-19 data through Python as we analyze and visualize the growth curve of the virus in different countries. This tutorial demonstrates how to process COVID-19 data, create interactive visualizations, and generate growth curve plots using Python libraries like pandas and plotly. Overview We will create an interactive graph to visualize the growth of total COVID-19 cases for any country. The program will also display available countries for selection. The dataset can be downloaded from https://ourworldindata.org/. Required Libraries First, let's import the necessary libraries ? import pandas as pd import ...
Read MorePrint all Subsequences of a String in Python
A subsequence is a sequence derived from another sequence by deleting some characters without changing the order of remaining elements. For string "abc", subsequences include "", "a", "b", "c", "ab", "ac", "bc", "abc". Python offers both recursive and iterative approaches to generate all subsequences. Understanding Subsequences A subsequence maintains the relative order of characters from the original string while allowing deletions. For string "India", some subsequences are "", "I", "In", "Ind", "India". A string of length n has exactly 2n subsequences (including the empty string). Recursive Approach The recursive method uses the principle that each character ...
Read MorePrimary and Secondary Prompt in Python
Python's interactive mode provides two types of prompts that enable developers to execute code dynamically. The primary prompt (>>>) indicates Python is ready to accept new commands, while the secondary prompt (...) appears when multi-line input is expected. The Primary Prompt (>>>) The primary prompt appears when you start Python's interactive interpreter. It signals that Python is ready to execute single-line statements or begin multi-line code blocks. Example print("Hello, World!") x = 10 y = 20 print(x + y) Hello, World! 30 The primary prompt provides immediate feedback, making it ...
Read MorePlay Sound in Python
Playing sound in Python can enhance applications with audio feedback, music, or sound effects. Python offers several libraries for audio playback, from simple solutions like playsound to more advanced options like pygame and pyglet. Using the playsound Library The playsound library provides the simplest way to play audio files with minimal setup. Install it using pip install playsound. Example Here's how to play a sound file using playsound − # Note: This requires an actual audio file to work from playsound import playsound # Provide the path to your sound file sound_file = ...
Read MorePlotting ICMR approved test centers on Google Maps using folium package
In the quest to combat the COVID-19 pandemic, accurate and accessible information about ICMR-approved test centers is crucial. This can be achieved using Python's folium package to create interactive maps showing test center locations. By combining geospatial data with interactive mapping capabilities, we can help individuals easily locate nearby testing facilities. This article demonstrates how to use the folium package to create dynamic maps, customize markers, and provide informative pop-ups for ICMR-approved test centers. What is Folium? The folium package is a Python library that creates interactive maps using the Leaflet.js JavaScript library. It provides a user-friendly ...
Read MorePython program to print words from a sentence with highest and lowest ASCII value of characters
ASCII (American Standard Code for Information Interchange) is a character encoding system that represents every character as a unique 7-bit binary code. ASCII values range from 0 to 127, where each character has a specific numerical representation. For example, the ASCII code for a space character is 32, and for digit '1' it is 49. In Python, you can find the ASCII code of a character using the ord() function, which takes a character as input and returns its ASCII value. For example, ord('A') returns 65. Problem Statement Given a string, find and print the words that ...
Read MoreHow to Count Unique Values Inside a List in Python?
Python lists are fundamental data structures, and counting unique values within them is a common task in data analysis and processing. This article explores four different approaches to count unique values in a Python list, each with its own advantages depending on your specific needs. Using a Set The simplest method leverages Python's set data structure, which automatically removes duplicates. Converting a list to a set eliminates duplicate values, and len() gives us the count of unique elements. Example # Sample list with duplicates numbers = [1, 2, 3, 3, 4, 5, 5, 6, 7, ...
Read MoreHow to Count the Number of Rows of a Given SQLite Table Using Python?
Counting the number of rows in an SQLite table is a common task in database management. Python's built-in sqlite3 module provides seamless tools for this purpose. In this article, we will explore how to efficiently count rows in an SQLite table using Python, enabling effective data analysis and manipulation. Prerequisites Python comes with sqlite3 built-in, so no additional installation is required. Simply import it in your script ? import sqlite3 Creating a Sample Database Let's first create a sample database with some data to work with ? import sqlite3 ...
Read MoreHow to Count the Number of Lines in a CSV File in Python?
Counting lines in a CSV file is a common task in data analysis. Python provides several approaches using Pandas, from simple DataFrame methods to file-level operations. Prerequisites First, ensure you have Pandas installed ? pip install pandas Sample CSV File Let's create a sample CSV file to work with ? import pandas as pd # Create sample data data = { 'Name': ['Alice', 'Bob', 'Charlie', 'Diana', 'Eve'], 'Age': [25, 30, 35, 28, 32], 'City': ['New York', 'London', 'Tokyo', ...
Read MoreHow to Convert Wide Dataframe to Tidy Dataframe with Pandas stack()?
Python has become one of the most popular programming languages for data analysis and manipulation, thanks to its rich libraries and frameworks. Among these libraries, Pandas stands out as one of the most valuable and powerful tools for data processing. With Pandas, you can easily load, transform, and analyze data in a wide variety of formats. In this tutorial, we will explore converting a wide dataframe to a tidy dataframe using the Pandas stack() function. Converting a wide dataframe to a tidy one is an essential step in many data analysis workflows, as it allows for easier data manipulation, ...
Read More