Server Side Programming Articles - Page 1669 of 2650

Python - Plotting an Excel chart with Gradient fills using XlsxWriter module

Nizamuddin Siddiqui
Updated on 06-Aug-2020 12:21:30

241 Views

XlsxWriter is a Python library using which one can perform multiple operations on excel files like creating, writing, arithmetic operations and plotting graphs.Example# import xlsxwriter module import xlsxwriter # Workbook() takes one, non-optional, argument which is the filename #that we want to create. workbook = xlsxwriter.Workbook('chart_gradient1.xlsx') # The workbook object is then used to add new worksheet via the #add_worksheet() method. worksheet = workbook.add_worksheet() # Create a new Format object to formats cells in worksheets using #add_format() method . # here we create bold format object . bold = workbook.add_format({'bold': 1}) # Add the worksheet data that the charts will refer ... Read More

Python - Number of values greater than K in list

Nizamuddin Siddiqui
Updated on 06-Aug-2020 12:14:09

807 Views

One of the basic problems for many complex problems is finding numbers greater than certain number in list in python, is commonly encountered.Example Live Demo# find number of elements > k using for loop # initializing list test_list = [1, 7, 5, 6, 3, 8] # initializing k k = 4 # printing list print ("The list : " + str(test_list)) # using for loop to get numbers > k count = 0 for i in test_list :    if i > k :       count = count + 1 # printing the intersection print ("The numbers greater than ... Read More

Python - Implementation of Polynomial Regression

Nizamuddin Siddiqui
Updated on 06-Aug-2020 12:12:29

394 Views

Polynomial Regression is a form of linear regression in which the relationship between the independent variable x and dependent variable y is modeled as an nth degree polynomial. Polynomial regression fits a nonlinear relationship between the value of x and the corresponding conditional mean of y, denoted E(y |x)Example# Importing the libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd # Importing the dataset datas = pd.read_csv('data.csv') datas # divide the dataset into two components X = datas.iloc[:, 1:2].values y = datas.iloc[:, 2].values # Fitting Linear Regression to the dataset from sklearn.linear_model import LinearRegression lin = LinearRegression() lin.fit(X, y) ... Read More

Python - Image Classification using keras

Nizamuddin Siddiqui
Updated on 06-Aug-2020 12:08:19

380 Views

Image classification is a method to classify the images into their respective category classes using some method like −Training a small network from scratchFine tuning the top layers of the model using VGG16Example#First, include following libraries: # Importing all necessary libraries from keras.preprocessing.image import ImageDataGenerator from keras.models import Sequential from keras.layers import Conv2D, MaxPooling2D from keras.layers import Activation, Dropout, Flatten, Dense from keras import backend as K #Here, the train_data_dir is the train dataset directory. validation_data_dir is the #directory for validation data. nb_train_samples is the total number train #samples. nb_validation_samples is the total number of validation samples. img_width, img_height = 224, 224 train_data_dir = ... Read More

Python - How and where to apply Feature Scaling?

Nizamuddin Siddiqui
Updated on 06-Aug-2020 12:00:35

273 Views

It is a step of Data pre-processing which is applied to independent variables or features of data. It basically helps to normalise the data within a particular range.Why scaling?Most of the times, your dataset will contain features highly varying in magnitudes, units and range. But since, most of the machine learning algorithms use Euclidian distance between two data points in their computations, this is a problem.If left alone, these algorithms only take in the magnitude of features neglecting the units. The results would vary greatly between different units, 5kg and 5000gms.The features with high magnitudes will weigh in a lot ... Read More

Python - Getting started with SymPy module

Nizamuddin Siddiqui
Updated on 06-Aug-2020 11:54:41

747 Views

SymPy is a Python library for symbolic mathematics. It aims to become a full-featured computer algebra system (CAS) while keeping the code as simple as possible in order to be comprehensible and easily extensible. SymPy is written entirely in Python. SymPy only depends on mpmath, a pure Python library for arbitrary floating point arithmetic, making it easy to use.#Installing sympy modulepip install sympySymPy defines following numerical types: Rational and Integer. The Rational class represents a rational number as a pair of two Integers, numerator and denominator, so Rational(1, 2) represents 1/2, Rational(5, 2) 5/2 and so on. The Integer class represents Integer number.SymPy ... Read More

Sum of the nodes of a Circular Linked List in C++

sudhir sharma
Updated on 06-Aug-2020 08:29:34

318 Views

In this problem, we are given a circular linked list. Our task is to create a program to find the sum of the nodes of a Circular Linked List.We simply need to add all the node values of the linked list.Some important definitions Linked List is a sequence of data structures, which are connected together via links.Circular Linked List is a variation of the Linked list in which the first element points to the last element and the last element points to the first element. Both Singly Linked List and Doubly Linked List can be made into a circular linked list.Now, let’s ... Read More

Sum of the natural numbers (up to N) whose modulo with K yield R in C++

sudhir sharma
Updated on 06-Aug-2020 08:26:42

290 Views

In this problem, we are given three numbers N, K and R. Our task is to create a program to find the Sum of the natural numbers (up to N) whose modulo with K yield R.We will add all the numbers less than N that satisfy the following condition, i%K == R.Let’s take an example to understand the problem, Input N = 14, K = 4, R = 1Output 28Explanation − All the numbers less than N, that given 1 as remainder when divided by 4 are 1, 5, 9, 13.To solve this problem, we will loop from R to N, and ... Read More

Sum of the multiples of two numbers below N in C++

sudhir sharma
Updated on 06-Aug-2020 08:25:22

367 Views

In this problem, we have given three integers M1, M2, and N. Our task is to create a program to find the sum of multiples of two numbers below N.Here, we will add all the elements below N which are multiples of either M1 or M2Let’s take an example to understand the problem, Input N = 13, M1 = 4, M2 = 6Output  20Explanation − Number that are multiples of 4 and 6 that are less than 13 are 4, 6, 8, 12.A simple solution to the problem is to be looping from 1 to N and adding all values that can ... Read More

Sum of the mirror image nodes of a complete binary tree in an inorder way in C++

sudhir sharma
Updated on 06-Aug-2020 08:24:23

232 Views

In this problem, we are given a complete binary tree. Our task is to create a program to find the sum of the mirror image nodes of a complete binary tree in an inorder way.Here, we have to find the inorder traversal of the left sun-tree, and then for each node, we will add the mirror image with it. This means if we are traversing the left leaf node, we will add the value of the right leaf node with it. As it is the mirror image node.Some important definitionsComplete binary tree is a binary tree where all levels have ... Read More

Advertisements