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
Server Side Programming Articles - Page 1889 of 2650
1K+ Views
In this tutorial, we are going to learn to merge, join, and concat the DataFrames using pandas library. I think you are already familiar with dataframes and pandas library. Let's see the three operations one by one.MergeWe have a method called pandas.merge() that merges dataframes similar to the database join operations. Follow the below steps to achieve the desired output. Merge method uses the common column for the merge operation.Initialize the Dataframes.Call the method pandas.merge() with three arguments dataframes, how (defines the database join operation), on (common field of the dataframes).ExampleLet's see an example.# importing the pandas library import pandas # creating dataframes ... Read More
4K+ Views
Google provides a static maps API that returns a map image on our HTTP request. We can directly request for a map image with different parameters based on our need.We have to create a billing account on Google to use this API. You can go to the website for more details.Let's see the steps to get the image of a location.Import the requests module.Initialise your API Key and base URL ("https://maps.googleapis.com/maps/api/staticmap?").Initialize the city and zoom value.Update the URL with API Key, City, and Zoom value.USend an HTTP request. And write the response to a file for saving the image.pdate the ... Read More
9K+ Views
In this tutorial, we are going to get the weather of a city using OpenWeatherMap API. To use the OpenWeatherMap API, we have to get the API key. We will get it by creating an account on their website.Create an account and get your API Key. It's free until 60 calls per minute. You have to pay if you want more than that. For this tutorial, the free version is enough. We need requests module for the HTTP requests and JSON module to work with the response. Follow the below steps to the weather of any city.Import the requests and JSON ... Read More
20K+ Views
In this tutorial, we are going to write a program that finds the frequency of all the elements in an array. We can find it in different ways let's explore two of them.Using dictInitialize the array.Initialize an empty dict.Iterate over the list.If the element is not in dict, then set the value to 1.Else increment the value by 1.Print the element and frequencies by iterating over the dict.ExampleLet's see the code.# intializing the list arr = [1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3] # initializing dict to store frequency of each element elements_count = {} ... Read More
635 Views
In this tutorial, we are going to write a program that counts and prints the words with a higher frequency of an alphabet than the second one.Take a string and two alphabets. The prefixes with a higher frequency of the first alphabet will be printed. And display the count at the end of the output.Let's see some examples.Inputstring:- apple alphabets:- p, eOutputap app appl apple 4Inputstring:- apple alphabets:- e, pOutput0Let's see the steps to write the code.Define a function and write the code in it.Initialize count to 0 and an empty string.Iterate over the string.Get the prefix using the string ... Read More
125 Views
In this tutorial, we will be discussing a program to find the number of possible positions that can be reached by Modified Knight.For this we will be provided with a 8*8 chessboard. Our task is to find the number of positions Modified Knight can capture with the given number of steps.Example#include using namespace std; //finding the positions void findSteps(int current_row, int current_column, int curr, int board_size, int steps, int* visited){ //bound checking if (current_row >= board_size || current_row < 0 || current_column >= board_size || current_column < 0 || curr > ... Read More
246 Views
In this tutorial, we will be discussing a program to find the number of possible paths from top left to bottom right of a mXn matrix.For this we will be provided with a mXn matrix. Our task is to find all the possible paths from top left to bottom right of the given matrix.Example#include using namespace std; //returning count of possible paths int count_paths(int m, int n){ if (m == 1 || n == 1) return 1; return count_paths(m - 1, n) + count_paths(m, n - 1); } int main(){ cout
418 Views
In this tutorial, we will be discussing a program to find the number of paths between two vertices.For this we will be provided with a directed graph. Our task is to find the number of paths possible between two given vertices.Example#include using namespace std; //constructing a directed graph class Graph{ int V; list *adj; void countPathsUtil(int, int, bool [], int &); public: //constructor Graph(int V); void addEdge(int u, int v); int countPaths(int s, int d); }; Graph::Graph(int V){ this->V = V; adj ... Read More
204 Views
In this tutorial, we will be discussing a program to find the number of possible N digit numbers that satisfy the given condition.For this we will be provided with an integer. Our task is to check which one of number having N digits followNumber + Reverse(Number) = 10N -1Example#include using namespace std; //returning the count of numbers string count_num(int N){ if (N % 2 == 1) return 0; string result = "9"; for (int i = 1; i
241 Views
In this tutorial, we will be discussing a program to find the number of possible groups of size 2 or 3 that have sum as multiple of 3.In this tutorial, we will be discussing a program to find the number of possible groups of size 2 or 3 that have sum as multiple of 3.Example#include using namespace std; //returning count of pairs of //2 or 3 int count_groups(int arr[], int n){ int c[3] = {0}, i; int res = 0; for (i=0; i>1); res += c[1] * c[2]; res += (c[0] * (c[0]-1) * (c[0]-2))/6; ... Read More