Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

numpy convert true false to 0 1

array([False, False,  True,  True], dtype=bool)
>>> 1*y                      # Method 1
array([0, 0, 1, 1])
>>> y.astype(int)            # Method 2
array([0, 0, 1, 1]) 
Comment

PREVIOUS NEXT
Code Example
Python :: python webdriver disable logs 
Python :: python all lowercase letters 
Python :: beautiful soup 4 
Python :: correlation between images python 
Python :: django login code 
Python :: random picker python 
Python :: sending whatsapp message using python 
Python :: add fonts to matplotlib from a particular location 
Python :: sort columns dataframe 
Python :: python initialize empty dictionary 
Python :: how to convert the date column from string to a particular format in python 
Python :: django queryset last 10 
Python :: apply lambda function to multiple columns pandas 
Python :: python split word into letter pairs 
Python :: schedule computer shutdown python 
Python :: python call function from string 
Python :: python check if key exists 
Python :: solve ax=b python 
Python :: can you release a python program to an exe file 
Python :: how to generate random numbers in python 
Python :: difference between supervised and unsupervised learning 
Python :: cd in python 
Python :: flask get data from html form 
Python :: find duplicated entries present in a list 
Python :: query with condition django 
Python :: can list comprehenios contain else 
Python :: numpy array with 2 times each value 
Python :: set column datatype pandas 
Python :: create an empty list of lists in python 
Python :: dictionary with list as value py 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =