10000 Merge in master from upstream. · pandas-dev/pandas@a1e3afe · GitHub
[go: up one dir, main page]

Skip to content

Commit a1e3afe

Browse files
committed
Merge in master from upstream.
2 parents 8663be2 + f75a220 commit a1e3afe

File tree

117 files changed

+2452
-996
lines changed

Some content is hidden

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

117 files changed

+2452
-996
lines changed

.github/CONTRIBUTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ Our main contributing guide can be found [in this repo](https://github.com/panda
88

99
If you are looking to contribute to the *pandas* codebase, the best place to start is the [GitHub "issues" tab](https://github.com/pandas-dev/pandas/issues). This is also a great place for filing bug reports and making suggestions for ways in which we can improve the code and documentation.
1010

11-
If you have additional questions, feel free to ask them on the [mailing list](https://groups.google.com/forum/?fromgroups#!forum/pydata) or on [Gitter](https://gitter.im/pydata/pandas). Further information can also be found in the "[Where to start?](https://github.com/pandas-dev/pandas/blob/master/doc/source/contributing.rst#where-to-start)" section.
11+
If you have additional questions, feel free to ask them on the [mailing list](https://groups.google.com/forum/?fromgroups#!forum/pydata) or on [Gitter](https://gitter.im/pydata/pandas). Further information can also be found in the "[Where to start?](https://github.com/pandas-dev/pandas/blob/master/doc/source/development/contributing.rst#where-to-start)" section.
1212

1313
## Filing Issues
1414

15-
If you notice a bug in the code or documentation, or have suggestions for how we can improve either, feel free to create an issue on the [GitHub "issues" tab](https://github.com/pandas-dev/pandas/issues) using [GitHub's "issue" form](https://github.com/pandas-dev/pandas/issues/new). The form contains some questions that will help us best address your issue. For more information regarding how to file issues against *pandas*, please refer to the "[Bug reports and enhancement requests](https://github.com/pandas-dev/pandas/blob/master/doc/source/contributing.rst#bug-reports-and-enhancement-requests)" section.
15+
If you notice a bug in the code or documentation, or have suggestions for how we can improve either, feel free to create an issue on the [GitHub "issues" tab](https://github.com/pandas-dev/pandas/issues) using [GitHub's "issue" form](https://github.com/pandas-dev/pandas/issues/new). The form contains some questions that will help us best address your issue. For more information regarding how to file issues against *pandas*, please refer to the "[Bug reports and enhancement requests](https://github.com/pandas-dev/pandas/blob/master/doc/source/development/contributing.rst#bug-reports-and-enhancement-requests)" section.
1616

1717
## Contributing to the Codebase
1818

19-
The code is hosted on [GitHub](https://www.github.com/pandas-dev/pandas), so you will need to use [Git](http://git-scm.com/) to clone the project and make changes to the codebase. Once you have obtained a copy of the code, you should create a development environment that is separate from your existing Python environment so that you can make and test changes without compromising your own work environment. For more information, please refer to the "[Working with the code](https://github.com/pandas-dev/pandas/blob/master/doc/source/contributing.rst#working-with-the-code)" section.
19+
The code is hosted on [GitHub](https://www.github.com/pandas-dev/pandas), so you will need to use [Git](http://git-scm.com/) to clone the project and make changes to the codebase. Once you have obtained a copy of the code, you should create a development environment that is separate from your existing Python environment so that you can make and test changes without compromising your own work environment. For more information, please refer to the "[Working with the code](https://github.com/pandas-dev/pandas/blob/master/doc/source/development/contributing.rst#working-with-the-code)" section.
2020

21-
Before submitting your changes for review, make sure to check that your changes do not break any tests. You can find more information about our test suites in the "[Test-driven development/code writing](https://github.com/pandas-dev/pandas/blob/master/doc/source/contributing.rst#test-driven-development-code-writing)" section. We also have guidelines regarding coding style that will be enforced during testing, which can be found in the "[Code standards](https://github.com/pandas-dev/pandas/blob/master/doc/source/contributing.rst#code-standards)" section.
21+
Before submitting your changes for review, make sure to check that your changes do not break any tests. You can find more information about our test suites in the "[Test-driven development/code writing](https://github.com/pandas-dev/pandas/blob/master/doc/source/contributing.rst#test-driven-development-code-writing)" section. We also have guidelines regarding coding style that will be enforced during testing, which can be found in the "[Code standards](https://github.com/pandas-dev/pandas/blob/master/doc/source/development/contributing.rst#code-standards)" section.
2222

23-
Once your changes are ready to be submitted, make sure to push your changes to GitHub before creating a pull request. Details about how to do that can be found in the "[Contributing your changes to pandas](https://github.com/pandas-dev/pandas/blob/master/doc/source/contributing.rst#contributing-your-changes-to-pandas)" section. We will review your changes, and you will most likely be asked to make additional changes before it is finally ready to merge. However, once it's ready, we will merge it, and you will have successfully contributed to the codebase!
23+
Once your changes are ready to be submitted, make sure to push your changes to GitHub before creating a pull request. Details about how to do that can be found in the "[Contributing your changes to pandas](https://github.com/pandas-dev/pandas/blob/master/doc/source/development/contributing.rst#contributing-your-changes-to-pandas)" section. We will review your changes, and you will most likely be asked to make additional changes before it is finally ready to merge. However, once it's ready, we will merge it, and you will have successfully contributed to the codebase!

asv_bench/benchmarks/algorithms.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import pandas as pd
66
from pandas.util import testing as tm
77

8-
98
for imp in ['pandas.util', 'pandas.tools.hashing']:
109
try:
1110
hashing = import_module(imp)
@@ -142,4 +141,4 @@ def time_quantile(self, quantile, interpolation, dtype):
142141
self.idx.quantile(quantile, interpolation=interpolation)
143142

144143

145-
from .pandas_vb_common import setup # noqa: F401
144+
from .pandas_vb_common import setup # noqa: F401 isort:skip

asv_bench/benchmarks/strings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ def setup(self, repeats):
102102
N = 10**5
103103
self.s = Series(tm.makeStringIndex(N))
104104
repeat = {'int': 1, 'array': np.random.randint(1, 3, N)}
105-
self.repeat = repeat[repeats]
105+
self.values = repeat[repeats]
106106

107107
def time_repeat(self, repeats):
108-
self.s.str.repeat(self.repeat)
108+
self.s.str.repeat(self.values)
109109

110110

111111
class Cat(object):

doc/source/user_guide/groupby.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ steps:
1515

1616
Out of these, the split step is the most straightforward. In fact, in many
1717
situations we may wish to split the data set into groups and do something with
18-
those groups. In the apply step, we might wish to one of the
18+
those groups. In the apply step, we might wish to do one of the
1919
following:
2020

2121
* **Aggregation**: compute a summary statistic (or statistics) for each

doc/source/user_guide/io.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,36 @@ a single date rather than the entire array.
989989
990990
os.remove('tmp.csv')
991991
992+
993+
.. _io.csv.mixed_timezones:
994+
995+
Parsing a CSV with mixed Timezones
996+
++++++++++++++++++++++++++++++++++
997+
998+
Pandas cannot natively represent a column or index with mixed timezones. If your CSV
999+
file contains columns with a mixture of timezones, the default result will be
1000+
an object-dtype column with strings, even with ``parse_dates``.
1001+
1002+
1003+
.. ipython:: python
1004+
1005+
content = """\
1006+
a
1007+
2000-01-01T00:00:00+05:00
1008+
2000-01-01T00:00:00+06:00"""
1009+
df = pd.read_csv(StringIO(content), parse_dates=['a'])
1010+
df['a']
1011+
1012+
To parse the mixed-timezone values as a datetime column, pass a partially-applied
1013+
:func:`to_datetime` with ``utc=True`` as the ``date_parser``.
1014+
1015+
.. ipython:: python
1016+
1017+
df = pd.read_csv(StringIO(content), parse_dates=['a'],
1018+
date_parser=lambda col: pd.to_datetime(col, utc=True))
1019+
df['a']
1020+
1021+
9921022
.. _io.dayfirst:
9931023

9941024

doc/source/whatsnew/v0.24.0.rst

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,52 @@ that the dates have been converted to UTC
648648
pd.to_datetime(["2015-11-18 15:30:00+05:30",
649649
"2015-11-18 16:30:00+06:30"], utc=True)
650650
651+
652+
.. _whatsnew_0240.api_breaking.read_csv_mixed_tz:
653+
654+
Parsing mixed-timezones with :func:`read_csv`
655+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
656+
657+
:func:`read_csv` no longer silently converts mixed-timezone columns to UTC (:issue:`24987`).
658+
659+
*Previous Behavior*
660+
661+
.. code-block:: python
662+
663+
>>> import io
664+
>>> content = """\
665+
... a
666+
... 2000-01-01T00:00:00+05:00
667+
... 2000-01-01T00:00:00+06:00"""
668+
>>> df = pd.read_csv(io.StringIO(content), parse_dates=['a'])
669+
>>> df.a
670+
0 1999-12-31 19:00:00
671+
1 1999-12-31 18:00:00
672+
Name: a, dtype: datetime64[ns]
673+
674+
*New Behavior*
675+
676+
.. ipython:: python
677+
678+
import io
679+
content = """\
680+
a
681+
2000-01-01T00:00:00+05:00
682+
2000-01-01T00:00:00+06:00"""
683+
df = pd.read_csv(io.StringIO(content), parse_dates=['a'])
684+
df.a
685+
686+
As can be seen, the ``dtype`` is object; each value in the column is a string.
687+
To convert the strings to an array of datetimes, the ``date_parser`` argument
688+
689+
.. ipython:: python
690+
691+
df = pd.read_csv(io.StringIO(content), parse_dates=['a'],
692+
date_parser=lambda col: pd.to_datetime(col, utc=True))
693+
df.a
694+
695+
See :ref:`whatsnew_0240.api.timezone_offset_parsing` for more.
696+
651697
.. _whatsnew_0240.api_breaking.period_end_time:
652698

653699
Time values in ``dt.end_time`` and ``to_timestamp(how='end')``

doc/source/whatsnew/v0.24.1.rst

Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -13,64 +13,66 @@ Whats New in 0.24.1 (February XX, 2019)
1313
{{ header }}
1414

1515
These are the changes in pandas 0.24.1. See :ref:`release` for a full changelog
16-
including other versions of pandas.
16+
including other versions of pandas. See :ref:`whatsnew_0240` for the 0.24.0 changelog.
1717

18+
.. _whatsnew_0241.api:
1819

19-
.. _whatsnew_0241.enhancements:
20+
API Changes
21+
~~~~~~~~~~~
2022

21-
Enhancements
22-
^^^^^^^^^^^^
23+
Changing the ``sort`` parameter for :class:`Index` set operations
24+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2325

26+
The default ``sort`` value for :meth:`Index.union` has changed from ``True`` to ``None`` (:issue:`24959`).
27+
The default *behavior*, however, remains the same: the result is sorted, unless
2428

25-
.. _whatsnew_0241.bug_fixes:
29+
1. ``self`` and ``other`` are identical
30+
2. ``self`` or ``other`` is empty
31+
3. ``self`` or ``other`` contain values that can not be compared (a ``RuntimeWarning`` is raised).
2632

27-
Bug Fixes
28-
~~~~~~~~~
33+
This change will allow ``sort=True`` to mean "always sort" in a future release.
2934

30-
**Conversion**
35+
The same change applies to :meth:`Index.difference` and :meth:`Index.symmetric_difference`, which
36+
would not sort the result when the values could not be compared.
3137

32-
-
33-
-
34-
-
38+
The `sort` option for :meth:`Index.intersection` has changed in three ways.
3539

36-
**Indexing**
40+
1. The default has changed from ``True`` to ``False``, to restore the
41+
pandas 0.23.4 and earlier behavior of not sorting by default.
42+
2. The behavior of ``sort=True`` can now be obtained with ``sort=None``.
43+
This will sort the result only if the values in ``self`` and ``other``
44+
are not identical.
45+
3. The value ``sort=True`` is no longer allowed. A future version of pandas
46+
will properly support ``sort=True`` meaning "always sort".
3747

38-
-
39-
-
40-
-
48+
.. _whatsnew_0241.regressions:
4149

42-
**I/O**
50+
Fixed Regressions
51+
~~~~~~~~~~~~~~~~~
4352

44-
-
45-
-
46-
-
53+
- Bug in :meth:`DataFrame.itertuples` with ``records`` orient raising an ``AttributeError`` when the ``DataFrame`` contained more than 255 columns (:issue:`24939`)
54+
- Bug in :meth:`DataFrame.itertuples` orient converting integer column names to strings prepended with an underscore (:issue:`24940`)
55+
- Fixed regression in :func:`read_sql` when passing certain queries with MySQL/pymysql (:issue:`24988`).
56+
- Fixed regression in :class:`Index.intersection` incorrectly sorting the values by default (:issue:`24959`).
57+
- Fixed regression in :func:`merge` when merging an empty ``DataFrame`` with multiple timezone-aware columns on one of the timezone-aware columns (:issue:`25014`).
58+
- Fixed regression in :meth:`Series.rename_axis` and :meth:`DataFrame.rename_axis` where passing ``None`` failed to remove the axis name (:issue:`25034`)
4759

48-
**Categorical**
60+
**Timedelta**
4961

50-
-
51-
-
52-
-
62+
- Bug in :func:`to_timedelta` with `box=False` incorrectly returning a ``datetime64`` object instead of a ``timedelta64`` object (:issue:`24961`)
5363

54-
**Timezones**
64+
**Reshaping**
5565

56-
-
57-
-
58-
-
66+
- Bug in :meth:`DataFrame.groupby` with :class:`Grouper` when there is a time change (DST) and grouping frequency is ``'1d'`` (:issue:`24972`)
5967

60-
**Timedelta**
68+
**Visualization**
6169

62-
-
63-
-
64-
-
65-
66-
**Reshaping**
70+
- Fixed the warning for implicitly registered matplotlib converters not showing. See :ref:`whatsnew_0211.converters` for more (:issue:`24963`).
6771

68-
- Bug in :func:`merge` when merging by index name would sometimes result in an incorrectly numbered index (:issue:`24212`)
6972

7073
**Other**
7174

72-
-
73-
-
75+
- Fixed AttributeError when printing a DataFrame's HTML repr after accessing the IPython config object (:issue:`25036`)
7476

7577
.. _whatsnew_0.241.contributors:
7678

doc/source/whatsnew/v0.24.2.rst

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
:orphan:
2+
3+
.. _whatsnew_0242:
4+
5+
Whats New in 0.24.2 (February XX, 2019)
6+
---------------------------------------
7+
8+
.. warning::
9+
10+
The 0.24.x series of releases will be the last to support Python 2. Future feature
11+
releases will support Python 3 only. See :ref:`install.dropping-27` for more.
12+
13+
{{ header }}
14+
15+
These are the changes in pandas 0.24.2. See :ref:`release` for a full changelog
16+
including other versions of pandas.
17+
18+
.. _whatsnew_0242.regressions:
19+
20+
Fixed Regressions
21+
^^^^^^^^^^^^^^^^^
22+
23+
-
24+
-
25+
-
26+
27+
.. _whatsnew_0242.enhancements:
28+
29+
Enhancements
30+
^^^^^^^^^^^^
31+
32+
-
33+
-
34+
35+
.. _whatsnew_0242.bug_fixes:
36+
37+
Bug Fixes
38+
~~~~~~~~~
39+
40+
**Conversion**
41+
42+
-
43+
-
44+
-
45+
46+
**Indexing**
47+
48+
-
49+
-
50+
-
51+
52+
**I/O**
53+
54+
-
55+
-
56+
-
57+
58+
**Categorical**
59+
60+
-
61+
-
62+
-
63+
64+
**Timezones**
65+
66+
-
67+
-
68+
-
69+
70+
**Timedelta**
71+
72+
-
73+
-
74+
-
75+
76+
**Reshaping**
77+
78+
-
79+
-
80+
-
81+
82+
**Visualization**
83+
84+
-
85+
-
86+
-
87+
88+
**Other**
89+
90+
-
91+
-
92+
-
93+
94+
.. _whatsnew_0.242.contributors:
95+
96+
Contributors
97+
~~~~~~~~~~~~
98+
99+
.. contributors:: v0.24.1..v0.24.2

0 commit comments

Comments
 (0)
0