The numpy.argmax() function returns the indices of the maximum values along an axis. In case of multiple occurrences of the maximum values, the indices corresponding to the first occurrence will be returned.…
[Solved] NumPy.ndarray object is Not Callable Python
In Python, the array will be accessed using an indexing method. Similarly, the NumPy array also needs to be accessed through the indexing method. In this article, we will look…
Git Remove Untracked Files
If you want to remove untracked files from the working tree in Git, using the git clean command is the best way. The git clean command cleans the working tree…
Git Delete local branch
While working on a project, it always becomes tedious to manage git branches. We often create many feature branches on local and remote, and later it becomes difficult to manage…
Graphviz’s executables not found
Graphviz is open source graph visualization software that helps represent structural information as diagrams of abstract graphs and networks. Sometimes, if you install this on windows with Python 3, you…
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
If you are working with APIs and trying to fetch and parse the JSON data while making the HTTP or curl requests and JSON response is not well-formed, Python will…
Python pip: command not found Solution
Pip is a recursive acronym for either “Pip Installs Packages” or “Pip Installs Python.” Alternatively, pip stands for “preferred installer program.” Basically, it is a package manager that allows you to download…
Python FileNotFoundError: [Errno 2] No such file or directory Solution
In Python, when you reference a file, it needs to exist. Otherwise, Python will return a FileNotFoundError: [Errno 2] No such file or directory. In this tutorial, let’s look at…
Python ValueError: cannot reindex from a duplicate axis
In Python, you will get a valueerror: cannot reindex from a duplicate axis usually when you set an index to a specific value, reindexing or resampling the DataFrame using reindex method. If you look…
Python JSONPath
JSONPath is an expression language that is used to parse the JSON data in Python. JSONPath is similar to XPath in XML, where we parse the XML data. JSONPath provides…
nxnxn matrix python
In this tutorial, we will take a look at how to create the nxnxn matrix in Python. What is NxNxN? The term NxNxN (pronounced as N by N by N)…
Python Max int | Maximum value of int in Python
In this tutorial, we will look at what’s Python Max int in different versions of Python. Python 3 has unlimited precision that means there is no explicitly defined max limit.…
How to append a string in Python?
In this tutorial, we will see different ways to append a string in Python. The most efficient methods are using the += operator, join() function, and f-strings. We know that strings are immutable in Python,…
Python string to datetime Conversion
There are several ways to convert string to datetime in Python. Let’s take a look at each of these with examples. Convert Python String to datetime using datetime Module We…
List of Free Python Books
This article covers list of free ebooks for learning Python, you can directly click on the title to download or read the ebook. I will be updating the list frequently…
Python indentationerror: unindent does not match any outer indentation level Solution
Indentation in Python is important, and it makes your code well structured and clean. Python uses indentation to define code blocks. You can use either tabs or spaces to indent…
Python slice()
The slice() in Python is a built-in function that returns a slice object and slices any sequence such as string, tuple, list, bytes, range. slice() Syntax The syntax of the…
Python dir()
The dir() method is an inbuilt function in Python which returns all the valid list of attributes and methods of any object. (functions, dict, list, string, tuple etc.) dir() Syntax …
Python enumerate()
The enumerate() in Python is a built-in function that adds a counter as a key to an iterable object (list, tuple, etc.) and returns an enumerating object. enumerate() Syntax The…
TypeError: unhashable type: ‘list’
TypeError: unhashable type: ‘list’ usually occurs when you use the list as a hash argument. In simple terms, if you use a list as a key in the dictionary, you…
Python complex()
Python complex() function takes real, imaginary numbers and strings as input and converts them into a complex number. This method takes two optional parameters (real and imaginary) and returns a…
Python callable()
The callable() function in Python returns True if the object passed appears to be callable. Otherwise, it returns False. callable() Syntax The syntax of the callable() method is callable(object) callable()…
Python bytearray()
Python bytearray() function returns a bytearray object that means it converts an object into bytearray objects, which is an array of given bytes. The bytearray() method provides mutable sequence of…
Python bytes()
Python bytes() function return an immutable byte-represented object of given size and data. The bytes() method provides immutable(cannot be changed) sequence of objects in the range of 0 <= x…
Python divmod()
The divmod() in Python is a built-in function that takes two numbers as input parameters and returns a pair of numbers (a tuple) consisting of their quotient and remainder. divmod()…
Python bool()
Python’s bool() function converts a given value into Boolean(True or False) using the standard truth testing procedure. bool() Syntax The syntax of bool() method is bool([value]) bool() Parameters The bool()…
Python bin()
The bin() is a built-in function in Python that takes an integer and returns the binary equivalent of the integer in string format. If the given input is not an…
Python ascii()
The ascii() in Python is a built-in function that returns a printable and readable version of any object such as Strings, Tuples, Lists, etc. The ascii() function will escape the…
Python all()
The all() function in Python returns True if all the element of an iterable(List, set, dictionary, tuple) is True. If not, it returns False. The all() method returns True if the iterable object is empty. all() Syntax The…
Python any()
The any() function in Python returns True if any element of an iterable(List, set, dictionary, tuple) is True. If not, it returns False. any() Syntax The syntax of any() method…
Python abs()
The abs() function in Python returns the absolute value of a given number, which means the abs() method removes the negative sign of a number. If the given number is…
Python urllib.error.httperror: http error 403: forbidden
The urllib.error.httperror: http error 403: forbidden occurs when you try to scrap a webpage using urllib.request module and the mod_security blocks the request. There are several reasons why you get this error.…
Python Compare Strings: A Step-By-Step Guide
In Python the strings are compared with == and != operators. These operators compare if the two given strings are equal or not and return true or false based on…
How to find Square Root in Python?
In this article, you will be learning how to find square roots in Python and what are the popular square root functions in Python. What is a Square root? Square…
How to Rename a file in Python?
The os module in Python comes in handy in performing any file operations such as reading a file, writing into a file etc.. The rename() method is used to rename…
How to Get File Size in Python?
There are different ways to get file size in Python. We will be using the os module and the pathlib module to check the file size. OS module in Python…
Python Program to Measure the Elapsed Time in Python
There are multiple ways to measure the elapsed time in Python. The modules that are available are time, timeit, and Datetime to measure elapsed time. Using time Module We can use the time module…
Python Write Text File
Python provides built-in functions to perform file operations, such as creating, reading, and writing files. There are mainly two types of files that Python can handle, normal text files and…
How to Filter List Elements in Python?
The filter() method filters the given sequence of elements with the help of a function that tests each element in the sequence to be true or not. Syntax: filter(function, sequence)…
Python Read Text file
Python provides built-in functions to perform file operations, such as creating, reading, and writing files. There are mainly two types of files that Python can handle, normal text files and…
Python String isalpha()
Python string isalpha() method is mainly used to check if the string is the alphabet or not. The isalpha() method returns true if all the characters in the string are…
Python Trim String – rstrip(), lstrip(), strip()
Python provides three methods to trim the whitespaces from the string object. Let’s take a look at each of these functions in detail with examples. Difference between strip() vs rstrip()…
How to get current directory in Python?
In this article, we will take a look at how to get current directory in Python. The current directory is nothing but your working directory from which your script is…
Python chr(): A Step-By-Step Guide
The chr() function takes an integer (representing Unicode) as an input argument and returns a string representing a character. Syntax – chr(num) Parameter and Return Value The chr() function can…
Python ord(): A Step-By-Step Guide
In Python ord() function accepts a single unit of character and returns the equivalent Unicode code value of the passed argument. In other words, the ord() function can take a…
TypeError: list indices must be integers or slices, not tuple
If you are accessing the list elements in Python, you need to access it using its index position. If you specify a tuple or a list as an index, Python…
How to Copy a File in Python?
We can copy a file in Python using shutil, os, and subprocess modules. Let’s take a look at each of these modules and the functions it has with examples. Modules…
How to Create a Directory in Python?
The os module is a built-in utility available in both Python 2 and 3 versions, and it provides functions to interact easily with the operating system. The os and os.path modules provide…
Convert String to Float in Python
In this tutorial, we will take a look at how to convert string to float in Python. Convert string to float in Python Usually, in Python, the user input that…
How to replace characters in a string in Python?
If you are looking for replacing instances of a character in a string, Python has a built-in replace() method which does the task for you. The replace method replaces each matching occurrence…