Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python pipe where

# pip install pipe
from pipe import select, where, dedup


arr = [1,2,3,4,5,4,3,2,1,1,1]

res = list(arr
    | dedup					  # remove duplicates -> [1,2,3,4,5]
    | where(lambda e: e%2 == 0)  # filter for even numbers -> [2,4]
    | select(lambda e: e * 2)    # double all numbers -> [4,8]
)
Comment

PREVIOUS NEXT
Code Example
Python :: same quotes in a quotes 
Python :: hexing floats 
Python :: blockchain.py 
Python :: python generate sine wave pyaudio 
Python :: Optimize images in python using pillow 
Python :: python Hewwo wowwd 
Python :: cv2 leave only the biggest blob 
Python :: context manager requests python 
Python :: what is python virtual environment 
Python :: assert raises with properties python 
Python :: python structure like c 
Python :: tanimoto coefficient rdkit 
Python :: algorithme pour afficher table de multiplication python 
Python :: function to sort a list of points based on their x and y-coordinates 
Python :: python heroku 
Python :: python convert string to raw string 
Python :: get size of file python 
Python :: pandas rename column values 
Python :: convert date to integer python 
Python :: python includes 
Python :: pandas append dataframes with same columns 
Python :: round to 3 significant figures python 
Python :: loop python 
Python :: vs code set interpreter 
Python :: reduce () in python 
Python :: python permission denied 
Python :: DtypeWarning: Columns (7) have mixed types. Specify dtype option on import or set low_memory=False 
Python :: positive and negative number in python 
Python :: reverse the string in python 
Python :: find key by value python 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =