Skip to content

Commit 2648c3d

Browse files
committed
Merge branch 'master' of https://github.com/pandas-dev/pandas into add-nrows-to-read-json
issues with merging
2 parents 2355fc5 + e79487d commit 2648c3d

File tree

148 files changed

+6088
-3770
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+6088
-3770
lines changed

asv_bench/benchmarks/arithmetic.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,4 +469,29 @@ def time_apply_index(self, offset):
469469
offset.apply_index(self.rng)
470470

471471

472+
class BinaryOpsMultiIndex:
473+
params = ["sub", "add", "mul", "div"]
474+
param_names = ["func"]
475+
476+
def setup(self, func):
477+
date_range = pd.date_range("20200101 00:00", "20200102 0:00", freq="S")
478+
level_0_names = [str(i) for i in range(30)]
479+
480+
index = pd.MultiIndex.from_product([level_0_names, date_range])
481+
column_names = ["col_1", "col_2"]
482+
483+
self.df = pd.DataFrame(
484+
np.random.rand(len(index), 2), index=index, columns=column_names
485+
)
486+
487+
self.arg_df = pd.DataFrame(
488+
np.random.randint(1, 10, (len(level_0_names), 2)),
489+
index=level_0_names,
490+
columns=column_names,
491+
)
492+
493+
def time_binary_op_multiindex(self, func):
494+
getattr(self.df, func)(self.arg_df, level=0)
495+
496+
472497
from .pandas_vb_common import setup # noqa: F401 isort:skip

asv_bench/benchmarks/indexing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,9 @@ def time_boolean_rows_boolean(self):
158158
class DataFrameNumericIndexing:
159159
def setup(self):
160160
self.idx_dupe = np.array(range(30)) * 99
161-
self.df = DataFrame(np.random.randn(10000, 5))
161+
self.df = DataFrame(np.random.randn(100000, 5))
162162
self.df_dup = concat([self.df, 2 * self.df, 3 * self.df])
163-
self.bool_indexer = [True] * 5000 + [False] * 5000
163+
self.bool_indexer = [True] * 50000 + [False] * 50000
164164

165165
def time_iloc_dups(self):
166166
self.df_dup.iloc[self.idx_dupe]

asv_bench/benchmarks/rolling.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,4 +186,27 @@ def peakmem_rolling(self, constructor, window_size, dtype, method):
186186
getattr(self.roll, method)()
187187

188188

189+
class Groupby:
190+
191+
params = ["sum", "median", "mean", "max", "min", "kurt", "sum"]
192+
193+
def setup(self, method):
194+
N = 1000
195+
df = pd.DataFrame(
196+
{
197+
"A": [str(i) for i in range(N)] * 10,
198+
"B": list(range(N)) * 10,
199+
"C": pd.date_range(start="1900-01-01", freq="1min", periods=N * 10),
200+
}
201+
)
202+
self.groupby_roll_int = df.groupby("A").rolling(window=2)
203+
self.groupby_roll_offset = df.groupby("A").rolling(window="30s", on="C")
204+
205+
def time_rolling_int(self, method):
206+
getattr(self.groupby_roll_int, method)()
207+
208+
def time_rolling_offset(self, method):
209+
getattr(self.groupby_roll_offset, method)()
210+
211+
189212
from .pandas_vb_common import setup # noqa: F401 isort:skip

doc/source/development/contributing.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,8 +1275,8 @@ Performance matters and it is worth considering whether your code has introduced
12751275
performance regressions. pandas is in the process of migrating to
12761276
`asv benchmarks <https://github.com/spacetelescope/asv>`__
12771277
to enable easy monitoring of the performance of critical pandas operations.
1278-
These benchmarks are all found in the ``pandas/asv_bench`` directory. asv
1279-
supports both python2 and python3.
1278+
These benchmarks are all found in the ``pandas/asv_bench`` directory, and the
1279+
test results can be found `here <https://pandas.pydata.org/speed/pandas/#/>`__.
12801280

12811281
To use all features of asv, you will need either ``conda`` or
12821282
``virtualenv``. For more details please check the `asv installation

doc/source/ecosystem.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,23 @@ A good implementation for Python users is `has2k1/plotnine <https://github.com/h
153153
Spun off from the main pandas library, the `qtpandas <https://github.com/draperjames/qtpandas>`__
154154
library enables DataFrame visualization and manipulation in PyQt4 and PySide applications.
155155

156+
`D-Tale <https://github.com/man-group/dtale>`__
157+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
158+
159+
D-Tale is a lightweight web client for visualizing pandas data structures. It
160+
provides a rich spreadsheet-style grid which acts as a wrapper for a lot of
161+
pandas functionality (query, sort, describe, corr...) so users can quickly
162+
manipulate their data. There is also an interactive chart-builder using Plotly
163+
Dash allowing users to build nice portable visualizations. D-Tale can be
164+
invoked with the following command
165+
166+
.. code:: python
167+
168+
import dtale; dtale.show(df)
169+
170+
D-Tale integrates seamlessly with jupyter notebooks, python terminals, kaggle
171+
& Google Colab. Here are some demos of the `grid <http://alphatechadmin.pythonanywhere.com/>`__
172+
and `chart-builder <http://alphatechadmin.pythonanywhere.com/charts/4?chart_type=surface&query=&x=date&z=Col0&agg=raw&cpg=false&y=%5B%22security_id%22%5D>`__.
156173

157174
.. _ecosystem.ide:
158175

doc/source/reference/frame.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,13 +240,14 @@ Reshaping, sorting, transposing
240240
DataFrame.T
241241
DataFrame.transpose
242242

243-
Combining / joining / merging
244-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
243+
Combining / comparing / joining / merging
244+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
245245
.. autosummary::
246246
:toctree: api/
247247

248248
DataFrame.append
249249
DataFrame.assign
250+
DataFrame.compare
250251
DataFrame.join
251252
DataFrame.merge
252253
DataFrame.update

doc/source/reference/offset_frequency.rst

Lines changed: 44 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ Properties
5959
BusinessDay.normalize
6060
BusinessDay.rule_code
6161
BusinessDay.n
62+
BusinessDay.weekmask
63+
BusinessDay.holidays
64+
BusinessDay.calendar
6265

6366
Methods
6467
~~~~~~~
@@ -93,6 +96,11 @@ Properties
9396
BusinessHour.normalize
9497
BusinessHour.rule_code
9598
BusinessHour.n
99+
BusinessHour.start
100+
BusinessHour.end
101+
BusinessHour.weekmask
102+
BusinessHour.holidays
103+
BusinessHour.calendar
96104

97105
Methods
98106
~~~~~~~
@@ -126,12 +134,16 @@ Properties
126134
CustomBusinessDay.normalize
127135
CustomBusinessDay.rule_code
128136
CustomBusinessDay.n
137+
CustomBusinessDay.weekmask
138+
CustomBusinessDay.calendar
139+
CustomBusinessDay.holidays
129140

130141
Methods
131142
~~~~~~~
132143
.. autosummary::
133144
:toctree: api/
134145

146+
CustomBusinessDay.apply_index
135147
CustomBusinessDay.apply
136148
CustomBusinessDay.copy
137149
CustomBusinessDay.isAnchored
@@ -159,6 +171,11 @@ Properties
159171
CustomBusinessHour.normalize
160172
CustomBusinessHour.rule_code
161173
CustomBusinessHour.n
174+
CustomBusinessHour.weekmask
175+
CustomBusinessHour.calendar
176+
CustomBusinessHour.holidays
177+
CustomBusinessHour.start
178+
CustomBusinessHour.end
162179

163180
Methods
164181
~~~~~~~
@@ -329,6 +346,9 @@ Properties
329346
CustomBusinessMonthEnd.normalize
330347
CustomBusinessMonthEnd.rule_code
331348
CustomBusinessMonthEnd.n
349+
CustomBusinessMonthEnd.weekmask
350+
CustomBusinessMonthEnd.calendar
351+
CustomBusinessMonthEnd.holidays
332352

333353
Methods
334354
~~~~~~~
@@ -363,6 +383,9 @@ Properties
363383
CustomBusinessMonthBegin.normalize
364384
CustomBusinessMonthBegin.rule_code
365385
CustomBusinessMonthBegin.n
386+
CustomBusinessMonthBegin.weekmask
387+
CustomBusinessMonthBegin.calendar
388+
CustomBusinessMonthBegin.holidays
366389

367390
Methods
368391
~~~~~~~
@@ -377,40 +400,6 @@ Methods
377400
CustomBusinessMonthBegin.is_on_offset
378401
CustomBusinessMonthBegin.__call__
379402

380-
SemiMonthOffset
381-
---------------
382-
.. autosummary::
383-
:toctree: api/
384-
385-
SemiMonthOffset
386-
387-
Properties
388-
~~~~~~~~~~
389-
.. autosummary::
390-
:toctree: api/
391-
392-
SemiMonthOffset.freqstr
393-
SemiMonthOffset.kwds
394-
SemiMonthOffset.name
395-
SemiMonthOffset.nanos
396-
SemiMonthOffset.normalize
397-
SemiMonthOffset.rule_code
398-
SemiMonthOffset.n
399-
400-
Methods
401-
~~~~~~~
402-
.. autosummary::
403-
:toctree: api/
404-
405-
SemiMonthOffset.apply
406-
SemiMonthOffset.apply_index
407-
SemiMonthOffset.copy
408-
SemiMonthOffset.isAnchored
409-
SemiMonthOffset.onOffset
410-
SemiMonthOffset.is_anchored
411-
SemiMonthOffset.is_on_offset
412-
SemiMonthOffset.__call__
413-
414403
SemiMonthEnd
415404
------------
416405
.. autosummary::
@@ -430,6 +419,7 @@ Properties
430419
SemiMonthEnd.normalize
431420
SemiMonthEnd.rule_code
432421
SemiMonthEnd.n
422+
SemiMonthEnd.day_of_month
433423

434424
Methods
435425
~~~~~~~
@@ -464,6 +454,7 @@ Properties
464454
SemiMonthBegin.normalize
465455
SemiMonthBegin.rule_code
466456
SemiMonthBegin.n
457+
SemiMonthBegin.day_of_month
467458

468459
Methods
469460
~~~~~~~
@@ -498,6 +489,7 @@ Properties
498489
Week.normalize
499490
Week.rule_code
500491
Week.n
492+
Week.weekday
501493

502494
Methods
503495
~~~~~~~
@@ -532,6 +524,7 @@ Properties
532524
WeekOfMonth.normalize
533525
WeekOfMonth.rule_code
534526
WeekOfMonth.n
527+
WeekOfMonth.week
535528

536529
Methods
537530
~~~~~~~
@@ -545,6 +538,7 @@ Methods
545538
WeekOfMonth.is_anchored
546539
WeekOfMonth.is_on_offset
547540
WeekOfMonth.__call__
541+
WeekOfMonth.weekday
548542

549543
LastWeekOfMonth
550544
---------------
@@ -565,6 +559,8 @@ Properties
565559
LastWeekOfMonth.normalize
566560
LastWeekOfMonth.rule_code
567561
LastWeekOfMonth.n
562+
LastWeekOfMonth.weekday
563+
LastWeekOfMonth.week
568564

569565
Methods
570566
~~~~~~~
@@ -916,6 +912,7 @@ Properties
916912
FY5253Quarter.normalize
917913
FY5253Quarter.rule_code
918914
FY5253Quarter.n
915+
FY5253Quarter.qtr_with_extra_week
919916
FY5253Quarter.startingMonth
920917
FY5253Quarter.variation
921918
FY5253Quarter.weekday
@@ -1262,6 +1259,9 @@ Properties
12621259
BDay.offset
12631260
BDay.rule_code
12641261
BDay.n
1262+
BDay.weekmask
1263+
BDay.holidays
1264+
BDay.calendar
12651265

12661266
Methods
12671267
~~~~~~~
@@ -1377,6 +1377,9 @@ Properties
13771377
CBMonthEnd.offset
13781378
CBMonthEnd.rule_code
13791379
CBMonthEnd.n
1380+
CBMonthEnd.weekmask
1381+
CBMonthEnd.holidays
1382+
CBMonthEnd.calendar
13801383

13811384
Methods
13821385
~~~~~~~
@@ -1418,6 +1421,9 @@ Properties
14181421
CBMonthBegin.offset
14191422
CBMonthBegin.rule_code
14201423
CBMonthBegin.n
1424+
CBMonthBegin.weekmask
1425+
CBMonthBegin.holidays
1426+
CBMonthBegin.calendar
14211427

14221428
Methods
14231429
~~~~~~~
@@ -1456,6 +1462,9 @@ Properties
14561462
CDay.offset
14571463
CDay.rule_code
14581464
CDay.n
1465+
CDay.weekmask
1466+
CDay.calendar
1467+
CDay.holidays
14591468

14601469
Methods
14611470
~~~~~~~
@@ -1473,6 +1482,7 @@ Methods
14731482
CDay.rollforward
14741483
CDay.__call__
14751484

1485+
14761486
.. _api.frequencies:
14771487

14781488
===========

doc/source/reference/series.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,12 +240,13 @@ Reshaping, sorting
240240
Series.squeeze
241241
Series.view
242242

243-
Combining / joining / merging
244-
-----------------------------
243+
Combining / comparing / joining / merging
244+
-----------------------------------------
245245
.. autosummary::
246246
:toctree: api/
247247

248248
Series.append
249+
Series.compare
249250
Series.replace
250251
Series.update
251252

doc/source/user_guide/gotchas.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ Byte-ordering issues
321321
--------------------
322322
Occasionally you may have to deal with data that were created on a machine with
323323
a different byte order than the one on which you are running Python. A common
324-
symptom of this issue is an error like:::
324+
symptom of this issue is an error like::
325325

326326
Traceback
327327
...

0 commit comments

Comments
 (0)