Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Python difference between filter and map

nums = [1, 2, 3, 4, 5]
list(map(lambda x: x**2, nums))
#1 4 9 16 25
list(filter(lambda x: x%2==0, nums))
#2 4 6 8
Comment

PREVIOUS NEXT
Code Example
Python :: convert rgb image to binary in pillow 
Python :: python xmlrpc 
Python :: free wifi connection disconnects frequently windows 10 
Python :: serialize list to json python 
Python :: django venv activate 
Python :: code example of sum of the first n odd numbers using for loop 
Python :: python generators 
Python :: open multiple plots python 
Python :: python console 
Python :: seaborn orient 
Python :: pandas df tail 
Python :: python initialize multidimensional array 
Python :: python numpy array subtract 
Python :: str count python 
Python :: Python | Creating a Pandas dataframe column based on a given condition 
Python :: selecting rows with specific values in pandas 
Python :: python function create null matrix 
Python :: qr detector 
Python :: django template in views.py 
Python :: handling timezone in python 
Python :: python find closest date 
Python :: pandas pivot tables 
Python :: python catch print 
Python :: logger 
Python :: python get file ending 
Python :: python tkinter focus on entry 
Python :: remove n characters from string python 
Python :: pandas get size of each group 
Python :: python script to write dataframe on excel 
Python :: delete multiple dataframes at once in python 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =