
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 33676 Articles for Programming

418 Views
Suppose we have two numbers called numerator and denominator representing a rational number in the form (numerator / denominator). We have to find its decimal representation as a string. If there are some recurring numbers, then surround them with brackets.So, if the input is like numerator = 164 denominator = 3, then the output will be "54.(6)".To solve this, we will follow these steps −if numerator is same as 0, then −return "0"Define an array ansif numerator < 0 and denominator > 0 or numerator > 0 and denominator < 0, then −insert '-' at the end of ansdivisor := ... Read More

176 Views
NumPy refers to ‘Numerical’ ‘Python’. It is a library that contains multidimensional array objects and multiple methods that help in processing the arrays.NumPy can be used to perform a wide variety of operations on arrays. It is used in conjunction with packages like SciPy, Matplotlib and so on. NumPy+Matplotlib can be understood as an alternative to MatLab. It is an open-source package, which means it can be used by anyone. Standard Python distribution doesn’t include NumPy package by default. The package has to be separately installed using the installer ‘pip’.For Windows, it has been shown below −pip install numpyOnce this ... Read More

364 Views
The values of ‘R’, ‘G’, and ‘B’ are changed and applied to the original image to get the required tint.Below is a Python program that uses scikit-learn to implement the same. Scikit-learn, commonly known as sklearn is a library in Python that is used for the purpose of implementing machine learning algorithms −Exampleimport matplotlib.pyplot as plt from skimage import data from skimage import color path = "path to puppy_1.jpg" orig_img = io.imread(path) grayscale_img = rgb2gray(orig_img) image = color.gray2rgb(grayscale_img) red_multiplier = [0.7, 0, 0] yellow_multiplier = [1, 0.9, 0] fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=(8, 4), sharex=True, sharey=True) ax1.imshow(red_multiplier * image) ... Read More

2K+ Views
Hysteresis refers to the lagging effect of a result. With respect to threshold, hysteresis refers to the areas that are above a specific low threshold value or above high threshold values. It refers to areas that are highly-confident in nature.With the help of hysteresis, the noise outside the edges of the object in the image can be ignored.Let us see how hysteresis threshold can be achieved using scikit-learn library:Exampleimport matplotlib.pyplot as plt from skimage import data, filters fig, ax = plt.subplots(nrows=2, ncols=2) orig_img = data.coins() edges = filters.sobel(orig_img) low = 0.1 high = 0.4 lowt = (edges > low).astype(int) hight ... Read More

364 Views
Pre-processing data refers to cleaning of data, removing invalid data, noise, replacing data with relevant values and so on. This doesn’t always mean text data; it could also be images or video processing as well.Data pre-processing basically refers to the task of gathering all the data (which is collected from various resources or a single resource) into a common format or into uniform datasets (depending on the type of data). Since real-world data is never ideal, there is a possibility that the data would have missing cells, errors, outliers, discrepancies in columns, and much more.Sometimes, images may not be correctly ... Read More

179 Views
When regression models are being built, multicollinearity is checked for. This is because we need to understand the correlation present between all different combinations of continuous variables. If multicollinearity exists between the variables, we have to make sure that it is removed from the data.The data in real world is usually non-linear. We need to find mechanisms to fit such non-linear data to the model. We will be using Anscombe’s dataset to visualize this data.The ‘implot’ function is used with non-linear data −Exampleimport pandas as pd import seaborn as sb from matplotlib import pyplot as plt my_df = sb.load_dataset('anscombe') sb.lmplot(x ... Read More

668 Views
SciPy can be used to determine the permutation and combination with respect to two values.A function named ‘perm’ present in the class ‘special’ in ‘SciPy’ is used.Syntax of ‘perm’ functionscipy.special.perm(N, k)Performing permutation on a set of values has been shown belowExample Live Demofrom scipy.special import perm my_permute = perm(6, 2, exact = True) print("The permutation of 6 and 2 is ") print(my_permute)OutputThe permutation of 6 and 2 is 30ExplanationThe required libraries are imported.Parameters are passed to the ‘perm’ function that computes the value.The value is assigned to a variable.This variable is displayed on the console.Computing combination of two values in SciPyA ... Read More

220 Views
When regression models are being built, multicollinearity is checked for. This is because we need to understand the correlation present between all different combinations of continuous variables. If multicollinearity exists between the variables, we have to make sure that it is removed from the data.This is where functions ‘regpot’ and ‘implot’ come into play. They help visualize a linear relationship between variables in linear regression.The ‘regplot’ function accepts values for variables ‘x’ and ‘y’ in a variety of formats, and this includes numpy arrays, pandas series objects, references to variables or values from a pandas dataframe.On the other hand, the ... Read More

183 Views
Seaborn is a library that helps in visualizing data. It comes with customized themes and a high-level interface.When regression models are being built, multicollinearity is checked for. This is because we need to understand the correlation present between all different combinations of continuous variables. If multicollinearity exists between the variables, we have to make sure that it is removed from the data. This is where functions ‘regpot’ and ‘implot’ come into play. They help visualize a linear relationship between variables in linear regression.The ‘regplot’ function accepts values for variables ‘x’ and ‘y’ in a variety of formats, and this includes ... Read More

250 Views
The barplot function establishes the relationship between a categorical variable and a continuous variable. Data is represented in the form of rectangular bars where the length of the bar indicates the proportion of data in that specific category.Point plots are similar to bar plots but instead of representing the fill bar, the estimated value of the data point is represented by a point at a specific height on the other axis.Categorical data can be visualized using categorical scatter plots or two separate plots with the help of pointplot or a higher level function known as factorplot. The factorplot function draws ... Read More