
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 26504 Articles for Server Side Programming

6K+ Views
When we want to return a table as a result from multiple values passed into a function, then we make use of the table.pack() function. The table.pack() function is a variadic function.Syntaxtable.pack(x, y, z, ....)ExampleThe table.pack() function provides a table formed with all the values that are passed to it as an argument, consider the example shown below − Live Demoa = table.pack(1, 2, 3) print(a) print(a.n)In the above example, we passed three numbers to the table.pack() function as an argument and then we are printing the returned value, i.e., which will hold the address of the table that contains the ... Read More

334 Views
To create violin plot for categories with grey color palette using ggplot2, we can follow the below steps −First of all, create a data frame.Then, create the violin plot for categories with default color of violins.Create the violin plot for categories with color of violins in grey palette.Creating the data frameLet's create a data frame as shown below − Live Demo> Group Score df dfOn executing, the above script generates the below output(this output will vary on your system due to randomization) − Group Score 1 Second 405 2 Third 947 3 First 78 ... Read More

479 Views
To divide the data frame row values by row standard deviation in R, we can follow the below steps −First of all, create a data frame.Then, use apply function to divide the data frame row values by row standard deviation.Creating the data frameLet's create a data frame as shown below − Live Demo> x y df dfOn executing, the above script generates the below output(this output will vary on your system due to randomization) − x y 1 1.48 0.86 2 -0.14 -0.58 3 -0.25 1.22 4 0.18 0.25 5 0.50 0.68 6 -1.34 ... Read More

3K+ Views
To subtract column values from column means in R data frame, we can follow the below steps −First of all, create a data frame.Then, find the column means using colMeans function.After that, subtract column values from column means.Creating the data frameLet's create a data frame as shown below − Live Demo> x1 x2 x3 df dfOn executing, the above script generates the below output(this output will vary on your system due to randomization) − x1 x2 x3 1 54 73 57 2 79 52 92 3 87 51 47 4 13 12 1 5 70 90 19 6 15 99 ... Read More

587 Views
To color a Seaborn boxplot based on dataframe column name, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Make a Pandas dataframe with two columns, col1 and col2.Make a boxplot with horizontal orientation.Get the boxes artists.Iterate the boxes and set the facecolor of the box.To display the figure, use show() method.Exampleimport seaborn as sns import matplotlib.pyplot as plt import pandas as pd plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True df = pd.DataFrame( [[2, 4], [7, 2] ], columns=['col1', 'col2']) ... Read More

2K+ Views
To draw rounded line ends using matplotlib, we can use solid_capstyle='round'.StepsSet the figure size and adjust the padding between and around the subplots.Create random x and y data points using numpy.Create a figure and a set of subplots.Plot x and y data points using plot() method, with solid_capstyle in the method argument.To display the figure, use show() method.Exampleimport matplotlib.pyplot as plt import numpy as np plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True x = np.random.randn(5) y = np.random.randn(5) fig, ax = plt. subplots() ln, = ax.plot(x, y, lw=10, solid_capstyle='round', color='red') plt.show()OutputRead More

7K+ Views
To show date and time on the X-axis in Matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create a list of dates and y values.Get the current axis.Set the major date formatter and locator.Plot x and y values using plot() method.To display the figure, use show() method.Examplefrom datetime import datetime as dt from matplotlib import pyplot as plt, dates as mdates plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True dates = ["01/02/2020", "01/03/2020", "01/04/2020"] x_values = [dt.strptime(d, "%m/%d/%Y").date() for d in dates] y_values = [1, 2, 3] ax ... Read More

1K+ Views
To plot 95% confidence interval errorbar Python Pandas dataframes, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Get a dataframe instance of two-dimensional, size-mutable, potentially heterogeneous tabular data.Make a dataframe with two columns, category and number.Find the mean and std of category and number.Plot y versus x as lines and/or markers with attached errorbars.To display the figure, use show() method.Exampleimport numpy as np import pandas as pd import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True df = pd.DataFrame() df['category'] = np.random.choice(np.arange(10), 1000, replace=True) df['number'] = ... Read More

1K+ Views
To get a sense of how the parameters c and cmap behave in a Matplotlib scatterplot, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Initialize a variable N to store the number of sample data.Create x and y data points using numpy.Plot x and y data points using scatter() method, color and colormap.To display the figure, use show() method.Exampleimport numpy as np from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True N = 50 x = np.random.randn(N) y = np.random.randn(N) plt.scatter(x, y, c=x, ... Read More

2K+ Views
To create multiple boxplots on the same graph from a dictionary, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Make a dictionary, dict, with two columns.Create a figure and a set of subplots.Make a box and whisker plotSet the xtick labels using set_xticklabels() methodTo display the figure, use show() method.Examplefrom matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True data = {'col1': [3, 5, 2, 9, 1], 'col2': [2, 6, 1, 3, 4]} fig, ax = plt.subplots() ax.boxplot(data.values()) ax.set_xticklabels(data.keys()) plt.show()OutputRead More