Thursday, February 28, 2019

NumPy library - 6 (Array Manipulation)

Array manipulation as the name suggests deals with creation of an array using already created arrays usually by joining or splitting of already defined arrays. Let's see how array manipulation is done using: 1. Joining Arrays A new array can be formed by merging multiple arrays, this new array then contains all of the arrays. This is accomplished in NumPy by using stacking which provides methods...
Share:

Wednesday, February 27, 2019

NumPy library - 5 (Indexing, Slicing, and Iterating) continued..

Element extraction using the Conditional and Boolean operators Apart from using the numerical indexes we can use the conditions and Boolean operators to selectively extract the elements in an array. In the following example we'll select all values that are less than 0.5 in a matrix containing random numbers between 0 and 1. See the program below: import numpy as nparr1 = np.random.random((3, 3))print(arr1)print('\n')print(arr1<0.5)print('\n')print(arr1[arr1<0.5]) The...
Share:

Tuesday, February 26, 2019

NumPy library - 4 (Indexing, Slicing, and Iterating)

This post will help you to learn how to select elements through indexes and slices in order to obtain the values contained in them. This value can be used to make assignments in order to change their values and to make iterations within them. Indexing You might be familiar with the indexing in arrays if you have learnt any programming language. Array indexing always uses square brackets ([ ]) to...
Share:

Monday, February 25, 2019

NumPy library -3 (Basic operations on NumPy)

In the previous posts we learnt how to create NumPy arrays and define items in it. In this post we shall discuss how to apply various operations to them. Arithmetic Operators The common arithmetic operators used with arrays are addition and multiplication. The following program show adding an array with a scalar: import numpy as nparr = np.arange(5)print(arr)arr= arr+5print('\n')print(arr) The...
Share:

Sunday, February 24, 2019

NumPy library -2 (functions that generate ndarrays)

The NumPy library provides a set of functions that generate ndarrays with initial content, created with different values depending on the function. We have already seen some of these functions in the previous post which allows a single line of code to generate large amounts of data. 1. The zeros() function This function creates a full array of zeros with dimensions defined by the shape argument....
Share:

Thursday, February 21, 2019

NumPy library -1 (Introduction)

NumPy is the foundation library for scientific computing in Python since it provides data structures and high-performing functions that the basic package of the Python cannot provide. NumPy defines a specific data structure that is an N-dimensional array defined as ndarray. Knowledge of NumPy  is essential in terms of numerical calculations since its correct use can greatly influence...
Share:

Wednesday, February 20, 2019

Using sqlite with tkinter

In this post we'll see how SQLite3 allows for interaction with databases in Python, through SQL syntax by making a small program. This application "COVRI Training " allows a user to select a course from our training program in programming languages along with the training duration and an option to...
Share: