@@ -743,7 +743,8 @@ def repr_class(x):
743
743
744
744
745
745
def assert_attr_equal (attr , left , right , obj = "Attributes" ):
746
- """checks attributes are equal. Both objects must have attribute.
746
+ """
747
+ checks attributes are equal. Both objects must have attribute.
747
748
748
749
Parameters
749
750
----------
@@ -820,7 +821,8 @@ def assert_is_sorted(seq):
820
821
def assert_categorical_equal (
821
822
left , right , check_dtype = True , check_category_order = True , obj = "Categorical"
822
823
):
823
- """Test that Categoricals are equivalent.
824
+ """
825
+ Test that Categoricals are equivalent.
824
826
825
827
Parameters
826
828
----------
@@ -860,7 +862,8 @@ def assert_categorical_equal(
860
862
861
863
862
864
def assert_interval_array_equal (left , right , exact = "equiv" , obj = "IntervalArray" ):
863
- """Test that two IntervalArrays are equivalent.
865
+ """
866
+ Test that two IntervalArrays are equivalent.
864
867
865
868
Parameters
866
869
----------
@@ -1009,12 +1012,13 @@ def _raise(left, right, err_msg):
1009
1012
def assert_extension_array_equal (
1010
1013
left , right , check_dtype = True , check_less_precise = False , check_exact = False
1011
1014
):
1012
- """Check that left and right ExtensionArrays are equal.
1015
+ """
1016
+ Check that left and right ExtensionArrays are equal.
1013
1017
1014
1018
Parameters
1015
1019
----------
1016
1020
left, right : ExtensionArray
1017
- The two arrays to compare
1021
+ The two arrays to compare.
1018
1022
check_dtype : bool, default True
1019
1023
Whether to check if the ExtensionArray dtypes are identical.
1020
1024
check_less_precise : bool or int, default False
@@ -1489,7 +1493,8 @@ def assert_sp_array_equal(
1489
1493
check_fill_value = True ,
1490
1494
consolidate_block_indices = False ,
1491
1495
):
1492
- """Check that the left and right SparseArray are equal.
1496
+ """
1497
+ Check that the left and right SparseArray are equal.
1493
1498
1494
1499
Parameters
1495
1500
----------
@@ -1724,7 +1729,8 @@ def _make_timeseries(start="2000-01-01", end="2000-12-31", freq="1D", seed=None)
1724
1729
1725
1730
1726
1731
def all_index_generator (k = 10 ):
1727
- """Generator which can be iterated over to get instances of all the various
1732
+ """
1733
+ Generator which can be iterated over to get instances of all the various
1728
1734
index classes.
1729
1735
1730
1736
Parameters
@@ -1763,7 +1769,8 @@ def index_subclass_makers_generator():
1763
1769
1764
1770
1765
1771
def all_timeseries_index_generator (k = 10 ):
1766
- """Generator which can be iterated over to get instances of all the classes
1772
+ """
1773
+ Generator which can be iterated over to get instances of all the classes
1767
1774
which represent time-series.
1768
1775
1769
1776
Parameters
@@ -1854,7 +1861,8 @@ def makePeriodFrame(nper=None):
1854
1861
def makeCustomIndex (
1855
1862
nentries , nlevels , prefix = "#" , names = False , ndupe_l = None , idx_type = None
1856
1863
):
1857
- """Create an index/multindex with given dimensions, levels, names, etc'
1864
+ """
1865
+ Create an index/multindex with given dimensions, levels, names, etc'
1858
1866
1859
1867
nentries - number of entries in index
1860
1868
nlevels - number of levels (> 1 produces multindex)
@@ -1970,35 +1978,39 @@ def makeCustomDataframe(
1970
1978
r_idx_type = None ,
1971
1979
):
1972
1980
"""
1973
- nrows, ncols - number of data rows/cols
1974
- c_idx_names, idx_names - False/True/list of strings, yields No names ,
1975
- default names or uses the provided names for the levels of the
1976
- corresponding index. You can provide a single string when
1977
- c_idx_nlevels ==1.
1978
- c_idx_nlevels - number of levels in columns index. > 1 will yield MultiIndex
1979
- r_idx_nlevels - number of levels in rows index. > 1 will yield MultiIndex
1980
- data_gen_f - a function f(row,col) which return the data value
1981
- at that position, the default generator used yields values of the form
1982
- "RxCy" based on position.
1983
- c_ndupe_l, r_ndupe_l - list of integers, determines the number
1984
- of duplicates for each label at a given level of the corresponding
1985
- index. The default `None` value produces a multiplicity of 1 across
1986
- all levels, i.e. a unique index. Will accept a partial list of length
1987
- N < idx_nlevels, for just the first N levels. If ndupe doesn't divide
1988
- nrows/ncol, the last label might have lower multiplicity.
1989
- dtype - passed to the DataFrame constructor as is, in case you wish to
1990
- have more control in conjunction with a custom `data_gen_f`
1991
- r_idx_type, c_idx_type - "i"/"f"/"s"/"u"/"dt"/"td".
1992
- If idx_type is not None, `idx_nlevels` must be 1.
1993
- "i"/"f" creates an integer/float index,
1994
- "s"/"u" creates a string/unicode index
1995
- "dt" create a datetime index.
1996
- "td" create a timedelta index.
1981
+ Create a DataFrame using supplied parameters.
1997
1982
1998
- if unspecified, string labels will be generated.
1999
-
2000
- Examples:
1983
+ Parameters
1984
+ ----------
1985
+ nrows, ncols - number of data rows/cols
1986
+ c_idx_names, idx_names - False/True/list of strings, yields No names ,
1987
+ default names or uses the provided names for the levels of the
1988
+ corresponding index. You can provide a single string when
1989
+ c_idx_nlevels ==1.
1990
+ c_idx_nlevels - number of levels in columns index. > 1 will yield MultiIndex
1991
+ r_idx_nlevels - number of levels in rows index. > 1 will yield MultiIndex
1992
+ data_gen_f - a function f(row,col) which return the data value
1993
+ at that position, the default generator used yields values of the form
1994
+ "RxCy" based on position.
1995
+ c_ndupe_l, r_ndupe_l - list of integers, determines the number
1996
+ of duplicates for each label at a given level of the corresponding
1997
+ index. The default `None` value produces a multiplicity of 1 across
1998
+ all levels, i.e. a unique index. Will accept a partial list of length
1999
+ N < idx_nlevels, for just the first N levels. If ndupe doesn't divide
2000
+ nrows/ncol, the last label might have lower multiplicity.
2001
+ dtype - passed to the DataFrame constructor as is, in case you wish to
2002
+ have more control in conjunction with a custom `data_gen_f`
2003
+ r_idx_type, c_idx_type - "i"/"f"/"s"/"u"/"dt"/"td".
2004
+ If idx_type is not None, `idx_nlevels` must be 1.
2005
+ "i"/"f" creates an integer/float index,
2006
+ "s"/"u" creates a string/unicode index
2007
+ "dt" create a datetime index.
2008
+ "td" create a timedelta index.
2009
+
2010
+ if unspecified, string labels will be generated.
2001
2011
2012
+ Examples
2013
+ --------
2002
2014
# 5 row, 3 columns, default names on both, single index on both axis
2003
2015
>> makeCustomDataframe(5,3)
2004
2016
@@ -2140,7 +2152,8 @@ def makeMissingDataframe(density=0.9, random_state=None):
2140
2152
2141
2153
2142
2154
def optional_args (decorator ):
2143
- """allows a decorator to take optional positional and keyword arguments.
2155
+ """
2156
+ allows a decorator to take optional positional and keyword arguments.
2144
2157
Assumes that taking a single, callable, positional argument means that
2145
2158
it is decorating a function, i.e. something like this::
2146
2159
@@ -2212,7 +2225,8 @@ def _get_default_network_errors():
2212
2225
2213
2226
2214
2227
def can_connect (url , error_classes = None ):
2215
- """Try to connect to the given url. True if succeeds, False if IOError
2228
+ """
2229
+ Try to connect to the given url. True if succeeds, False if IOError
2216
2230
raised
2217
2231
2218
2232
Parameters
@@ -2514,7 +2528,6 @@ class RNGContext:
2514
2528
2515
2529
Examples
2516
2530
--------
2517
-
2518
2531
with RNGContext(42):
2519
2532
np.random.randn()
2520
2533
"""
@@ -2581,7 +2594,8 @@ def use_numexpr(use, min_elements=None):
2581
2594
2582
2595
2583
2596
def test_parallel (num_threads = 2 , kwargs_list = None ):
2584
- """Decorator to run the same function multiple times in parallel.
2597
+ """
2598
+ Decorator to run the same function multiple times in parallel.
2585
2599
2586
2600
Parameters
2587
2601
----------
@@ -2590,6 +2604,7 @@ def test_parallel(num_threads=2, kwargs_list=None):
2590
2604
kwargs_list : list of dicts, optional
2591
2605
The list of kwargs to update original
2592
2606
function kwargs on different threads.
2607
+
2593
2608
Notes
2594
2609
-----
2595
2610
This decorator does not pass the return value of the decorated function.
@@ -2669,7 +2684,6 @@ def set_timezone(tz: str):
2669
2684
2670
2685
Examples
2671
2686
--------
2672
-
2673
2687
>>> from datetime import datetime
2674
2688
>>> from dateutil.tz import tzlocal
2675
2689
>>> tzlocal().tzname(datetime.now())
0 commit comments