Python
- 09 August
Python | cv2 imwrite() Method
In this tutorial, we will see how to save an image in your own system using python by using open-cv which exists as cv2 (computer vision) library. You can use imwrite() method of cv2 library to save an image on your system. To use cv2 library, you need to import cv2 library using import statement. […]
- 24 July
Get Output from Python Script in Bash
Using Substitution Syntax Use Substitution Syntax ($(...)) to get output from a Python script and store it in a Bash variable. [crayon-678dd06b01135253042082/] [crayon-678dd06b0113b676273726/] [crayon-678dd06b0113c009881959/] We used the command substitution syntax,$(command), to capture the output of the Python script (my_script.py) in a Bash variable (result). Here, the command was python my_script.py, where a Python interpreter executed […]
- 04 May
Count Unique Values in NumPy Array
1. Introduction One of the common tasks Numpy Users may encounter is count unique values in Numpy Array that can help in exploring the distribution of Nummy Array. In this article, we will see different ways to count unique values in Numpy Array. 2. Using np.unique() Method with len() Method Use np.unique() method with len() […]
- 04 May
Create Array of Arrays in Python
Use numpy.array() Function To create an array of the arrays in Python: Use the np.array() function to create a numpy.ndarray type array of the arrays. [crayon-678dd06b01d2c726354802/] [crayon-678dd06b01d30100528230/] The Python library NumPy scientifically computes advanced numerical work. It is a language extension that adds support for large, multi-dimensional arrays and matrices in the Python language. The […]
- 27 April
Convert String List to Integer List in Python
Using map() Method Use the map() method with list() method to convert string list to integer list in Python. [crayon-678dd06b021b1905002453/] [crayon-678dd06b021b5506987742/] First, we defined a variable named string_list and set its value to a list having five string values. Next, we used the map() method, which applied the int() method to every element in string_list […]
- 25 April
Convert Object to Float in Pandas
1. Introduction Pandas is python library for data analysis and manipulation. One of the common tasks is to convert data type of column from object to float. We can achieve this using astype() or to_numeric() methods. Method 1: Using astype() [crayon-678dd06b02422739359026/] Method 2: Using to_numeric() [crayon-678dd06b02426301965221/] Let’s see each method in detail with examples. 2. […]
- 15 April
NameError: Name requests Is Not Defined
Python has a name error when you try to use a variable or function that is not defined currently. It means that Python has no idea where to locate the requests module or library you are trying to use in your code when you receive the nameError: name 'requests' is not defined error. There are […]
- 15 April
Convert Hex to String in Python
1. Introduction The representation of data in Hexadecimal is commonly used in computer programming. It is used to represent binary data in a human-readable form, as understanding the machine language (i.e., Binary) is difficult for humans. Hexadecimal notation is used in networking protocols, e.g., IPv6 and cryptography, and widely used in graphics, e.g. to represent […]
- 14 April
NameError: Name xrange Is Not Defined in Python
This NameError: Name 'xrange' Is Not Defined in Python is one of the errors which can occur while using Python. Our objective is to identify the underlying cause of the error and then provide ways to resolve it. Using xrange() Method to Reproduce NameError Use the xrange() method to reproduce NameError in Python 3.x. [crayon-678dd06b03313629968697/] […]
- 14 April
Call Python Script from Bash with Arguments
Python is a high-level language famous for its simplicity, flexibility, and readability. At the same time, Bash is a Unix shell and command language used primarily on Unix and Linux systems. Data analysis, machine learning, web development, and scientific computing tasks are widely performed using python language. On the contrary, the bash is used for […]
- 1
- 2
- 3
- …
- 42
- Nextkeyboard_arrow_right