Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to define piecewise function i python

>>> x = np.linspace(-2.5, 2.5, 6)
>>> np.piecewise(x, [x < 0, x >= 0], [-1, 1])
array([-1., -1., -1.,  1.,  1.,  1.])
Comment

PREVIOUS NEXT
Code Example
Python :: find highest correlation pairs pandas 
Python :: pil.jpegimageplugin.jpegimagefile to image 
Python :: pandas reset index 
Python :: plotting roc curve 
Python :: how to delete an item from a list python 
Python :: how to put song in pygame 
Python :: seaborn Using the dark theme python 
Python :: raku fib 
Python :: python md5sum 
Python :: get request body flask 
Python :: spark to pandas 
Python :: python compare floats 
Python :: uploading folder in google colab 
Python :: disbale tkinter textbox 
Python :: Access item in a list of lists 
Python :: django model form 
Python :: sentence similarity spacy 
Python :: factors for negative number python 
Python :: isalnum python 
Python :: python user input to tuple 
Python :: queue using linked list in python 
Python :: python get current date and time 
Python :: python tkinter cursor types 
Python :: Python Tkinter Button Widget Syntax 
Python :: increment in python 
Python :: sum two columns pandas 
Python :: keras maxpooling1d 
Python :: sending email with django 
Python :: python3 lowercase 
Python :: python how to skip iteration 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =