code-rag-bench/online-tutorials huggingface dataset:
Change Y-Axis to Percentage Points in ggplot2 Barplot in R - GeeksforGeeks

24 Jun, 2021
In this article, we will discuss how to change the Y-axis to percentage using the ggplot2 bar plot in R Programming Language.
First, you need to install the ggplot2 package if it is not previously installed in R Studio. To install and load write the below command in R Console :
install.packages("ggplot2")
library(ggplo2)
For creating a simple bar plot we will use the function geom_bar( ).
Syntax:
geom_bar(stat, fill, color, width)
Parameters :  
stat : Set the stat parameter to identify the mode.
fill : Represents color inside the bars.
color : Represents color of outlines of the bars.
width : Represents width of the bars.
First, we will create a Data Frame which has two vectors “letter” and “probability” and stores it in a variable prob.
R
# Insert Dataprob <- data.frame(letter = c("B1","B2","B3","B4","B5"),                   probability = c(0.5, 0.1, 0.2, 0.8, 0.3))  head(prob)
Let’s create a simple bar plot.
R
# Insert Plotlibrary("ggplot2")  dt <- ggplot(data=prob, aes(x=letter, y=probability)) +  geom_bar(stat = "identity")  dt
Some important keywords used are :
accuracy: The precision value to which a number is round to. scale: It is used for scaling the data. A scaling factor is multiplied with the original data value.labels: It is used to assign labels.
accuracy: The precision value to which a number is round to. 
scale: It is used for scaling the data. A scaling factor is multiplied with the original data value.
labels: It is used to assign labels.
The function used is scale_y_continuous( ) which is a default scale in “y-aesthetics” in the library ggplot2. Since we need to add percentages in the labels of the Y-axis, the keyword “labels” is used.
Now use scales: : percent to convert the y-axis labels into a percentage. This will scale the y-axis data from decimal to percentage. It simply multiplies the value by 100. The scaling factor is 100.
In the above code add :
R
# Changing Y-axis to percentagedt + scale_y_continuous(labels = scales::percent)
Output:
In older versions of R, using the above code you may get the percentage values having one digit after the decimal in the Y-axis as shown in the above example. In such a case, we will use the function percent_format( ) to modify the accuracy of the percentage labels in Y-axis. It is basically used to assign the precision value in order to round it.
Now, modify the above code into :
R
# Accuracy of y-axisdt + scale_y_continuous(labels = scales::percent_format(accuracy = 1))
Output:
Picked
R-ggplot
R Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Change Color of Bars in Barchart using ggplot2 in R
How to Change Axis Scales in R Plots?
Group by function in R using Dplyr
How to Split Column Into Multiple Columns in R DataFrame?
How to filter R DataFrame by values in a column?
Replace Specific Characters in String in R
How to filter R dataframe by multiple conditions?
R - if statement
How to import an Excel File into R ?
Time Series Analysis in R
How to get the Azure storage container blobs (files) using Azure CLI in PowerShell?

To get the azure storage container blobs using Azure CLI, we can use “az storage account” along with the blob commands. If you are not connected to the Azure cloud then use “az login” and set the proper subscription using “az account set” before running the storage commands.
To get access to the Azure storage account, we will use here storage connection string. In the below example, we are retrieving the connection string and store it into the variable.
$storageaccount = 'az204storage05june'
$connectionstring = az storage account show-connection-string -
n $storageaccount -otsv
Once we have the connection string available, we can retrieve the blobs (Files) stored in the container.
az storage blob list --container-name container1 --connectionstring $connectionstring -otable
Debugging ReactJS applications

While building a real-world application, the most important thing that a developer should know is how to properly debug the React application. There are many ways to debug our React application and some of the proven methods are explained below −
Tools like ESLint help to write better and clean codes, as it follows proper guidelines which prevent errors at the time of developing the codes.
This tool comes very handy while debugging ReactJS applications, as it allows to navigate through the Component Tree and allows to take a look at the state or the props or other data being passed to a component on the fly.
Note: For the production-ready code, it obfuscates the name of the components to enhance the security by default, but you can still view it by setting the displayName property to the component you want to have a look at.
It is the most powerful feature while debugging a React application. We can log any state, props or data at any point in the component and it will log that data in the console. You can add console.log() statement anywhere in the component and JSX, except for the objects and arrays.
App.jsx
import React from 'react';

import Name from './Name.js';

const App = () => (
   <div>
      <Name name="Rahul Bansal" />
   </div>
);
export default App;
Name.jsx
import React from 'react';

const Name = (props) => {
   return (
      <div>
      {console.log('Props: ', props)}
      Name: {props.name}
      </div>
   );
};
export default Name;
This will produce the following output −
Python – Skew-Normal Distribution in Statistics

10 Jan, 2020
scipy.stats.skewnorm() is a skew-normal continuous random variable. It is inherited from the of generic methods as an instance of the rv_continuous class. It completes the methods with details specific for this particular distribution.
Parameters :
q : lower and upper tail probabilityx : quantilesloc : [optional]location parameter. Default = 0scale : [optional]scale parameter. Default = 1size : [tuple of ints, optional] shape or random variates.moments : [optional] composed of letters [‘mvsk’]; ‘m’ = mean, ‘v’ = variance, ‘s’ = Fisher’s skew and ‘k’ = Fisher’s kurtosis. (default = ‘mv’).
Results : skew-normal continuous random variable
Code #1 : Creating skew-normal continuous random variable
# importing library  from scipy.stats import skewnorm     numargs = skewnorm .numargs a, b = 4.32, 3.18rv = skewnorm (a, b)     print ("RV : \n", rv) 
Output :
RV : 
 scipy.stats._distn_infrastructure.rv_frozen object at 0x000002A9D843A9C8

Code #2 : skew-normal continuous variates and probability distribution
import numpy as np quantile = np.arange (0.01, 1, 0.1)   # Random Variates R = skewnorm.rvs(a, b) print ("Random Variates : \n", R)   # PDF R = skewnorm.pdf(a, b, quantile) print ("\nProbability Distribution : \n", R) 
Output :
Random Variates : 
 4.2082825614230845

Probability Distribution : 
 [7.38229165e-05 1.13031801e-04 1.71343310e-04 2.57152477e-04
 3.82094976e-04 5.62094062e-04 8.18660285e-04 1.18047149e-03
 1.68525001e-03 2.38193677e-03]

Code #3 : Graphical Representation.
import numpy as np import matplotlib.pyplot as plt      distribution = np.linspace(0, np.minimum(rv.dist.b, 3)) print("Distribution : \n", distribution)      plot = plt.plot(distribution, rv.pdf(distribution)) 
Output :
Distribution : 
 [0.         0.04081633 0.08163265 0.12244898 0.16326531 0.20408163
 0.24489796 0.28571429 0.32653061 0.36734694 0.40816327 0.44897959
 0.48979592 0.53061224 0.57142857 0.6122449  0.65306122 0.69387755
 0.73469388 0.7755102  0.81632653 0.85714286 0.89795918 0.93877551
 0.97959184 1.02040816 1.06122449 1.10204082 1.14285714 1.18367347
 1.2244898  1.26530612 1.30612245 1.34693878 1.3877551  1.42857143
 1.46938776 1.51020408 1.55102041 1.59183673 1.63265306 1.67346939
 1.71428571 1.75510204 1.79591837 1.83673469 1.87755102 1.91836735
 1.95918367 2.        ]
  
Code #4 : Varying Positional Arguments
import matplotlib.pyplot as plt import numpy as np      x = np.linspace(0, 5, 100)      # Varying positional arguments y1 = skewnorm .pdf(x, 1, 3, 5) y2 = skewnorm .pdf(x, 1, 4, 4) plt.plot(x, y1, "*", x, y2, "r--") 
Output :
Python scipy-stats-functions
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Python Classes and Objects
Python OOPs Concepts
Introduction To PYTHON
How to drop one or multiple columns in Pandas Dataframe
Python | os.path.join() method
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
Python | Get unique values from a list
Python | datetime.timedelta() function
trunc() in Python

22 Jan, 2022
Truncate in Python
There are many built-in modules in python. Out of these module there is one interesting module known as math module which have several functions in it like, ceil, floor, truncate, factorial, fabs, etc.
Out of these functions there is an interesting function called truncate which behaves as a ceiling function for negative number and floor function for positive number.
In case of positive number 
Python3
# Python program to show output of floor(), ceil()# truncate() for a positive number.import mathprint (math.floor(3.5)) # floorprint (math.trunc(3.5)) # work as floorprint (math.ceil(3.5))  # ceil
Output:
3.0
3
4.0
In case of negative number 
Python3
# Python program to show output of floor(), ceil()# truncate() for a negative number.import mathprint (math.floor(-3.5)) # floorprint (math.trunc(-3.5)) # work as ceilprint (math.ceil(-3.5))  # ceil
Output:
-4.0
-3
-3.0
This is because the ceiling function is used to round up, i.e., towards positive infinity and floor function is used to round down, i.e., towards negative infinity.  
But the truncate function is used to round up or down towards zero.Diagrammatic representation of truncate function:-  
This article is contributed by Arpit Agarwal. If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to review-team@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above 
ASuresh
amartyaghoshgfg
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Different ways to create Pandas Dataframe
Enumerate() in Python
Read a file line by line in Python
Python String | replace()
How to Install PIP on Windows ?
*args and **kwargs in Python
Python Classes and Objects
Iterate over a list in Python
Python OOPs Concepts
HTML | loop Attribute

31 Aug, 2021
The HTML loop Attribute is used to restart the audio and video again and again after finishing it. It contains the Boolean value. 
Syntax:  
<element loop>
Applicable  
<audio>
<video>
<marquee>
<bgsound>
Example 1: Below Example illustrates the use of loop attribute in <audio> element.  
html
<!DOCTYPE html><html> <head>    <title>        Audio loop Attribute    </title></head> <body style="text-align: center">     <h1 style="color: green">    GeeksforGeeks</h1>    <h2 style="font-family: Impact">    HTML Audio loop Attribute</h2>    <br>     <audio id="Test_Audio"           controls loop>        <source src="beep.mp3"                type="audio/mpeg">    </audio></body> </html>
Output:  
Example 2: Below Example illustrates the use of loop attribute in <video> element.  
html
<!DOCTYPE html><html> <head>    <title>      HTML video loop Attribute  </title></head> <body>    <center>        <h1 style="color:green;">          GeeksforGeeks      </h1>         <h3>HTML video loop Attribute</h3>         <video width="400"               height="200"               controls loop>                       <source src="Canvas.move_.mp4"                    type="video/mp4">            <source src="Canvas.move_.ogg"                    type="video/ogg">        </video>    </center></body> </html>
Output:  
Supported Browsers: The browsers supported by loop Attribute are listed below:  
Google Chrome 4.0/4.0
Internet Explorer 9.0/9.0
Firefox 3.5/11.0
Apple Safari 4.0/4.0
Opera 10.5/10.5
 
hritikbhatnagar2182
HTML-Attributes
HTML
Web Technologies
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to update Node.js and NPM to next version ?
REST API (Introduction)
CSS to put icon inside an input element in a form
Types of CSS (Cascading Style Sheet)
HTTP headers | Content-Type
Installation of Node.js on Linux
Difference between var, let and const keywords in JavaScript
How to fetch data from an API in ReactJS ?
Remove elements from a JavaScript Array
Differences between Functional Components and Class Components in React
Function overloading and return type in C++

You can have multiple definitions for the same function name in the same scope. The definition of the function must differ from each other by the types and/or the number of arguments in the argument list. You cannot overload function declarations that differ only by return type.
The function overloading is basically the compile time polymorphism. It checks the function signature. If the signatures are not same, then they can be overloaded. The return type of a function does not create any effect on function overloading. Same function signature with different return type will not be overloaded.
Following is the example where same function print() is being used to print different data types
#include <iostream>
using namespace std;
class printData {
   public:
      void print(int i) {
         cout << "Printing int: " << i << endl;
      }
      void print(double f) {
         cout << "Printing float: " << f << endl;
      }
      void print(char* c) {
         cout << "Printing character: " << c << endl;
      }
};
int main(void) {
   printData pd;
   pd.print(5); // Call print to print integer
   pd.print(500.263); // Call print to print float
   pd.print("Hello C++"); // Call print to print character
   return 0;
}
Printing int: 5
Printing float: 500.263
Printing character: Hello C++
HTTP headers | Expect-CT - GeeksforGeeks

19 Nov, 2019
The HTTP Expect-CT header is a response-type header that prevents the usage of wrongly issued certificates for a site and makes sure that they do not go unnoticed and it also allows sites to decide on reporting or enforcement of Certificate Transparency requirements.
Syntax:
Expect-CT max-age=<age>, enforce, report-uri="<uri>"
Note: Enforce and report-uri are optional directives.
Directives: The HTTP Expect-CT header accepts three directives mentioned above and described below:
max-age:<age>: This directive tells the number of seconds for which the user should consider the Expect-CT host(from whom the message was received) after the reception of the Expect-CT header.
enforce: It is an optional directive which prompts the user to refuse further connections which do not comply with the Certificate Transparency(CT) policy and also enforces the policy.
report-uri:<uri>: It is an optional directive that describes the URL where the user can report the failure of the Expect-CT header.
Examples:
In this example, the Certificate Transparency is enforced for 12 hours and the reports are made to geeksforgeeks.org .Expect-CT: max-age=43200, enforce, report-uri="https://geeksforgeeks.org/report"
Expect-CT: max-age=43200, enforce, report-uri="https://geeksforgeeks.org/report"
In this example, the Certificate Transparency is enforced for an hour.Expect-CT: max-age=3600, enforceTo check the Expect-CT in action go to Inspect Element -> Network check the response header for Expect-CT like below, Expect-CT is highlighted.Supported browsers: The browsers are compatible with HTTP Expect-CT header are listed below:Google ChromeOperaMy Personal Notes
arrow_drop_upSave
Expect-CT: max-age=3600, enforce
To check the Expect-CT in action go to Inspect Element -> Network check the response header for Expect-CT like below, Expect-CT is highlighted.
Supported browsers: The browsers are compatible with HTTP Expect-CT header are listed below:
Google Chrome
Opera
HTTP-headers
Picked
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Roadmap to Become a Web Developer in 2022
How to fetch data from an API in ReactJS ?
Convert a string to an integer in JavaScript
Difference between var, let and const keywords in JavaScript
How to create footer to stay at the bottom of a Web page?
Differences between Functional Components and Class Components in React
How to redirect to another page in ReactJS ?
Remove elements from a JavaScript Array
JQuery | Set the value of an input text field
How to execute PHP code using command line ?
Split Space Delimited String and Trim Extra Commas and Spaces in JavaScript?

Let’s say the following is our string −
var sentence = "My,,,,,,, Name,,,, is John ,,, Smith";
Use regular expression along with split() and join() to remove extra spaces and commas.
Following is the code −
var sentence = "My,,,,,,, Name,,,, is John ,,, Smith";
console.log("Before removing extra comma and space="+sentence);
sentence = sentence.split(/[\s,]+/).join();
console.log("After removing extra comma and space=");
console.log(sentence)
To run the above program, you need to use the following command −
node fileName.js.
Here, my file name is demo133.js. This will produce the following output −
PS C:\Users\Amit\JavaScript-code> node demo133.js
Before removing extra comma and space=My,,,,,,, Name,,,, is John ,,, Smith
After removing extra comma and space=
My,Name,is,John,Smith
GATE | Gate IT 2005 | Question 78 - GeeksforGeeks

03 Sep, 2021
Consider the following message M = 1010001101. The cyclic redundancy check (CRC) for this message using the divisor polynomial x5 + x4 + x2 + 1 is :
 (A) 01110(B) 01011(C) 10101(D) 10110Answer: (A)Explanation:
M = 1010001101
Divisor polynomial: 1.x5 +1.x4+0.x3+1.x2+0.x2+1.x0   
Divisor polynomial bit= 110101
Bits to be appended to message= (divisor polynomial bits – 1) = 5
Append 5 zeros to message bits, modified message: 101000110100000

Now, divide and XOR the message with divisor polynomial bits. Make resultant reminder to 5 bit again and that is the CRC send along with the message.
This explanation has been contributed by Sandeep Pandey.
Please visit the following links to learn more on CRC and its calculation:
Wikipedia article: Cyclic Redundancy CheckGeeksforGeeks article: Error Detection | Computer NetworksQuiz of this Question
ruhelaa48
Gate IT 2005
GATE-Gate IT 2005
GATE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
GATE | Gate IT 2007 | Question 25
GATE | GATE-CS-2000 | Question 41
GATE | GATE-CS-2001 | Question 39
GATE | GATE-CS-2005 | Question 6
GATE | GATE MOCK 2017 | Question 21
GATE | GATE-CS-2006 | Question 47
GATE | GATE MOCK 2017 | Question 24
GATE | Gate IT 2008 | Question 43
GATE | GATE-CS-2009 | Question 38
GATE | GATE-CS-2003 | Question 90
Python - Poisson Discrete Distribution in Statistics - GeeksforGeeks

10 Jan, 2020
scipy.stats.poisson() is a poisson discrete random variable. It is inherited from the of generic methods as an instance of the rv_discrete class. It completes the methods with details specific for this particular distribution.
Parameters :
x : quantilesloc : [optional]location parameter. Default = 0scale : [optional]scale parameter. Default = 1moments : [optional] composed of letters [‘mvsk’]; ‘m’ = mean, ‘v’ = variance, ‘s’ = Fisher’s skew and ‘k’ = Fisher’s kurtosis. (default = ‘mv’).
Results : poisson discrete random variable
Code #1 : Creating poisson discrete random variable
# importing library  from scipy.stats import poisson     numargs = poisson .numargs a, b = 0.2, 0.8rv = poisson (a, b)     print ("RV : \n", rv)  
Output :
RV : 
 scipy.stats._distn_infrastructure.rv_frozen object at 0x0000016A4D865848

Code #2 : poisson discrete variates and probability distribution
import numpy as np quantile = np.arange (0.01, 1, 0.1)   # Random Variates R = poisson .rvs(a, b, size = 10) print ("Random Variates : \n", R)   # PDF x = np.linspace(poisson.ppf(0.01, a, b),                poisson.ppf(0.99, a, b), 10)R = poisson.ppf(x, 1, 3)print ("\nProbability Distribution : \n", R) 
Output :
Random Variates : 
 [0 0 1 0 1 0 0 1 0 0]

Probability Distribution : 
 [ 5. nan nan nan nan nan nan nan nan nan]


Code #3 : Graphical Representation.
import numpy as np import matplotlib.pyplot as plt      distribution = np.linspace(0, np.minimum(rv.dist.b, 2)) print("Distribution : \n", distribution)      plot = plt.plot(distribution, rv.ppf(distribution)) 
Output :
Distribution : 
 [0.         0.04081633 0.08163265 0.12244898 0.16326531 0.20408163
 0.24489796 0.28571429 0.32653061 0.36734694 0.40816327 0.44897959
 0.48979592 0.53061224 0.57142857 0.6122449  0.65306122 0.69387755
 0.73469388 0.7755102  0.81632653 0.85714286 0.89795918 0.93877551
 0.97959184 1.02040816 1.06122449 1.10204082 1.14285714 1.18367347
 1.2244898  1.26530612 1.30612245 1.34693878 1.3877551  1.42857143
 1.46938776 1.51020408 1.55102041 1.59183673 1.63265306 1.67346939
 1.71428571 1.75510204 1.79591837 1.83673469 1.87755102 1.91836735
 1.95918367 2.        ]
  
Code #4 : Varying Positional Arguments
import matplotlib.pyplot as plt import numpy as np   x = np.linspace(0, 5, 100)      # Varying positional arguments y1 = poisson.ppf(x, a, b) y2 = poisson.pmf(x, a, b) plt.plot(x, y1, "*", x, y2, "r--") 
Output :
Python scipy-stats-functions
Python-scipy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Read a file line by line in Python
How to Install PIP on Windows ?
Enumerate() in Python
Different ways to create Pandas Dataframe
Iterate over a list in Python
Python String | replace()
Reading and Writing to text files in Python
*args and **kwargs in Python
Create a Pandas DataFrame from Lists
C - Recursion

Recursion is the process of repeating items in a self-similar way. In programming languages, if a program allows you to call a function inside the same function, then it is called a recursive call of the function.
void recursion() {
   recursion(); /* function calls itself */
}

int main() {
   recursion();
}
The C programming language supports recursion, i.e., a function to call itself. But while using recursion, programmers need to be careful to define an exit condition from the function, otherwise it will go into an infinite loop.
Recursive functions are very useful to solve many mathematical problems, such as calculating the factorial of a number, generating Fibonacci series, etc.
The following example calculates the factorial of a given number using a recursive function −
#include <stdio.h>

unsigned long long int factorial(unsigned int i) {

   if(i <= 1) {
      return 1;
   }
   return i * factorial(i - 1);
}

int  main() {
   int i = 12;
   printf("Factorial of %d is %d\n", i, factorial(i));
   return 0;
}
When the above code is compiled and executed, it produces the following result −
Factorial of 12 is 479001600

The following example generates the Fibonacci series for a given number using a recursive function −
#include <stdio.h>

int fibonacci(int i) {

   if(i == 0) {
      return 0;
   }
	
   if(i == 1) {
      return 1;
   }
   return fibonacci(i-1) + fibonacci(i-2);
}

int  main() {

   int i;
	
   for (i = 0; i < 10; i++) {
      printf("%d\t\n", fibonacci(i));
   }
	
   return 0;
}
When the above code is compiled and executed, it produces the following result −
0	
1	
1	
2	
3	
5	
8	
13	
21	
34

 Print
 Add Notes
 Bookmark this page
Difference between prefix and postfix operators in C#?

The increment operator ++ if used as prefix on a variable, the value of variable gets incremented by 1. After that the value is returned unlike Postfix operator. It is called Prefix increment operator. In the same way the prefix decrement operator works but it decrements by 1.
For example, an example of prefix operator −
++a;
The following is an example demonstrating Prefix increment operator −
 Live Demo
using System;
class Program {
   static void Main() {

      int a, b;
      a = 50;
      Console.WriteLine(++a);

      b = a;
      Console.WriteLine(a);
      Console.WriteLine(b);
   }
}
51
51
51
The increment operator ++ if used as postfix on a variable, the value of variable is first returned and then gets incremented by 1. It is called Postfix increment operator. In the same way the decrement operator works but it decrements by 1.
An example of Postfix operator.
a++;
The following is an example showing how to work with postfix operator −
 Live Demo
using System;
class Program {
   static void Main() {

      int a, b;
      a = 10;
      Console.WriteLine(a++);

      b = a;
      Console.WriteLine(a);
      Console.WriteLine(b);
   }
}
10
11
11
Matplotlib.artist.Artist.set_picker() in Python - GeeksforGeeks

10 May, 2020
Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. The Artist class contains Abstract base class for objects that render into a FigureCanvas. All visible elements in a figure are subclasses of Artist.
The set_picker() method in artist module of matplotlib library is used to define the picking behavior of the artist.
Syntax: Artist.set_picker(self, picker)
Parameters: This method accept the following parameters as discussed below:
picker : This parameter is used to set picking behavior. This can be None or bool or float or function.
Returns: This method the picking behavior of the artist.
Below examples illustrate the matplotlib.artist.Artist.set_picker() function in matplotlib:
Example 1:
# Implementation of matplotlib functionfrom matplotlib.artist import Artistimport numpy as np import matplotlib.pyplot as plt          np.random.seed(19680801)   volume = np.random.rayleigh(27, size = 40) amount = np.random.poisson(7, size = 40) ranking = np.random.normal(size = 40) price = np.random.uniform(1, 7, size = 40)        fig, ax = plt.subplots()        scatter = ax.scatter(volume * 2,                       amount**3,                      c = ranking**3,                      s = price**3,                      vmin = -3,                      vmax = 3,                      cmap ="Spectral")     Artist.set_picker(ax, picker = 4)           fig.suptitle('matplotlib.artist.Artist.set_picker()\function Example', fontweight ="bold")   plt.show()
Output:
Example 2:
# Implementation of matplotlib functionfrom matplotlib.artist import Artistimport numpy as np import matplotlib.pyplot as plt       X = np.random.rand(10, 200) xs = np.mean(X, axis = 1) ys = np.std(X, axis = 1)     fig = plt.figure() ax = fig.add_subplot(111) line, = ax.plot(xs, ys, 'go-')     Artist.set_picker(ax, picker = True)           fig.suptitle('matplotlib.artist.Artist.set_picker()\ function Example', fontweight ="bold")   plt.show()
Output:
Matplotlib Artist-class
Python-matplotlib
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Python Dictionary
How to Install PIP on Windows ?
Read a file line by line in Python
Enumerate() in Python
Iterate over a list in Python
Different ways to create Pandas Dataframe
Python program to convert a list to string
Create a Pandas DataFrame from Lists
Python String | replace()
Reading and Writing to text files in Python
DAX Statistical - STDEVX.P function

Evaluates the given expression for each row of the given table and returns the standard deviation of expression assuming that the table refers to the entire population.
STDEVX.P (<table>, <expression>) 

table
A table or any DAX expression that returns a table of data.
expression
Any DAX expression that returns a single scalar value, where the expression is to be evaluated multiple times (for each row/context).
A real number.
DAX STDEVX.P function evaluates an expression for each row of table and returns the standard deviation of an expression assuming that the table refers to the entire population. If the data in the table represents a sample of the population, you should use DAX STDEVX.S function instead.
STDEVX.P uses the following formula −
$$\sqrt{\sum\frac{(x\:-\:\bar{x})^{2}}{N}}$$
Where, $\bar{x}$  the average value of $x$ for the entire population, and
N is the population size
Blank rows are filtered out from columnName and not considered in the calculation.
An error is returned if columnName contains less than 2 non-blank rows.
= STDEVX.P (Sales,[Sales Amount]) 

    53 Lectures 
     5.5 hours 

 Abhay Gadiya

    24 Lectures 
     2 hours 

 Randy Minder

    26 Lectures 
     4.5 hours 

 Randy Minder
 Print
 Add Notes
 Bookmark this page
C++ Program to Compute Combinations using Recurrence Relation for nCr

This is a C++ program to compute Combinations using Recurrence Relation for nCr.
Begin
   function CalCombination():
      Arguments: n, r.
      Body of the function:
      Calculate combination by using
      the formula: n! / (r! * (n-r)!.
End
#include<iostream>
using namespace std;
float CalCombination(float n, float r) {
   int i;
      if(r > 0)
         return (n/r)*CalCombination(n-1,r-1);
      else
   return 1;
}
int main() {
   float n, r;
   int res;
   cout<<"Enter the value of n: ";
   cin>>n;
   cout<<"Enter the value of r: ";
   cin>>r;
   res = CalCombination(n,r);
   cout<<"\nThe number of possible combinations are: nCr = "<<res;
}
Enter the value of n: 7
Enter the value of r: 6
The number of possible combinations are: nCr = 2
Biopython - Installation

This section explains how to install Biopython on your machine. It is very easy to install and it will not take more than five minutes.
Step 1 − Verifying Python Installation
Biopython is designed to work with Python 2.5 or higher versions. So, it is mandatory that python be installed first. Run the below command in your command prompt −
> python --version

It is defined below −
It shows the version of python, if installed properly. Otherwise, download the latest version of the python, install it and then run the command again.
Step 2 − Installing Biopython using pip
It is easy to install Biopython using pip from the command line on all platforms. Type the below command −
> pip install biopython

The following response will be seen on your screen −
For updating an older version of Biopython −
> pip install biopython –-upgrade

The following response will be seen on your screen −
After executing this command, the older versions of Biopython and NumPy (Biopython depends on it) will be removed before installing the recent versions.
Step 3 − Verifying Biopython Installation
Now, you have successfully installed Biopython on your machine. To verify that Biopython is installed properly, type the below command on your python console −
It shows the version of Biopython.
Alternate Way − Installing Biopython using Source
To install Biopython using source code, follow the below instructions −
Download the recent release of Biopython from the following link − https://biopython.org/wiki/Download
As of now, the latest version is biopython-1.72.
Download the file and unpack the compressed archive file, move into the source code folder and type the below command −
> python setup.py build

This will build Biopython from the source code as given below −
Now, test the code using the below command −
> python setup.py test

Finally, install using the below command −
> python setup.py install

 Print
 Add Notes
 Bookmark this page
Java | Functions | Question 11 - GeeksforGeeks

24 May, 2019
Predict the output of the following program.
class Test{    public static void main(String[] args)    {        String str = "geeks";        str.toUpperCase();        str += "forgeeks";        String string = str.substring(2,13);        string = string + str.charAt(4);;        System.out.println(string);    }}
(A) eksforgeekss(B) eksforgeeks(C) EKSforgeekss(D) EKSforgeeksAnswer: (A)Explanation: str.toUpperCase() returns ‘str’ in upper case. But,it does not change the original string ‘str’.str.substring(x, y) returns a string from position ‘x'(inclusive) to position ‘y'(exclusive).str.charAt(x) returns a character at position ‘x’ in the string ‘str’.Quiz of this Question
Vijay Sirra
Functions
Java-Functions
Java Quiz
Functions
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Java | Constructors | Question 3
Java | Constructors | Question 5
Java | final keyword | Question 1
Java | Exception Handling | Question 2
Java | Abstract Class and Interface | Question 2
Java | Class and Object | Question 1
Java | Exception Handling | Question 3
Java | Exception Handling | Question 7
Java | Inheritance | Question 8
Java | Exception Handling | Question 8
Batch Script - VOL

This batch command displays the volume labels.
VOL

@echo off 
VOL
The output will display the current volume label. For example,
Volume in drive C is Windows8_OS 
Volume Serial Number is E41C-6F43

 Print
 Add Notes
 Bookmark this page
Python | Aggregate values by tuple keys - GeeksforGeeks

29 Oct, 2019
Sometimes, while working with records, we can have a problem in which we need to group the like keys and aggregate the values of like keys. This can have application in any kind of scoring. Let’s discuss certain ways in which this task can be performed.
Method #1 : Using Counter() + generator expressionThe combination of above functions can be used to perform this particular task. In this, we need to first combine the like key elements and task of aggregation is performed by Counter().
# Python3 code to demonstrate working of# Aggregate values by tuple keys# using Counter() + generator expressionfrom collections import Counter  # initialize listtest_list = [('gfg', 50), ('is', 30), ('best', 100),                           ('gfg', 20), ('best', 50)]  # printing original listprint("The original list is : " + str(test_list))  # Aggregate values by tuple keys# using Counter() + generator expressionres = list(Counter(key for key, num in test_list                   for idx in range(num)).items())  # printing resultprint("List after grouping : " + str(res))
The original list is : [('gfg', 50), ('is', 30), ('best', 100), ('gfg', 20), ('best', 50)]
List after grouping : [('best', 150), ('gfg', 70), ('is', 30)]

 
Method #2 : Using groupby() + map() + itemgetter() + sum()The combination of above functions can also be used to perform this particular task. In this, we group the elements using groupby(), decision of key’s index is given by itemgetter. Task of addition(aggregation) is performed by sum() and extension of logic to all tuples is handled by map().
# Python3 code to demonstrate working of# Aggregate values by tuple keys# using groupby() + map() + itemgetter() + sum()from itertools import groupbyfrom operator import itemgetter  # initialize listtest_list = [('gfg', 50), ('is', 30), ('best', 100),                          ('gfg', 20), ('best', 50)]  # printing original listprint("The original list is : " + str(test_list))  # Aggregate values by tuple keys# using groupby() + map() + itemgetter() + sum()res = [(key, sum(map(itemgetter(1), ele)))       for key, ele in groupby(sorted(test_list, key = itemgetter(0)),                                                 key = itemgetter(0))]  # printing resultprint("List after grouping : " + str(res))
The original list is : [('gfg', 50), ('is', 30), ('best', 100), ('gfg', 20), ('best', 50)]
List after grouping : [('best', 150), ('gfg', 70), ('is', 30)]

Python list-programs
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Read a file line by line in Python
How to Install PIP on Windows ?
Different ways to create Pandas Dataframe
Python String | replace()
Python program to convert a list to string
Defaultdict in Python
Python | Split string into list of characters
Python | Get dictionary keys as a list
Python | Convert a list to dictionary
JSTL - fn:toUpperCase() Function

The fn:toUpperCase() function converts all the characters of a string to uppercase.
The fn:toUpperCase() function has the following syntax −
java.lang.String tolowercase(java.lang.String)

Following example explains the functionality of the fn:toUpperCase() function −
<%@ taglib uri = "http://java.sun.com/jsp/jstl/core" prefix = "c" %>
<%@ taglib uri = "http://java.sun.com/jsp/jstl/functions" prefix = "fn" %>

<html>
   <head>
      <title>Using JSTL Functions</title>
   </head>

   <body>
      <c:set var = "string1" value = "This is first String."/>
      <c:set var = "string2" value = "${fn:toUpperCase(string1)}" />

      <p>Final string : ${string2}</p>
   </body>
</html>
You will receive the following result −
Final string : THIS IS FIRST STRING.


    108 Lectures 
     11 hours 

 Chaand Sheikh

    517 Lectures 
     57 hours 

 Chaand Sheikh

    41 Lectures 
     4.5 hours 

 Karthikeya T

    42 Lectures 
     5.5 hours 

 TELCOMA Global

    15 Lectures 
     3 hours 

 TELCOMA Global

    44 Lectures 
     15 hours 

 Uplatz
 Print
 Add Notes
 Bookmark this page
Find n-th term of series 1, 4, 27, 16, 125, 36, 343 ....... - GeeksforGeeks

10 Mar, 2021
Given a number n, find the n-th term in the series 1, 4, 27, 16, 125, 36, 343........Examples:  
Input : 5
Output : 125

Input : 6
Output : 36
 
Naive approach : In this Sequence, if the Nth term is even then the Nth term is square of N else Nth term is a cube of N. 
N = 5 In this case, N is odd N = N * N * N N = 5 * 5 * 5 N = 125Similarly, N = 6 N = N * N N = 6 * 6 N = 36 and so on..  
Implementation of the above approach is given below:  
C++
Java
Python 3
C#
PHP
Javascript
// CPP code to generate first 'n' terms// of Logic sequence#include <bits/stdc++.h>using namespace std; // Function to generate a fixed \numberint logicOfSequence(int N){    if (N % 2 == 0)        N = N * N;       else        N = N * N * N;      return N;} // Driver Methodint main(){    int N = 6;    cout << logicOfSequence(N) << endl;    return 0;}
// JAVA code to generate first// 'n' terms of Logic sequence class GFG { // Function to generate// a fixed \numberpublic static int logicOfSequence(int N){    if (N % 2 == 0)        N = N * N;    else        N = N * N * N;    return N;} // Driver Methodpublic static void main(String args[]){    int N = 6;    System.out.println(logicOfSequence(N));}} // This code is contributed by Jaideep Pyne
# Python code to generate first# 'n' terms of Logic sequence # Function to generate a fixed# numberdef logicOfSequence(N):    if(N % 2 == 0):        N = N * N    else:        N = N * N * N    return N N = 6print (logicOfSequence(N)) # This code is contributed by# Vishal Gupta
// C# code to generate first// 'n' terms of Logic sequenceusing System; class GFG { // Function to generate// a fixed numberpublic static int logicOfSequence(int N){    if (N % 2 == 0)        N = N * N;    else        N = N * N * N;    return N;} // Driver Methodpublic static void Main(){    int N = 6;    Console.Write(logicOfSequence(N));}} // This code is contributed by nitin mittal
<?php// PHP code to generate first 'n' terms// of Logic sequence // Function to generate a fixed numberfunction logicOfSequence($N){    if ($N % 2 == 0)        $N = $N * $N;    else        $N = $N * $N * $N;    return $N;}     // Driver Code    $N = 6;    echo logicOfSequence($N); // This code is contributed by nitin mittal.?>
<script>// JavaScript code to generate first 'n' terms// of Logic sequence // Function to generate a fixed \numberfunction logicOfSequence( N){    if (N % 2 == 0)        N = N * N;       else        N = N * N * N;      return N;} // Driver Function     let N = 6;    document.write(logicOfSequence(N));     // This code contributed by Rajput-Ji </script>
Output: 
36
Time Complexity : O(1) 
jaideeppyne1997
vishal9619
nitin mittal
Rajput-Ji
School Programming
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Interfaces in Java
Operator Overloading in C++
Overriding in Java
Polymorphism in C++
Constructors in Java
Inheritance in Java
Different ways of Reading a text file in Java
Python program to check if a string is palindrome or not
Friend class and function in C++
Types of Operating Systems
How to create a responsive bottom navigation menu with CSS and JavaScript?

Following is the code to create a responsive bottom navigation menu with CSS and JavaScript −
 Live Demo
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
body {
   margin: 0px;
   margin-top: 10px;
   padding: 0px;
}
nav {
   position: fixed;
   bottom: 0;
   width: 100%;
   background-color: rgb(39, 39, 39);
   overflow: auto;
   height: auto;
}
.links {
   display: inline-block;
   text-align: center;
   padding: 14px;
   color: rgb(178, 137, 253);
   text-decoration: none;
   font-size: 17px;
}
.links:hover {
   background-color: rgb(100, 100, 100);
}
.selected {
   background-color: rgb(0, 18, 43);
}
.hamburger {
   color: white;
   font-weight: bolder;
   display: none;
}
@media screen and (max-width: 600px) {
nav a:not(:first-child) {
   display: none;
}
nav a.hamburger {
   float: right;
   display: block;
   padding: 12px;
}
nav.openNav a.hamburger {
   position: absolute;
   right: 0;
   bottom: 0;
}
nav.openNav a {
   float: none;
   display: block;
   text-align: center;
}
}
</style>
</head>
<body>
<nav class="bottomNav">
<a class="links selected" href="#"> Home</a>
<a class="links" href="#"> Login</a>
<a class="links" href="#">Register</a>
<a class="links" href="#"> Contact Us</a>
<a class="links" href="#">More Info</a>
<a class="hamburger">☰</a>
</nav>
<div>
<h1>Bottom navigation menu</h1>
</div>
<script>
function toggleNav() {
   var x = document.getElementsByTagName("nav")[0];
   if (x.className === "bottomNav") {
      x.className += " openNav";
   } else {
      x.className = "bottomNav";
   }
}
document.querySelector(".hamburger").addEventListener("click", toggleNav);
</script>
</body>
</html>
The above code will produce the following output −
On resizing the browser the hamburger icon to open navigation will be shown −
On clicking the hamburger icon −
Java Program to Append Text to an Existing File

The Java.io.BufferedWriter class writes text to a character-output stream, buffering characters so as to provide for the efficient writing of single characters, arrays, and strings. To add contents to a file −
 Instantiate the BufferedWriter class.
 By passing the FileWriter object as an argument to its constructor.
 Write data to the file using the write() method.
import java.io.File;
import java.io.FileWriter;
import java.io.BufferedWriter;
import java.io.IOException;

public class AppendToFileExample {
   public static void main( String[] args ) {

      try {
         String data = " Tutorials Point is a best website in the world";
         File f1 = new File("C:\Users\files\abc.txt");
         if(!f1.exists()) {
            f1.createNewFile();
         }

         FileWriter fileWritter = new FileWriter(f1.getName(),true);
         BufferedWriter bw = new BufferedWriter(fileWritter);
         bw.write(data);
         bw.close();
         System.out.println("Done");
      } catch(IOException e){
         e.printStackTrace();
      }
   }
}
Done
How to widen output display to see more columns in Pandas dataframe? - GeeksforGeeks

18 Aug, 2020
In Python, if there are many more number of columns in the dataframe, then not all the columns will be shown in the output display. So, let’s see how to widen output display to see more columns.
Method 1: Using pandas.set_option() function.
This function is used to set the value of a specified option.
Syntax: pandas.set_option(pat, value)
Returns: None
Example:
Python3
# importing numpy library import numpy as np  # importing pandas libraryimport pandas as pd  # define a dataframe of# 2 rows and 100 columns# with random entriesdf = pd.DataFrame(np.random.random(200).reshape(2, 100))  # show the dataframedf
Output:
To print the above output in a wider format using pandas.set_option() function.
Python3
# using pd.set_option()# to widen the output # displaypd.set_option('display.max_columns', 100)  # show the dataframedf
Output:
Method 2: Using pd.options.display.max_columns attribute.
This attribute is used to set the no. of columns to show in the display of the pandas dataframe.
Example:
Python3
# importing numpy libraryimport numpy as np  # importing pandas libraryimport pandas as pd  # define a dataframe of# 15 rows and 200 columns# with random entriesdf = pd.DataFrame(np.random.randint(0, 100,                                     size =(15, 200)))  # show the dataframedf
Output:
To print the above output in a wider format using pd.options.display.max_columns attribute.
Python3
# using an alternative# way to use # pd.set_option() method# to widen the output # displaypd.options.display.max_columns = 200  # show the dataframedf
Output:
Python pandas-dataFrame
Python Pandas-exercise
Python-pandas
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Install PIP on Windows ?
How to drop one or multiple columns in Pandas Dataframe
Python OOPs Concepts
Python | Get unique values from a list
Check if element exists in list in Python
Python Classes and Objects
Python | os.path.join() method
How To Convert Python Dictionary To JSON?
Python | Pandas dataframe.groupby()
Create a directory in Python
How do I get PHP errors to display? - GeeksforGeeks

20 Dec, 2021
There are four ways to display errors in PHP which are listed below: 
error_reporting: It does not display the E-STRICT, E-NOTICE and E_DEPRECATED level errors and display all the other level errors.
display_errors: Its default value is “off”. Set it to “on”.
log_errors: It’s default value is “on” which indicates whether or not error logging should be done.
error_log string: It sets the name of the file where scripts error should be logged.
Example: To display errors in PHP the fastest and easiest way is by adding the following lines to your code.  
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL); 
ini_set: The ini_set function will try to override the configuration found in PHP ini file.
display_errors: It is a directive which determine whether the error will be displayed to the user or will be remain hidden.
display_startup_errors: It is a directive which is used to find errors during PHP’s startup sequence. The list of the directives that can be overridden by the ini_set function is found in the official documentation.
These two directives does not display parse errors.Program 1:  
php
<?phpini_set('display_errors', 1);ini_set('display_startup_errors', 1);error_reporting(E_ALL); include("gfg.php");?>
Output: 
A warning will be shown- No such directory or file found in (location of file)
with the specified line of error.
To display errors including parse errors following changes must be made at php.ini and restart php-fpm, apche2  
display_errors = on
Program 2:  
php
<?php // Display number 0 to 5for($i = 0; $i <= 5 $i++) // Semicolon after $i<=5 is missing{echo $i;}?>
Output: 
Output when display_error is disabled in php.ini file: 
Output when display_error is enabled and restarted: 
The above directives will display any PHP errors encountered when loading the website on the browser. The display-errors should be disabled when the site is live to prevent any security when not in the development environment. 
anikaseth98
Picked
PHP
PHP Programs
Web Technologies
Web technologies Questions
PHP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Insert Form Data into Database using PHP ?
How to execute PHP code using command line ?
How to pop an alert message box using PHP ?
PHP in_array() Function
How to convert array to string in PHP ?
How to Insert Form Data into Database using PHP ?
How to execute PHP code using command line ?
How to pop an alert message box using PHP ?
How to convert array to string in PHP ?
How to delete an array element based on key in PHP?