@@ -2714,6 +2714,11 @@ def lookup(self, row_labels, col_labels):
2714
2714
col_labels : sequence
2715
2715
The column labels to use for lookup
2716
2716
2717
+ Returns
2718
+ -------
2719
+ values : ndarray
2720
+ The found values
2721
+
2717
2722
Notes
2718
2723
-----
2719
2724
Akin to::
@@ -2722,11 +2727,6 @@ def lookup(self, row_labels, col_labels):
2722
2727
for row, col in zip(row_labels, col_labels):
2723
2728
result.append(df.get_value(row, col))
2724
2729
2725
- Examples
2726
- --------
2727
- values : ndarray
2728
- The found values
2729
-
2730
2730
"""
2731
2731
n = len (row_labels )
2732
2732
if n != len (col_labels ):
@@ -3084,6 +3084,46 @@ def dropna(self, axis=0, how='any', thresh=None, subset=None,
3084
3084
Returns
3085
3085
-------
3086
3086
dropped : DataFrame
3087
+
3088
+ Examples
3089
+ --------
3090
+ >>> df = pd.DataFrame([[np.nan, 2, np.nan, 0], [3, 4, np.nan, 1],
3091
+ [np.nan, np.nan, np.nan, 5]],
3092
+ columns=list('ABCD'))
3093
+ >>> df
3094
+ A B C D
3095
+ 0 NaN 2.0 NaN 0
3096
+ 1 3.0 4.0 NaN 1
3097
+ 2 NaN NaN NaN 5
3098
+
3099
+ Drop the columns where all elements are nan
3100
+ >>> df.dropna(axis=1, how='all')
3101
+ A B D
3102
+ 0 NaN 2.0 0
3103
+ 1 3.0 4.0 1
3104
+ 2 NaN NaN 5
3105
+
3106
+ Drop the columns where any of the elements is nan
3107
+ >>> df.dropna(axis=1, how='any')
3108
+ D
3109
+ 0 0
3110
+ 1 1
3111
+ 2 5
3112
+
3113
+ Drop the rows where all of the elements is nan
3114
+ (there is no row to drop, so df stays the same)
3115
+ >>> df.dropna(axis=0, how='all')
3116
+ A B C D
3117
+ 0 NaN 2.0 NaN 0
3118
+ 1 3.0 4.0 NaN 1
3119
+ 2 NaN NaN NaN 5
3120
+
3121
+ Keep only the rows with at least 2 non-na values
3122
+ >>> df.dropna(thresh=2)
3123
+ A B C D
3124
+ 0 NaN 2.0 NaN 0
3125
+ 1 3.0 4.0 NaN 1
3126
+
3087
3127
"""
3088
3128
inplace = validate_bool_kwarg (inplace , 'inplace' )
3089
3129
if isinstance (axis , (tuple , list )):
@@ -3966,7 +4006,7 @@ def stack(self, level=-1, dropna=True):
3966
4006
values
3967
4007
3968
4008
Examples
3969
- ----------
4009
+ --------
3970
4010
>>> s
3971
4011
a b
3972
4012
one 1. 2.
0 commit comments