Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f77d7dd

Browse files
committedJan 30, 2018
Merge branch 'master' of https://github.com/pandas-dev/pandas into libwriters
2 parents c81dd2e + 238499a commit f77d7dd

File tree

28 files changed

+75
-48
lines changed

28 files changed

+75
-48
lines changed
 

‎asv_bench/benchmarks/replace.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ class Convert(object):
4444

4545
goal_time = 0.5
4646
params = (['DataFrame', 'Series'], ['Timestamp', 'Timedelta'])
47-
param_names = ['contructor', 'replace_data']
47+
param_names = ['constructor', 'replace_data']
4848

49-
def setup(self, contructor, replace_data):
49+
def setup(self, constructor, replace_data):
5050
N = 10**3
5151
data = {'Series': pd.Series(np.random.randint(N, size=N)),
5252
'DataFrame': pd.DataFrame({'A': np.random.randint(N, size=N),
5353
'B': np.random.randint(N, size=N)})}
5454
self.to_replace = {i: getattr(pd, replace_data) for i in range(N)}
55-
self.data = data[contructor]
55+
self.data = data[constructor]
5656

57-
def time_replace(self, contructor, replace_data):
57+
def time_replace(self, constructor, replace_data):
5858
self.data.replace(self.to_replace)

‎asv_bench/benchmarks/rolling.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ class Methods(object):
1212
['int', 'float'],
1313
['median', 'mean', 'max', 'min', 'std', 'count', 'skew', 'kurt',
1414
'sum', 'corr', 'cov'])
15-
param_names = ['contructor', 'window', 'dtype', 'method']
15+
param_names = ['constructor', 'window', 'dtype', 'method']
1616

17-
def setup(self, contructor, window, dtype, method):
17+
def setup(self, constructor, window, dtype, method):
1818
N = 10**5
1919
arr = np.random.random(N).astype(dtype)
20-
self.roll = getattr(pd, contructor)(arr).rolling(window)
20+
self.roll = getattr(pd, constructor)(arr).rolling(window)
2121

22-
def time_rolling(self, contructor, window, dtype, method):
22+
def time_rolling(self, constructor, window, dtype, method):
2323
getattr(self.roll, method)()
2424

2525

@@ -30,12 +30,12 @@ class Quantile(object):
3030
[10, 1000],
3131
['int', 'float'],
3232
[0, 0.5, 1])
33-
param_names = ['contructor', 'window', 'dtype', 'percentile']
33+
param_names = ['constructor', 'window', 'dtype', 'percentile']
3434

35-
def setup(self, contructor, window, dtype, percentile):
35+
def setup(self, constructor, window, dtype, percentile):
3636
N = 10**5
3737
arr = np.random.random(N).astype(dtype)
38-
self.roll = getattr(pd, contructor)(arr).rolling(window)
38+
self.roll = getattr(pd, constructor)(arr).rolling(window)
3939

40-
def time_quantile(self, contructor, window, dtype, percentile):
40+
def time_quantile(self, constructor, window, dtype, percentile):
4141
self.roll.quantile(percentile)

‎ci/requirements-3.6.run

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ lxml
1313
html5lib
1414
jinja2
1515
sqlalchemy
16-
pymysql
16+
pymysql<0.8.0
1717
feather-format
1818
pyarrow
1919
psycopg2

‎doc/source/10min.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ Selection
154154
While standard Python / Numpy expressions for selecting and setting are
155155
intuitive and come in handy for interactive work, for production code, we
156156
recommend the optimized pandas data access methods, ``.at``, ``.iat``,
157-
``.loc``, ``.iloc`` and ``.ix``.
157+
``.loc`` and ``.iloc``.
158158

159159
See the indexing documentation :ref:`Indexing and Selecting Data <indexing>` and :ref:`MultiIndex / Advanced Indexing <advanced>`.
160160

‎doc/source/api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2500,7 +2500,7 @@ Scalar introspection
25002500
Extensions
25012501
----------
25022502

2503-
These are primarily intented for library authors looking to extend pandas
2503+
These are primarily intended for library authors looking to extend pandas
25042504
objects.
25052505

25062506
.. currentmodule:: pandas

‎doc/source/io.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2675,7 +2675,7 @@ file, and the ``sheet_name`` indicating which sheet to parse.
26752675
+++++++++++++++++++
26762676

26772677
To facilitate working with multiple sheets from the same file, the ``ExcelFile``
2678-
class can be used to wrap the file and can be be passed into ``read_excel``
2678+
class can be used to wrap the file and can be passed into ``read_excel``
26792679
There will be a performance benefit for reading multiple sheets as the file is
26802680
read into memory only once.
26812681

@@ -4537,7 +4537,7 @@ See the documentation for `pyarrow <http://arrow.apache.org/docs/python/>`__ and
45374537
.. note::
45384538

45394539
These engines are very similar and should read/write nearly identical parquet format files.
4540-
Currently ``pyarrow`` does not support timedelta data, and ``fastparquet`` does not support timezone aware datetimes (they are coerced to UTC).
4540+
Currently ``pyarrow`` does not support timedelta data, ``fastparquet>=0.1.4`` supports timezone aware datetimes.
45414541
These libraries differ by having different underlying dependencies (``fastparquet`` by using ``numba``, while ``pyarrow`` uses a c-library).
45424542

45434543
.. ipython:: python

‎doc/sphinxext/numpydoc/tests/test_docscrape.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
-------
4343
out : ndarray
4444
The drawn samples, arranged according to `shape`. If the
45-
shape given is (m,n,...), then the shape of `out` is is
45+
shape given is (m,n,...), then the shape of `out` is
4646
(m,n,...,N).
4747
4848
In other words, each entry ``out[i,j,...,:]`` is an N-dimensional
@@ -222,7 +222,7 @@ def test_str():
222222
-------
223223
out : ndarray
224224
The drawn samples, arranged according to `shape`. If the
225-
shape given is (m,n,...), then the shape of `out` is is
225+
shape given is (m,n,...), then the shape of `out` is
226226
(m,n,...,N).
227227
228228
In other words, each entry ``out[i,j,...,:]`` is an N-dimensional
@@ -340,7 +340,7 @@ def test_sphinx_str():
340340
**out** : ndarray
341341
342342
The drawn samples, arranged according to `shape`. If the
343-
shape given is (m,n,...), then the shape of `out` is is
343+
shape given is (m,n,...), then the shape of `out` is
344344
(m,n,...,N).
345345
346346
In other words, each entry ``out[i,j,...,:]`` is an N-dimensional

‎pandas/_libs/tslibs/timedeltas.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ class Timedelta(_Timedelta):
897897
Represents a duration, the difference between two dates or times.
898898
899899
Timedelta is the pandas equivalent of python's ``datetime.timedelta``
900-
and is interchangable with it in most cases.
900+
and is interchangeable with it in most cases.
901901
902902
Parameters
903903
----------

‎pandas/_libs/tslibs/timezones.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ cpdef bint tz_compare(object start, object end):
295295
timezones. For example
296296
`<DstTzInfo 'Europe/Paris' LMT+0:09:00 STD>` and
297297
`<DstTzInfo 'Europe/Paris' CET+1:00:00 STD>` are essentially same
298-
timezones but aren't evaluted such, but the string representation
298+
timezones but aren't evaluated such, but the string representation
299299
for both of these is `'Europe/Paris'`.
300300
301301
This exists only to add a notion of equality to pytz-style zones

‎pandas/core/frame.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4115,7 +4115,7 @@ def combine(self, other, func, fill_value=None, overwrite=True):
41154115
series[this_mask] = fill_value
41164116
otherSeries[other_mask] = fill_value
41174117

4118-
# if we have different dtypes, possibily promote
4118+
# if we have different dtypes, possibly promote
41194119
new_dtype = this_dtype
41204120
if not is_dtype_equal(this_dtype, other_dtype):
41214121
new_dtype = find_common_type([this_dtype, other_dtype])

‎pandas/core/indexes/datetimelike.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ def freqstr(self):
332332
@cache_readonly
333333
def inferred_freq(self):
334334
"""
335-
Trys to return a string representing a frequency guess,
335+
Tryies to return a string representing a frequency guess,
336336
generated by infer_freq. Returns None if it can't autodetect the
337337
frequency.
338338
"""

‎pandas/core/internals.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,12 +224,17 @@ def make_block_scalar(self, values):
224224
"""
225225
return ScalarBlock(values)
226226

227-
def make_block_same_class(self, values, placement=None, ndim=None):
227+
def make_block_same_class(self, values, placement=None, ndim=None,
228+
dtype=None):
228229
""" Wrap given values in a block of same type as self. """
230+
if dtype is not None:
231+
# issue 19431 fastparquet is passing this
232+
warnings.warn("dtype argument is deprecated, will be removed "
233+
"in a future release.", DeprecationWarning)
229234
if placement is None:
230235
placement = self.mgr_locs
231236
return make_block(values, placement=placement, ndim=ndim,
232-
klass=self.__class__)
237+
klass=self.__class__, dtype=dtype)
233238

234239
def __unicode__(self):
235240

‎pandas/core/sparse/frame.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def __init__(self, data=None, index=None, columns=None, default_kind=None,
120120
if dtype is not None:
121121
mgr = mgr.astype(dtype)
122122
else:
123-
msg = ('SparseDataFrame called with unkown type "{data_type}" '
123+
msg = ('SparseDataFrame called with unknown type "{data_type}" '
124124
'for data argument')
125125
raise TypeError(msg.format(data_type=type(data).__name__))
126126

‎pandas/core/sparse/series.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ def _set_value(self, label, value, takeable=False):
493493
values = self.to_dense()
494494

495495
# if the label doesn't exist, we will create a new object here
496-
# and possibily change the index
496+
# and possibly change the index
497497
new_values = values._set_value(label, value, takeable=takeable)
498498
if new_values is not None:
499499
values = new_values

‎pandas/core/strings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1395,7 +1395,7 @@ def _validate(data):
13951395
elif isinstance(data, Index):
13961396
# can't use ABCIndex to exclude non-str
13971397

1398-
# see scc/inferrence.pyx which can contain string values
1398+
# see src/inference.pyx which can contain string values
13991399
allowed_types = ('string', 'unicode', 'mixed', 'mixed-integer')
14001400
if data.inferred_type not in allowed_types:
14011401
message = ("Can only use .str accessor with string values "

‎pandas/core/util/hashing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def _hash_categorical(c, encoding, hash_key):
210210

211211
# we have uint64, as we don't directly support missing values
212212
# we don't want to use take_nd which will coerce to float
213-
# instead, directly construt the result with a
213+
# instead, directly construct the result with a
214214
# max(np.uint64) as the missing value indicator
215215
#
216216
# TODO: GH 15362

‎pandas/io/formats/format.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1962,7 +1962,7 @@ def formatter(value):
19621962
def get_result_as_array(self):
19631963
"""
19641964
Returns the float values converted into strings using
1965-
the parameters given at initalisation, as a numpy array
1965+
the parameters given at initialisation, as a numpy array
19661966
"""
19671967

19681968
if self.formatter is not None:

‎pandas/io/pytables.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3763,7 +3763,7 @@ def write(self, **kwargs):
37633763
class LegacyTable(Table):
37643764

37653765
""" an appendable table: allow append/query/delete operations to a
3766-
(possibily) already existing appendable table this table ALLOWS
3766+
(possibly) already existing appendable table this table ALLOWS
37673767
append (but doesn't require them), and stores the data in a format
37683768
that can be easily searched
37693769

‎pandas/tests/categorical/test_constructors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ def test_constructor_from_categorical_with_unknown_dtype(self):
382382
ordered=True)
383383
tm.assert_categorical_equal(result, expected)
384384

385-
def test_contructor_from_categorical_string(self):
385+
def test_constructor_from_categorical_string(self):
386386
values = Categorical(['a', 'b', 'd'])
387387
# use categories, ordered
388388
result = Categorical(values, categories=['a', 'b', 'c'], ordered=True,

‎pandas/tests/frame/test_constructors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ def test_nested_dict_frame_constructor(self):
543543
tm.assert_frame_equal(result, df)
544544

545545
def _check_basic_constructor(self, empty):
546-
# mat: 2d matrix with shpae (3, 2) to input. empty - makes sized
546+
# mat: 2d matrix with shape (3, 2) to input. empty - makes sized
547547
# objects
548548
mat = empty((2, 3), dtype=float)
549549
# 2-D input

‎pandas/tests/internals/test_internals.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,14 @@ def test_delete(self):
285285
with pytest.raises(Exception):
286286
newb.delete(3)
287287

288+
def test_make_block_same_class(self):
289+
# issue 19431
290+
block = create_block('M8[ns, US/Eastern]', [3])
291+
with tm.assert_produces_warning(DeprecationWarning,
292+
check_stacklevel=False):
293+
block.make_block_same_class(block.values.values,
294+
dtype=block.values.dtype)
295+
288296

289297
class TestDatetimeBlock(object):
290298

‎pandas/tests/io/formats/test_format.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2531,7 +2531,7 @@ def test_date_tz(self):
25312531
[datetime(2013, 1, 1), pd.NaT], utc=True).format()
25322532
assert formatted[0] == "2013-01-01 00:00:00+00:00"
25332533

2534-
def test_date_explict_date_format(self):
2534+
def test_date_explicit_date_format(self):
25352535
formatted = pd.to_datetime([datetime(2003, 2, 1), pd.NaT]).format(
25362536
date_format="%m-%d-%Y", na_rep="UT")
25372537
assert formatted[0] == "02-01-2003"

‎pandas/tests/io/test_parquet.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,15 @@ def fp():
7171
return 'fastparquet'
7272

7373

74+
@pytest.fixture
75+
def fp_lt_014():
76+
if not _HAVE_FASTPARQUET:
77+
pytest.skip("fastparquet is not installed")
78+
if LooseVersion(fastparquet.__version__) >= LooseVersion('0.1.4'):
79+
pytest.skip("fastparquet is >= 0.1.4")
80+
return 'fastparquet'
81+
82+
7483
@pytest.fixture
7584
def df_compat():
7685
return pd.DataFrame({'A': [1, 2, 3], 'B': 'foo'})
@@ -435,8 +444,10 @@ def test_basic(self, fp, df_full):
435444
df = df_full
436445

437446
# additional supported types for fastparquet
447+
if LooseVersion(fastparquet.__version__) >= LooseVersion('0.1.4'):
448+
df['datetime_tz'] = pd.date_range('20130101', periods=3,
449+
tz='US/Eastern')
438450
df['timedelta'] = pd.timedelta_range('1 day', periods=3)
439-
440451
check_round_trip(df, fp)
441452

442453
@pytest.mark.skip(reason="not supported")
@@ -468,14 +479,15 @@ def test_categorical(self, fp):
468479
df = pd.DataFrame({'a': pd.Categorical(list('abc'))})
469480
check_round_trip(df, fp)
470481

471-
def test_datetime_tz(self, fp):
472-
# doesn't preserve tz
482+
def test_datetime_tz(self, fp_lt_014):
483+
484+
# fastparquet<0.1.4 doesn't preserve tz
473485
df = pd.DataFrame({'a': pd.date_range('20130101', periods=3,
474486
tz='US/Eastern')})
475-
476487
# warns on the coercion
477488
with catch_warnings(record=True):
478-
check_round_trip(df, fp, expected=df.astype('datetime64[ns]'))
489+
check_round_trip(df, fp_lt_014,
490+
expected=df.astype('datetime64[ns]'))
479491

480492
def test_filter_row_groups(self, fp):
481493
d = {'a': list(range(0, 3))}

‎pandas/tests/series/test_analytics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def test_empty(self, method, unit, use_bottleneck):
4343
result = getattr(s, method)()
4444
assert result == unit
4545

46-
# Explict
46+
# Explicit
4747
result = getattr(s, method)(min_count=0)
4848
assert result == unit
4949

‎pandas/tests/series/test_operators.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from pandas.core.indexes.timedeltas import Timedelta
2020
import pandas.core.nanops as nanops
2121

22+
from pandas.errors import PerformanceWarning
2223
from pandas.compat import range, zip
2324
from pandas import compat
2425
from pandas.util.testing import (assert_series_equal, assert_almost_equal,
@@ -871,8 +872,9 @@ def test_timedelta64_operations_with_DateOffset(self):
871872
expected = Series([timedelta(minutes=4, seconds=3)] * 3)
872873
assert_series_equal(result, expected)
873874

874-
result = td + Series([pd.offsets.Minute(1), pd.offsets.Second(3),
875-
pd.offsets.Hour(2)])
875+
with tm.assert_produces_warning(PerformanceWarning):
876+
result = td + Series([pd.offsets.Minute(1), pd.offsets.Second(3),
877+
pd.offsets.Hour(2)])
876878
expected = Series([timedelta(minutes=6, seconds=3), timedelta(
877879
minutes=5, seconds=6), timedelta(hours=2, minutes=5, seconds=3)])
878880
assert_series_equal(result, expected)
@@ -1163,7 +1165,7 @@ def test_timedelta_floordiv(self, scalar_td):
11631165
('NCC1701D', 'NCC1701D', 'NCC1701D')])
11641166
def test_td64_series_with_tdi(self, names):
11651167
# GH#17250 make sure result dtype is correct
1166-
# GH#19043 make sure names are propogated correctly
1168+
# GH#19043 make sure names are propagated correctly
11671169
tdi = pd.TimedeltaIndex(['0 days', '1 day'], name=names[0])
11681170
ser = Series([Timedelta(hours=3), Timedelta(hours=4)], name=names[1])
11691171
expected = Series([Timedelta(hours=3), Timedelta(days=1, hours=4)],

‎pandas/tests/sparse/frame/test_frame.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def test_constructor_from_unknown_type(self):
218218
class Unknown:
219219
pass
220220
with pytest.raises(TypeError,
221-
message='SparseDataFrame called with unkown type '
221+
message='SparseDataFrame called with unknown type '
222222
'"Unknown" for data argument'):
223223
SparseDataFrame(Unknown())
224224

‎pandas/tests/test_multilevel.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1611,13 +1611,13 @@ def test_pyint_engine(self):
16111611
index = MultiIndex.from_tuples(keys)
16121612
assert index.get_loc(keys[idx]) == idx
16131613

1614-
expected = np.arange(idx + 1, dtype='int64')
1614+
expected = np.arange(idx + 1, dtype=np.intp)
16151615
result = index.get_indexer([keys[i] for i in expected])
16161616
tm.assert_numpy_array_equal(result, expected)
16171617

16181618
# With missing key:
16191619
idces = range(len(keys))
1620-
expected = np.array([-1] + list(idces), dtype='int64')
1620+
expected = np.array([-1] + list(idces), dtype=np.intp)
16211621
missing = tuple([0, 1] * 5 * N)
16221622
result = index.get_indexer([missing] + [keys[i] for i in idces])
16231623
tm.assert_numpy_array_equal(result, expected)

‎pandas/util/testing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2401,7 +2401,7 @@ class for all warnings. To check that no warning is returned,
24012401
into errors.
24022402
Valid values are:
24032403
2404-
* "error" - turns matching warnings into exeptions
2404+
* "error" - turns matching warnings into exceptions
24052405
* "ignore" - discard the warning
24062406
* "always" - always emit a warning
24072407
* "default" - print the warning the first time it is generated

0 commit comments

Comments
 (0)
Please sign in to comment.