Skip to content

Commit 07394f4

Browse files
committed
Merge remote-tracking branch 'upstream/master' into mcmali-s3-pub-test
2 parents b7ab45f + f9b541f commit 07394f4

File tree

9 files changed

+90
-15
lines changed

9 files changed

+90
-15
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ matrix:
6969
env:
7070
- JOB="3.7, arm64" PYTEST_WORKERS=8 ENV_FILE="ci/deps/travis-37-arm64.yaml" PATTERN="(not slow and not network and not clipboard)"
7171
- dist: bionic
72-
python: 3.9-dev
7372
env:
74-
- JOB="3.9-dev" PATTERN="(not slow and not network)"
73+
- JOB="3.9-dev" PATTERN="(not slow and not network and not clipboard)"
74+
7575

7676
before_install:
7777
- echo "before_install"

doc/source/user_guide/enhancingperf.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ when we use Cython and Numba on a test function operating row-wise on the
1313
``DataFrame``. Using :func:`pandas.eval` we will speed up a sum by an order of
1414
~2.
1515

16+
.. note::
17+
18+
In addition to following the steps in this tutorial, users interested in enhancing
19+
performance are highly encouraged to install the
20+
:ref:`recommended dependencies<install.recommended_dependencies>` for pandas.
21+
These dependencies are often not installed by default, but will offer speed
22+
improvements if present.
23+
1624
.. _enhancingperf.cython:
1725

1826
Cython (writing C extensions for pandas)

doc/source/user_guide/visualization.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -443,9 +443,8 @@ Faceting, created by ``DataFrame.boxplot`` with the ``by``
443443
keyword, will affect the output type as well:
444444

445445
================ ======= ==========================
446-
``return_type=`` Faceted Output type
447-
---------------- ------- --------------------------
448-
446+
``return_type`` Faceted Output type
447+
================ ======= ==========================
449448
``None`` No axes
450449
``None`` Yes 2-D ndarray of axes
451450
``'axes'`` No axes
@@ -1424,7 +1423,7 @@ Here is an example of one way to easily plot group means with standard deviation
14241423
# Plot
14251424
fig, ax = plt.subplots()
14261425
@savefig errorbar_example.png
1427-
means.plot.bar(yerr=errors, ax=ax, capsize=4)
1426+
means.plot.bar(yerr=errors, ax=ax, capsize=4, rot=0)
14281427
14291428
.. ipython:: python
14301429
:suppress:
@@ -1445,9 +1444,9 @@ Plotting with matplotlib table is now supported in :meth:`DataFrame.plot` and :
14451444
14461445
.. ipython:: python
14471446
1448-
fig, ax = plt.subplots(1, 1)
1447+
fig, ax = plt.subplots(1, 1, figsize=(7, 6.5))
14491448
df = pd.DataFrame(np.random.rand(5, 3), columns=['a', 'b', 'c'])
1450-
ax.get_xaxis().set_visible(False) # Hide Ticks
1449+
ax.xaxis.tick_top() # Display x-axis ticks on top.
14511450
14521451
@savefig line_plot_table_true.png
14531452
df.plot(table=True, ax=ax)
@@ -1464,8 +1463,9 @@ as seen in the example below.
14641463

14651464
.. ipython:: python
14661465
1467-
fig, ax = plt.subplots(1, 1)
1468-
ax.get_xaxis().set_visible(False) # Hide Ticks
1466+
fig, ax = plt.subplots(1, 1, figsize=(7, 6.75))
1467+
ax.xaxis.tick_top() # Display x-axis ticks on top.
1468+
14691469
@savefig line_plot_table_data.png
14701470
df.plot(table=np.round(df.T, 2), ax=ax)
14711471

pandas/core/indexes/base.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,12 @@ def is_(self, other) -> bool:
518518
519519
Returns
520520
-------
521-
True if both have same underlying data, False otherwise : bool
521+
bool
522+
True if both have same underlying data, False otherwise.
523+
524+
See Also
525+
--------
526+
Index.identical : Works like ``Index.is_`` but also checks metadata.
522527
"""
523528
# use something other than None to be clearer
524529
return self._id is getattr(other, "_id", Ellipsis) and self._id is not None

pandas/tests/arrays/sparse/test_array.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,3 +1295,15 @@ def test_map_missing():
12951295

12961296
result = arr.map({0: 10, 1: 11})
12971297
tm.assert_sp_array_equal(result, expected)
1298+
1299+
1300+
@pytest.mark.parametrize("fill_value", [np.nan, 1])
1301+
def test_dropna(fill_value):
1302+
# GH-28287
1303+
arr = SparseArray([np.nan, 1], fill_value=fill_value)
1304+
exp = SparseArray([1.0], fill_value=fill_value)
1305+
tm.assert_sp_array_equal(arr.dropna(), exp)
1306+
1307+
df = pd.DataFrame({"a": [0, 1], "b": arr})
1308+
expected_df = pd.DataFrame({"a": [1], "b": exp}, index=pd.Int64Index([1]))
1309+
tm.assert_equal(df.dropna(), expected_df)

pandas/tests/extension/json/array.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,13 +179,11 @@ def astype(self, dtype, copy=True):
179179
def unique(self):
180180
# Parent method doesn't work since np.array will try to infer
181181
# a 2-dim object.
182-
return type(self)(
183-
[dict(x) for x in list({tuple(d.items()) for d in self.data})]
184-
)
182+
return type(self)([dict(x) for x in {tuple(d.items()) for d in self.data}])
185183

186184
@classmethod
187185
def _concat_same_type(cls, to_concat):
188-
data = list(itertools.chain.from_iterable([x.data for x in to_concat]))
186+
data = list(itertools.chain.from_iterable(x.data for x in to_concat))
189187
return cls(data)
190188

191189
def _values_for_factorize(self):

pandas/tests/frame/methods/test_diff.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,48 @@ def test_diff_sparse(self):
169169
)
170170

171171
tm.assert_frame_equal(result, expected)
172+
173+
@pytest.mark.parametrize(
174+
"axis,expected",
175+
[
176+
(
177+
0,
178+
pd.DataFrame(
179+
{
180+
"a": [np.nan, 0, 1, 0, np.nan, np.nan, np.nan, 0],
181+
"b": [np.nan, 1, np.nan, np.nan, -2, 1, np.nan, np.nan],
182+
"c": np.repeat(np.nan, 8),
183+
"d": [np.nan, 3, 5, 7, 9, 11, 13, 15],
184+
},
185+
dtype="Int64",
186+
),
187+
),
188+
(
189+
1,
190+
pd.DataFrame(
191+
{
192+
"a": np.repeat(np.nan, 8),
193+
"b": [0, 1, np.nan, 1, np.nan, np.nan, np.nan, 0],
194+
"c": np.repeat(np.nan, 8),
195+
"d": np.repeat(np.nan, 8),
196+
},
197+
dtype="Int64",
198+
),
199+
),
200+
],
201+
)
202+
def test_diff_integer_na(self, axis, expected):
203+
# GH#24171 IntegerNA Support for DataFrame.diff()
204+
df = pd.DataFrame(
205+
{
206+
"a": np.repeat([0, 1, np.nan, 2], 2),
207+
"b": np.tile([0, 1, np.nan, 2], 2),
208+
"c": np.repeat(np.nan, 8),
209+
"d": np.arange(1, 9) ** 2,
210+
},
211+
dtype="Int64",
212+
)
213+
214+
# Test case for default behaviour of diff
215+
result = df.diff(axis=axis)
216+
tm.assert_frame_equal(result, expected)

pandas/tests/io/test_feather.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ def test_read_columns(self):
115115
columns = ["col1", "col3"]
116116
self.check_round_trip(df, expected=df[columns], columns=columns)
117117

118+
@td.skip_if_no("pyarrow", min_version="0.17.1")
119+
def read_columns_different_order(self):
120+
# GH 33878
121+
df = pd.DataFrame({"A": [1, 2], "B": ["x", "y"], "C": [True, False]})
122+
self.check_round_trip(df, columns=["B", "A"])
123+
118124
def test_unsupported_other(self):
119125

120126
# mixed python objects

pandas/tests/io/test_gbq.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ def mock_read_gbq(sql, **kwargs):
148148

149149

150150
@pytest.mark.single
151+
@pytest.mark.xfail(reason="skipping gbq integration for now, xref #34779")
151152
class TestToGBQIntegrationWithServiceAccountKeyPath:
152153
@pytest.fixture()
153154
def gbq_dataset(self):

0 commit comments

Comments
 (0)