Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

dropna threshold

#dropping columns having more than 50% missing values(1994/2==1000)
df=df.dropna(thresh=1000,axis=1)
Comment

threshold meaning in pandas dropna

>>>df = pd.DataFrame({"name": ['Alfred', 'Batman', 'Catwoman'],
                   "toy": [np.nan, 'Batmobile', 'Bullwhip'],
                   "born": [pd.NaT, pd.Timestamp("1940-04-25"),
                            pd.NaT]}) 
df.dropna(thresh=2)
       name        toy       born
1    Batman  Batmobile 1940-04-25
2  Catwoman   Bullwhip        NaT
Comment

PREVIOUS NEXT
Code Example
Python :: install python 3.8 
Python :: excute a command using py in cmd 
Python :: backtracking python 
Python :: max in a list python 
Python :: cheat sheet python 
Python :: how to print a column from csv file in python 
Python :: selenium save webpage as pdf python 
Python :: if main python 
Python :: python make file executable 
Python :: matplotlib bar chart 
Python :: list sort by key and value 
Python :: how to find the closest value in column python 
Python :: python pause function 
Python :: download from colab to local drive 
Python :: msg.author discord.py 
Python :: python check if there is internet connection 
Python :: matplotlib subplots 
Python :: python run in another thread decorator 
Python :: set xlim histogram python 
Python :: check if file is txt python 
Python :: mediana python 
Python :: random 2 n program in python 
Python :: get dataframe column into a list 
Python :: pandas convert first row to header 
Python :: drop colums whoose value are object type in python 
Python :: python last item in list 
Python :: pd df rename 
Python :: input in one line python 
Python :: bytearray to hex python 
Python :: cv2 blue color range 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =