Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

np where nan

np.argwhere(np.isnan(x))
Comment

Check np.nan value

import pandas as pd
import numpy as np

df = pd.DataFrame(
	[[np.nan, 72, 67],
	[23, 78, 62],
	[32, 74, np.nan],
	[np.nan, 54, 76]],
	columns=['a', 'b', 'c'])

value = df.at[0, 'a']  #nan
isNaN = np.isnan(value)
print("Is value at df[0, 'a'] NaN :", isNaN)

value = df.at[0, 'b']  #72
isNaN = np.isnan(value)
print("Is value at df[0, 'b'] NaN :", isNaN)
Comment

PREVIOUS NEXT
Code Example
Python :: python numpy array size of n 
Python :: python get attributes of object 
Python :: pyqt disable maximize button 
Python :: matplotlib savefig size 
Python :: how to use h5 file in python 
Python :: convert matplotlib figure to cv2 image 
Python :: unpacking python 
Python :: how to get the first key of a dictionary in python 
Python :: python nonlocal 
Python :: en_core_web_sm 
Python :: importing database in dataframe using sqlalchemy 
Python :: query with condition django 
Python :: simple graph in matplotlib categorical variables 
Python :: append dictionary to list python 
Python :: python email 
Python :: pandas calculate same day 3 months ago dateoffset 
Python :: check if a string is float python 
Python :: how to create a python server 
Python :: intersection() Function of sets in python 
Python :: how to add phone number to django user model 
Python :: how to run a python script 
Python :: python search first occurrence in string 
Python :: python dict get random key 
Python :: how to run terminal commands in python 
Python :: python count values in list 
Python :: how to count null values in pandas and return as percentage 
Python :: pytube 
Python :: ValueError: With n_samples=0, test_size=0.2 and train_size=None, the resulting train set will be empty. Adjust any of the aforementioned parameters. 
Python :: bot ping command 
Python :: python recursively merge dictionaries 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =