Horje
pandas df trim columns if too much missing data Code Example
pandas df trim columns if too much missing data
In [108]: df.columns[df.isnull().mean() < 0.8]
Out[108]: Index(['b', 'd', 'e'], dtype='object')

In [109]: df[df.columns[df.isnull().mean() < 0.8]]
Out[109]:
      b    d    e
0   2.0  NaN  NaN
1   NaN  NaN  2.0
2   2.0  NaN  NaN
3   NaN  NaN  2.0
4   2.0  NaN  NaN
5   NaN  NaN  NaN
6   2.0  NaN  NaN
7   2.0  NaN  NaN
8   2.0  NaN  NaN
9   NaN  NaN  NaN
10  2.0  NaN  2.0
11  NaN  2.0  NaN
12  NaN  2.0  NaN
13  NaN  2.0  NaN
14  NaN  2.0  2.0
15  NaN  NaN  NaN
16  2.0  NaN  NaN
17  NaN  NaN  2.0
18  NaN  2.0  NaN
19  2.0  2.0  NaN




Python

Related
pandas corr get couple value Code Example pandas corr get couple value Code Example
python empty array length n grepper Code Example python empty array length n grepper Code Example
how to call a specific item from a list python Code Example how to call a specific item from a list python Code Example
count numbers that add up to 10 in python Code Example count numbers that add up to 10 in python Code Example
# remove punctuation Code Example # remove punctuation Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7