Data present in large amounts needs to be dealt with properly. This is why computers with large capacities are used. Scientific and technical computations of large datasets can be done with the help of a library in Python known as SciPy. SciPy is short of ‘Scientific Python’.The Numpy library in Python is a pre-requisite to SciPy because SciPy is built on top of Numpy. Ensure that Numpy library is installed before installing SciPy library. It is an open-source software that is easily available to install and use.It has many features of data science and machine learning that are required to ... Read More
Visualizing data is an important step since it helps understand what is going on in the data without actually looking at the numbers and performing complicated computations. Seaborn is a library that helps in visualizing data. It comes with customized themes and a high-level interface.Kernel Density Estimation, also known as KDE is a method in which the probability density function of a continuous random variable can be estimated.This method is used for the analysis of the non-parametric values. While using ‘distplot’, if the argument ‘kde’ is set to True and ‘hist’ is set to False, the KDE can be visualized.Let ... Read More
Scikit-learn, commonly known as sklearn is an open-source library in Python that is used for the purpose of implementing machine learning algorithms.This includes classification, regression, clustering, dimensionality reduction, and much more with the help of a powerful, and stable interface in Python. This library is built on Numpy, SciPy and Matplotlib libraries.Let us see an example to load data −Examplefrom sklearn.datasets import load_iris my_data = load_iris() X = my_data.data y = my_data.target feature_name = my_data.feature_names target_name = my_data.target_names print("Feature names are : ", feature_name) print("Target names are : ", target_name) print("First 8 rows of the dataset are : ", X[:8])OutputFeature ... Read More
Scikit-learn, commonly known as sklearn is a library in Python that is used for the purpose of implementing machine learning algorithms.It is an open-source library hence it can be used free of cost. Powerful and robust, since it provides a wide variety of tools to perform statistical modelling. This includes classification, regression, clustering, dimensionality reduction, and much more with the help of a powerful, and stable interface in Python. This library is built on Numpy, SciPy and Matplotlib libraries.It can be installed using the ‘pip’ command as shown below −pip install scikit-learnThis library focuses on data modelling.There are many models ... Read More
Identity MatrixAn identity Matrix is a matrix which is n × n square matrix where the diagonal consist of ones and the other elements are all zeros.For example an identity matrix of order is will be −const arr = [ [1, 0, 0], [0, 1, 0], [0, 0, 1] ];We are required to write a JavaScript function that takes in a number, say n, and returns an identity matrix of n*n order.ExampleFollowing is the code −const num = 5; const constructIdentity = (num = 1) => { const res = []; for(let i = 0; ... Read More
We are required to write a JavaScript function that takes in a string that might contain some alphabets. The function should count and return the number of vowels that exists in the string.ExampleFollowing is the code −const str = 'this is a string'; const countVowels = (str = '') => { str = str.toLowerCase(); const legend = 'aeiou'; let count = 0; for(let i = 0; i < str.length; i++){ const el = str[i]; if(!legend.includes(el)){ continue; }; count++; }; return count; }; console.log(countVowels(str));OutputFollowing is the output on console −4
We are required to write a JavaScript function that takes in a string as the only argument. The function should generate an array of strings that contains all possible contiguous substrings that exist in the array.ExampleFollowing is the code −const str = 'Delhi'; const allCombinations = (str1 = '') => { const arr = []; for (let x = 0, y=1; x < str1.length; x++,y++) { arr[x]=str1.substring(x, y); }; const combination = []; let temp= ""; let len = Math.pow(2, arr.length); for (let i = 0; i < len ; i++){ temp= ""; for (let j=0;j
We are required to write a JavaScript function that takes in a floating-point number up to 2 digits of precision.The function should convert that number into the Indian current text.For example −If the input number is −const num = 12500Then the output should be −const output = 'Twelve Thousand Five Hundred';ExampleFollowing is the code −const num = 12500; const wordify = (num) => { const single = ["Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"]; const double = ["Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen"]; const tens = ["", "Ten", "Twenty", "Thirty", ... Read More
We are required to write a JavaScript function that takes in two numbers. The first number represents the length of the base of a right triangle and the second is perpendicular. The function should then compute the length of the hypotenuse based on these values.For example −If base = 8, perpendicular = 6Then the output should be 10ExampleFollowing is the code −const base = 8; const perpendicular = 6; const findHypotenuse = (base, perpendicular) => { const bSquare = base ** 2; const pSquare = perpendicular ** 2; const sum = bSquare + pSquare; const hypotenuse = Math.sqrt(sum); return hypotenuse; }; console.log(findHypotenuse(base, perpendicular)); console.log(findHypotenuse(34, 56));OutputFollowing is the output on console −10 65.5133574166368
We are required to write a JavaScript function that takes in a string that represents a ASCII number. The function should convert the number into its corresponding hexadecimal code and return the hexadecimal.For example −f the input ASCII string is −const str = '159';Then the hexadecimal code for this should be 313539.ExampleFollowing is the code −const str = '159'; const convertToHexa = (str = '') =>{ const res = []; const { length: len } = str; for (let n = 0, l = len; n < l; n ++) { const hex = ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP