@@ -170,11 +170,11 @@ class DataFrame(NDFrame):
170
170
171
171
See also
172
172
--------
173
- DataFrame.from_records: constructor from tuples, also record arrays
174
- DataFrame.from_dict: from dicts of Series, arrays, or dicts
175
- DataFrame.from_csv: from CSV files
176
- DataFrame.from_items: from sequence of (key, value) pairs
177
- read_csv / read_table / read_clipboard
173
+ DataFrame.from_records : constructor from tuples, also record arrays
174
+ DataFrame.from_dict : from dicts of Series, arrays, or dicts
175
+ DataFrame.from_csv : from CSV files
176
+ DataFrame.from_items : from sequence of (key, value) pairs
177
+ pandas. read_csv, pandas. read_table, pandas. read_clipboard
178
178
"""
179
179
_auto_consolidate = True
180
180
@@ -728,7 +728,7 @@ def from_records(cls, data, index=None, exclude=None, columns=None,
728
728
index : string, list of fields, array-like
729
729
Field of array to use as the index, alternately a specific set of
730
730
input labels to use
731
- exclude: sequence, default None
731
+ exclude : sequence, default None
732
732
Columns or fields to exclude
733
733
columns : sequence, default None
734
734
Column names to use. If the passed data do not have named
@@ -1167,8 +1167,10 @@ def to_excel(self, excel_writer, sheet_name='Sheet1', na_rep='',
1167
1167
Column label for index column(s) if desired. If None is given, and
1168
1168
`header` and `index` are True, then the index names are used. A
1169
1169
sequence should be given if the DataFrame uses MultiIndex.
1170
- startow : upper left cell row to dump data frame
1171
- startcol : upper left cell column to dump data frame
1170
+ startow :
1171
+ upper left cell row to dump data frame
1172
+ startcol :
1173
+ upper left cell column to dump data frame
1172
1174
engine : string, default None
1173
1175
write engine to use - you can also set this via the options
1174
1176
``io.excel.xlsx.writer``, ``io.excel.xls.writer``, and
@@ -1180,7 +1182,7 @@ def to_excel(self, excel_writer, sheet_name='Sheet1', na_rep='',
1180
1182
-----
1181
1183
If passing an existing ExcelWriter object, then the sheet will be added
1182
1184
to the existing workbook. This can be used to save different
1183
- DataFrames to one workbook
1185
+ DataFrames to one workbook:
1184
1186
1185
1187
>>> writer = ExcelWriter('output.xlsx')
1186
1188
>>> df1.to_excel(writer,'Sheet1')
@@ -1249,13 +1251,14 @@ def to_sql(self, name, con, flavor='sqlite', if_exists='fail', **kwargs):
1249
1251
1250
1252
Parameters
1251
1253
----------
1252
- name: name of SQL table
1253
- conn: an open SQL database connection object
1254
+ name : str
1255
+ Name of SQL table
1256
+ conn : an open SQL database connection object
1254
1257
flavor: {'sqlite', 'mysql', 'oracle'}, default 'sqlite'
1255
1258
if_exists: {'fail', 'replace', 'append'}, default 'fail'
1256
- fail: If table exists, do nothing.
1257
- replace: If table exists, drop it, recreate it, and insert data.
1258
- append: If table exists, insert data. Create if does not exist.
1259
+ - fail: If table exists, do nothing.
1260
+ - replace: If table exists, drop it, recreate it, and insert data.
1261
+ - append: If table exists, insert data. Create if does not exist.
1259
1262
"""
1260
1263
from pandas .io .sql import write_frame
1261
1264
write_frame (
@@ -1316,6 +1319,7 @@ def to_html(self, buf=None, columns=None, col_space=None, colSpace=None,
1316
1319
CSS class(es) to apply to the resulting html table
1317
1320
escape : boolean, default True
1318
1321
Convert the characters <, >, and & to HTML-safe sequences.
1322
+
1319
1323
"""
1320
1324
1321
1325
if force_unicode is not None : # pragma: no cover
@@ -1355,6 +1359,7 @@ def to_latex(self, buf=None, columns=None, col_space=None, colSpace=None,
1355
1359
1356
1360
bold_rows : boolean, default True
1357
1361
Make the row labels bold in the output
1362
+
1358
1363
"""
1359
1364
1360
1365
if force_unicode is not None : # pragma: no cover
@@ -1923,8 +1928,9 @@ def _set_item(self, key, value):
1923
1928
def insert (self , loc , column , value , allow_duplicates = False ):
1924
1929
"""
1925
1930
Insert column into DataFrame at specified location.
1926
- if allow_duplicates is False, Raises Exception if column is already
1927
- contained in the DataFrame
1931
+
1932
+ If `allow_duplicates` is False, raises Exception if column
1933
+ is already contained in the DataFrame.
1928
1934
1929
1935
Parameters
1930
1936
----------
@@ -2010,7 +2016,7 @@ def xs(self, key, axis=0, level=None, copy=True, drop_level=True):
2010
2016
which levels are used. Levels can be referred by label or position.
2011
2017
copy : boolean, default True
2012
2018
Whether to make a copy of the data
2013
- drop_level, default True
2019
+ drop_level : boolean , default True
2014
2020
If False, returns object with same levels as self.
2015
2021
2016
2022
Examples
@@ -2133,9 +2139,9 @@ def xs(self, key, axis=0, level=None, copy=True, drop_level=True):
2133
2139
_xs = xs
2134
2140
2135
2141
def lookup (self , row_labels , col_labels ):
2136
- """Label-based "fancy indexing" function for DataFrame. Given
2137
- equal-length arrays of row and column labels, return an array of the
2138
- values corresponding to each (row, col) pair.
2142
+ """Label-based "fancy indexing" function for DataFrame.
2143
+ Given equal-length arrays of row and column labels, return an
2144
+ array of the values corresponding to each (row, col) pair.
2139
2145
2140
2146
Parameters
2141
2147
----------
@@ -2146,13 +2152,11 @@ def lookup(self, row_labels, col_labels):
2146
2152
2147
2153
Notes
2148
2154
-----
2149
- Akin to
2150
-
2151
- .. code-block:: python
2155
+ Akin to::
2152
2156
2153
- result = []
2154
- for row, col in zip(row_labels, col_labels):
2155
- result.append(df.get_value(row, col))
2157
+ result = []
2158
+ for row, col in zip(row_labels, col_labels):
2159
+ result.append(df.get_value(row, col))
2156
2160
2157
2161
Examples
2158
2162
--------
@@ -2467,14 +2471,14 @@ def dropna(self, axis=0, how='any', thresh=None, subset=None,
2467
2471
axis : {0, 1}, or tuple/list thereof
2468
2472
Pass tuple or list to drop on multiple axes
2469
2473
how : {'any', 'all'}
2470
- any : if any NA values are present, drop that label
2471
- all : if all values are NA, drop that label
2474
+ * any : if any NA values are present, drop that label
2475
+ * all : if all values are NA, drop that label
2472
2476
thresh : int, default None
2473
2477
int value : require that many non-NA values
2474
2478
subset : array-like
2475
2479
Labels along other axis to consider, e.g. if you are dropping rows
2476
2480
these would be a list of columns to include
2477
- inplace : bool , defalt False
2481
+ inplace : boolean , defalt False
2478
2482
If True, do operation inplace and return None.
2479
2483
2480
2484
Returns
@@ -2725,7 +2729,7 @@ def sortlevel(self, level=0, axis=0, ascending=True, inplace=False):
2725
2729
----------
2726
2730
level : int
2727
2731
axis : {0, 1}
2728
- ascending : bool , default True
2732
+ ascending : boolean , default True
2729
2733
inplace : boolean, default False
2730
2734
Sort the DataFrame without creating a new instance
2731
2735
@@ -2790,9 +2794,11 @@ def reorder_levels(self, order, axis=0):
2790
2794
2791
2795
Parameters
2792
2796
----------
2793
- order: list of int representing new level order.
2794
- (reference level by number not by key)
2795
- axis: where to reorder levels
2797
+ order : list of int
2798
+ List representing new level order. Reference level by number
2799
+ not by key.
2800
+ axis : int
2801
+ Where to reorder levels.
2796
2802
2797
2803
Returns
2798
2804
-------
@@ -3057,8 +3063,10 @@ def combine_first(self, other):
3057
3063
3058
3064
Examples
3059
3065
--------
3066
+ a's values prioritized, use values from b to fill holes:
3067
+
3060
3068
>>> a.combine_first(b)
3061
- a's values prioritized, use values from b to fill holes
3069
+
3062
3070
3063
3071
Returns
3064
3072
-------
@@ -3094,7 +3102,7 @@ def update(self, other, join='left', overwrite=True, filter_func=None,
3094
3102
filter_func : callable(1d-array) -> 1d-array<boolean>, default None
3095
3103
Can choose to replace values other than NA. Return True for values
3096
3104
that should be updated
3097
- raise_conflict : bool
3105
+ raise_conflict : boolean
3098
3106
If True, will raise an error if the DataFrame and other both
3099
3107
contain data in the same place.
3100
3108
"""
@@ -3322,22 +3330,24 @@ def diff(self, periods=1):
3322
3330
def apply (self , func , axis = 0 , broadcast = False , raw = False , reduce = True ,
3323
3331
args = (), ** kwds ):
3324
3332
"""
3325
- Applies function along input axis of DataFrame. Objects passed to
3326
- functions are Series objects having index either the DataFrame's index
3327
- (axis=0) or the columns (axis=1). Return type depends on whether passed
3328
- function aggregates
3333
+ Applies function along input axis of DataFrame.
3334
+
3335
+ Objects passed to functions are Series objects having index
3336
+ either the DataFrame's index (axis=0) or the columns (axis=1).
3337
+ Return type depends on whether passed function aggregates
3329
3338
3330
3339
Parameters
3331
3340
----------
3332
3341
func : function
3333
- Function to apply to each column
3342
+ Function to apply to each column/row
3334
3343
axis : {0, 1}
3335
- 0 : apply function to each column
3336
- 1 : apply function to each row
3337
- broadcast : bool , default False
3344
+ * 0 : apply function to each column
3345
+ * 1 : apply function to each row
3346
+ broadcast : boolean , default False
3338
3347
For aggregation functions, return object of same size with values
3339
3348
propagated
3340
- reduce : bool, default True, try to apply reduction procedures
3349
+ reduce : boolean, default True
3350
+ Try to apply reduction procedures
3341
3351
raw : boolean, default False
3342
3352
If False, convert each row or column into a Series. If raw=True the
3343
3353
passed function will receive ndarray objects instead. If you are
@@ -3529,6 +3539,11 @@ def applymap(self, func):
3529
3539
Returns
3530
3540
-------
3531
3541
applied : DataFrame
3542
+
3543
+ See also
3544
+ --------
3545
+ DataFrame.apply : For operations on rows/columns
3546
+
3532
3547
"""
3533
3548
3534
3549
# if we have a dtype == 'M8[ns]', provide boxed values
@@ -3611,6 +3626,7 @@ def join(self, other, on=None, how='left', lsuffix='', rsuffix='',
3611
3626
how : {'left', 'right', 'outer', 'inner'}
3612
3627
How to handle indexes of the two objects. Default: 'left'
3613
3628
for joining on index, None otherwise
3629
+
3614
3630
* left: use calling frame's index
3615
3631
* right: use input frame's index
3616
3632
* outer: form union of indexes
@@ -3698,9 +3714,9 @@ def corr(self, method='pearson', min_periods=1):
3698
3714
Parameters
3699
3715
----------
3700
3716
method : {'pearson', 'kendall', 'spearman'}
3701
- pearson : standard correlation coefficient
3702
- kendall : Kendall Tau correlation coefficient
3703
- spearman : Spearman rank correlation
3717
+ * pearson : standard correlation coefficient
3718
+ * kendall : Kendall Tau correlation coefficient
3719
+ * spearman : Spearman rank correlation
3704
3720
min_periods : int, optional
3705
3721
Minimum number of observations required per pair of columns
3706
3722
to have a valid result. Currently only available for pearson
@@ -3756,7 +3772,9 @@ def cov(self, min_periods=None):
3756
3772
-------
3757
3773
y : DataFrame
3758
3774
3759
- y contains the covariance matrix of the DataFrame's time series.
3775
+ Notes
3776
+ -----
3777
+ `y` contains the covariance matrix of the DataFrame's time series.
3760
3778
The covariance is normalized by N-1 (unbiased estimator).
3761
3779
"""
3762
3780
numeric_df = self ._get_numeric_data ()
@@ -4156,9 +4174,9 @@ def mode(self, axis=0, numeric_only=False):
4156
4174
Parameters
4157
4175
----------
4158
4176
axis : {0, 1, 'index', 'columns'} (default 0)
4159
- 0/'index' : get mode of each column
4160
- 1/'columns' : get mode of each row
4161
- numeric_only : bool , default False
4177
+ * 0/'index' : get mode of each column
4178
+ * 1/'columns' : get mode of each row
4179
+ numeric_only : boolean , default False
4162
4180
if True, only apply to numeric columns
4163
4181
4164
4182
Returns
@@ -4213,14 +4231,14 @@ def rank(self, axis=0, numeric_only=None, method='average',
4213
4231
numeric_only : boolean, default None
4214
4232
Include only float, int, boolean data
4215
4233
method : {'average', 'min', 'max', 'first'}
4216
- average: average rank of group
4217
- min: lowest rank in group
4218
- max: highest rank in group
4219
- first: ranks assigned in order they appear in the array
4234
+ * average: average rank of group
4235
+ * min: lowest rank in group
4236
+ * max: highest rank in group
4237
+ * first: ranks assigned in order they appear in the array
4220
4238
na_option : {'keep', 'top', 'bottom'}
4221
- keep: leave NA values where they are
4222
- top: smallest rank if ascending
4223
- bottom: smallest rank if descending
4239
+ * keep: leave NA values where they are
4240
+ * top: smallest rank if ascending
4241
+ * bottom: smallest rank if descending
4224
4242
ascending : boolean, default True
4225
4243
False for ranks by high (1) to low (N)
4226
4244
@@ -4861,11 +4879,11 @@ def boxplot(self, column=None, by=None, ax=None, fontsize=None,
4861
4879
Can be any valid input to groupby
4862
4880
by : string or sequence
4863
4881
Column in the DataFrame to group by
4864
- ax : matplotlib axis object, default None
4882
+ ax : matplotlib axis object, default None
4865
4883
fontsize : int or string
4866
- rot : int, default None
4884
+ rot : int, default None
4867
4885
Rotation for ticks
4868
- grid : boolean, default None (matlab style default)
4886
+ grid : boolean, default None (matlab style default)
4869
4887
Axis grid lines
4870
4888
4871
4889
Returns
0 commit comments