The psutil module in Python helps us to retrieve information about the processes that are currently running in our local system. What is a script? AScript is a set of instructions that are written in programming language and executed in the computer. We can perform a variety of simple to complex repetitive tasks within less time. In Linux, the scripts are often executed through the command line using the shell interpreters like Bash or python. These scripts can also be scheduled to run at a particular times using the cron or systemd. Installing psutil module To work with ... Read More
Bokeh is one of the data visualization libraries available in python, which allows the users to create the interactive plots, data applications, dashboards in web browsers. The Bokeh provides us varieties of plots and charts such as scatter plot, line plot, bar charts and area charts etc. and also more specialized heat maps and geographic maps. This is an Open source library with the active developer community. Creating Plots using Bokeh in Python The Bokeh library provides two main interfaces for creating the plot, one is low level interface which is used to develop the plots from the individual components ... Read More
While building video games, we often try to setup an image or logo for that developed game. Python provides a function in pygame named, set_icon(), which sets the icon as desired. Pygame is a set of modules that allows us to develop the games and multimedia applications. This is built in top of the SDL(Simple Direct Media Layer) library which has low access to the audio keyboard, mouse, joystick and graphics hardware through OpenGL and Direct3D. Syntax Following is the syntax for setting the icon for the game - pygame_icon = pygame.image_load(“image_name”) pygame.display.set_icon(pygame_icon) Where, pygame_icon is the name ... Read More
Plotly python is the library in python to create interactive visualizations using the plotly java script. It provides a wide range of charts and plots like scatter plots, line charts, bar charts and so on. Installing plotly library To use the plotly python library first we have to install the library in our python environment. The below is the code to install plotly python. pip install plotly On successful installation the above command generates the following output – Defaulting to user installation because normal site-packages is not writeable Collecting plotly Downloading plotly-5.14.1-py2.py3-none-any.whl (15.3 MB) ... Read More
Pygal is abbreviated as Python Data Visualization Library, which is designed to create the interactive charts and graphs. This is library is built with the advanced features than the SVG(Scalar Vector Graphics) format, to work with the high quality graphics that can be easily embedded into the web pages and applications. Pygal is abbreviated as Python Data Visualization Library, which is designed to create the interactive charts and graphs. This is library is built with the advanced features than the SVG(Scalar Vector Graphics) format, to work with the high quality graphics that can be easily embedded into the web pages ... Read More
Degrees and Radians are the two units of measurement for the angles. Degrees are the most commonly used unit of measurement for the angles. It is denoted by theta(Ø). There are 360 degrees in circle and each degree is divided into 60 minutes and each minute is further divided into 60 seconds. Mathematically the radians converted into degrees by multiplying the radian with 180/pi. The Radians are the natural unit of measurement of the angles in physics, mathematics and engineering. Simply we can define the radians as the length of an arc of the circle to the radius of ... Read More
The array created using the Numpy library can be converted into an image using the PIL or opencv libraries in python programming language. Let’s see about each library one by one. Python Image Library PIL is abbreviated as Python Image Library, which is an image processing libraries in python. It is a light weight and easy to use library to perform the image processing tasks like reading, writing, resizing and cropping the images. This library performs all the basic image processing tasks but don’t have any advanced features required for computer vision applications. We have a function in ... Read More
The Numpy is the library in the python programming language which is abbreviated as Numerical Python. It is used to do the mathematical, scientific and statistical calculations within less time. The output of the numpy functions will be an array. An array created by the numpy functions can be stored in the CSV file using a function namely, savetxt(). Numpy array into a .csv file CSV is abbreviated as Comma Separated Values. This is the file format most widely used in the Data Science. This stores the data in a tabular format where the column holds the data fields and ... Read More
Array is one of the data structures which allows us to store the same data type elements in a contiguous block of memory. Arrays can be in one dimension or two dimension or three dimension up to 32 dimensions. In python, there are different ways to create arrays. One way is by using the built-in module array which allows us to create the array with different data types like integers and floats. The other way is by using the Numpy library, which provides most powerful and flexible functions to implement the arrays. Creating array using array module The built in ... Read More
Weighted average is a type of average in which each array element will be multiplied by a weight factor before calculating the mean of the data elements. The weight of each data point determines its contribution to all its overall average. Calculating weighted average This is used to calculate the average price of a stock in a portfolio value. The mathematical formula of the weighted average is given as follows. weighted_average = (w1 * x1 + w2 * x2 + ... + wn * xn) / (w1 + w2 + ... + wn) Where, x1, x2, ….., ... Read More