Found 33676 Articles for Programming

Python - Plotting bar charts in excel sheet using XlsxWriter module

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

445 Views

A bar chart or bar graph is a chart or graph that presents categorical data with rectangular bars with heights or lengths proportional to the values that they represent. The bars can be plotted vertically or horizontally. A vertical bar chart is sometimes called a column chart.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_bar.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 ... Read More

Python - Plotting Area charts in excel sheet using XlsxWriter module

Nizamuddin Siddiqui
Updated on 06-Aug-2020 12:32:24

279 Views

An area chart represents the change in a one or more quantities over time. It is made by plotting a series of data points over time, connecting those data points with line segments, and then filling in the area between the line and the x-axis with color or shading.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_area.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 ... Read More

Python - Plotting an Excel chart with pattern fills in column using XlsxWriter module

Nizamuddin Siddiqui
Updated on 06-Aug-2020 12:24:37

196 Views

Charts are composed of at least one series of one or more data points. Series themselves are comprised of references to cell ranges. For plotting the charts on an excel sheet, firstly, create chart object of specific chart type( i.e Column chart etc.). After creating chart objects, insert data in it and lastly, add that chart object in the sheet object.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_pattern.xlsx') # The workbook object is then used to add new worksheet via the #add_worksheet() method. worksheet = workbook.add_worksheet() ... Read More

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

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

237 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

795 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

375 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

264 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

736 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

308 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

Advertisements