• 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. […]

  • Bash get output from python script
    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-65f8d7feaa398938743014/] [crayon-65f8d7feaa39f095551851/] [crayon-65f8d7feaa3a0779043675/] 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 […]

  • Count unique values in numpy array
    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() […]

  • Create array of arrays in Python
    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-65f8d7feaa91e819267856/] [crayon-65f8d7feaa922838136034/] 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 […]

  • Convert String List to Integer List in Python
    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-65f8d7feaaa52276024191/] [crayon-65f8d7feaaa56526096260/] 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 […]

  • Convert Object to Float in Pandas
    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-65f8d7feaad0b820677330/] Method 2: Using to_numeric() [crayon-65f8d7feaad0f460183530/] Let’s see each method in detail with examples. 2. […]

  • NameError name requests is not defined
    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 […]

  • Python hex to String
    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 […]

  • NameError: name xrange is not defined in Python
    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-65f8d7feab348833166636/] […]

  • Call Python script from bash with arguments
    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 […]