Tag: Function
Python map() function – Tutorial
In this article, we will discuss how to transform the contents of an iterable sequence using map() function. Also, we will discuss how to use the map() function with lambda functions and how to transform a dictionary using map() too. Table Of Contents Introduction to map() function in Python How does map() function works ? …
Python : filter() function | Tutorial & Examples
In this article we will discuss when & how to use python’s filter() function with lambda filter() function in python Python provides a method to filter out contents from a given sequence that can be a list, string or tuple etc. filter(function, iterable) Arguments: Advertisements An iterable sequence to be filtered. a function that accepts …
Python : max() function explained with examples
In this article we will discuss detailed features of Python’s max() function with examples. Python provides a max() function to find out the largest element from a collection of elements, Advertisements max(iterable, *[, key, default]) max(arg1, arg2, *args[, key]) Arguments: Iterable : An Iterable object like list, tuple etc. arg1, arg2 … : Multiple elements …
Python : min() function Tutorial with examples
In this article we will discuss detailed features of Python’s min() function with examples. Python provides a min() function to find out the smallest element from a collection of elements, Advertisements min(iterable, *[, key, default]) min(arg1, arg2, *args[, key]) Arguments: Iterable : An Iterable object like list, tuple etc. arg1, arg2 … : Multiple elements …
Python: numpy.reshape() function Tutorial with examples
In this article we will discuss how to use numpy.reshape() to change the shape of a numpy array. numpy.reshape() Python’s numpy module provides a function reshape() to change the shape of an array, Advertisements numpy.reshape(a, newshape, order=’C’) Parameters: a: Array to be reshaped, it can be a numpy array of any shape or a list …
Python: numpy.reshape() function Tutorial with examplesRead More
Python: numpy.ravel() function Tutorial with examples
In this article we will discuss the numpy.ravel() function and how we can use it in different ways to flatten a multidimensional numpy array. numpy.ravel() Advertisements Python’s numpy module provides a built-in function, numpy.ravel(a, order=’C’) Parameters: Frequently Asked: How to create an empty NumPy Array in Python? Append/ Add an element to Numpy Array in …
Python: numpy.ravel() function Tutorial with examplesRead More
Python: numpy.flatten() – Function Tutorial with examples
In this article we will learn about a function flatten() and how we can use it to flatten a numpy array of any shape. numpy.ndarray.flatten() In Python’s Numpy module, a numpy array has a member function to flatten its contents i.e. convert array of any shape to a 1D numpy array, Advertisements ndarray.flatten(order=’C’) Parameters: order: …
Python: numpy.flatten() – Function Tutorial with examplesRead More
Python Dictionary: clear() function & examples
In this article we will discuss how to use the clear() method of dict class in python. dict.clear() Syntax: In python, the dict class provides a member function to empty a dictionary i.e. dict.clear() Parameters: None It does not take any parameter. Returns: None It does not return any value. It deletes all the elements …
Python String encode() function
In this article, we will discuss how to use the encode() function of string class in python. Since python 3.0, strings are stored as Unicodes. The Unicode is a standard encoding system, in which each character is encoded using a integer code point from 0 and 0x10FFFF. In python, a Unicode string is a sequence …
Python String count() function
In this article, we will discuss how to use the count() function of string in python. In python, the string class provides a function count() to get the occurrence count of a sub-string in a string or a portion of string. Syntax of str.count() str.count(sub_string, start, end) Arguments: Advertisements sub_string: A string or a character, …