Skip to content

Commit 7732fbd

Browse files
committed
Merge remote-tracking branch 'upstream/master' into io_csv_docstring_fixed
* upstream/master: (46 commits) DEPS: bump xlrd min version to 1.0.0 (pandas-dev#23774) BUG: Don't warn if default conflicts with dialect (pandas-dev#23775) BUG: Fixing memory leaks in read_csv (pandas-dev#23072) TST: Extend datetime64 arith tests to array classes, fix several broken cases (pandas-dev#23771) STYLE: Specify bare exceptions in pandas/tests (pandas-dev#23370) ENH: between_time, at_time accept axis parameter (pandas-dev#21799) PERF: Use is_utc check to improve performance of dateutil UTC in DatetimeIndex methods (pandas-dev#23772) CLN: io/formats/html.py: refactor (pandas-dev#22726) API: Make Categorical.searchsorted returns a scalar when supplied a scalar (pandas-dev#23466) TST: Add test case for GH14080 for overflow exception (pandas-dev#23762) BUG: Don't extract header names if none specified (pandas-dev#23703) BUG: Index.str.partition not nan-safe (pandas-dev#23558) (pandas-dev#23618) DEPR: tz_convert in the Timestamp constructor (pandas-dev#23621) PERF: Datetime/Timestamp.normalize for timezone naive datetimes (pandas-dev#23634) TST: Use new arithmetic fixtures, parametrize many more tests (pandas-dev#23757) REF/TST: Add more pytest idiom to parsers tests (pandas-dev#23761) DOC: Add ignore-deprecate argument to validate_docstrings.py (pandas-dev#23650) ENH: update pandas-gbq to 0.8.0, adds credentials arg (pandas-dev#23662) DOC: Improve error message to show correct order (pandas-dev#23652) ENH: Improve error message for empty object array (pandas-dev#23718) ...
2 parents 5a95500 + deb7b4d commit 7732fbd

File tree

161 files changed

+6762
-5143
lines changed

Some content is hidden

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

161 files changed

+6762
-5143
lines changed

.pep8speaks.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ pycodestyle:
1313
- W503, # line break before binary operator
1414
- W504, # line break after binary operator
1515
- E402, # module level import not at top of file
16-
- E722, # do not use bare except
1716
- E731, # do not assign a lambda expression, use a def
1817
- C406, # Unnecessary list literal - rewrite as a dict literal.
1918
- C408, # Unnecessary dict call - rewrite as a literal.

asv_bench/benchmarks/timeseries.py

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from datetime import timedelta
22

3+
import dateutil
34
import numpy as np
45
from pandas import to_datetime, date_range, Series, DataFrame, period_range
56
from pandas.tseries.frequencies import infer_freq
@@ -57,7 +58,10 @@ def time_to_pydatetime(self, index_type):
5758

5859
class TzLocalize(object):
5960

60-
def setup(self):
61+
params = [None, 'US/Eastern', 'UTC', dateutil.tz.tzutc()]
62+
param_names = 'tz'
63+
64+
def setup(self, tz):
6165
dst_rng = date_range(start='10/29/2000 1:00:00',
6266
end='10/29/2000 1:59:59', freq='S')
6367
self.index = date_range(start='10/29/2000',
@@ -68,8 +72,8 @@ def setup(self):
6872
end='10/29/2000 3:00:00',
6973
freq='S'))
7074

71-
def time_infer_dst(self):
72-
self.index.tz_localize('US/Eastern', ambiguous='infer')
75+
def time_infer_dst(self, tz):
76+
self.index.tz_localize(tz, ambiguous='infer')
7377

7478

7579
class ResetIndex(object):
@@ -377,15 +381,35 @@ def time_dup_string_tzoffset_dates(self, cache):
377381

378382
class DatetimeAccessor(object):
379383

380-
def setup(self):
384+
params = [None, 'US/Eastern', 'UTC', dateutil.tz.tzutc()]
385+
param_names = 'tz'
386+
387+
def setup(self, tz):
381388
N = 100000
382-
self.series = Series(date_range(start='1/1/2000', periods=N, freq='T'))
389+
self.series = Series(
390+
date_range(start='1/1/2000', periods=N, freq='T', tz=tz)
391+
)
383392

384-
def time_dt_accessor(self):
393+
def time_dt_accessor(self, tz):
385394
self.series.dt
386395

387-
def time_dt_accessor_normalize(self):
396+
def time_dt_accessor_normalize(self, tz):
388397
self.series.dt.normalize()
389398

399+
def time_dt_accessor_month_name(self, tz):
400+
self.series.dt.month_name()
401+
402+
def time_dt_accessor_day_name(self, tz):
403+
self.series.dt.day_name()
404+
405+
def time_dt_accessor_time(self, tz):
406+
self.series.dt.time
407+
408+
def time_dt_accessor_date(self, tz):
409+
self.series.dt.date
410+
411+
def time_dt_accessor_year(self, tz):
412+
self.series.dt.year
413+
390414

391415
from .pandas_vb_common import setup # noqa: F401

asv_bench/benchmarks/timestamp.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from pandas import Timestamp
44
import pytz
5+
import dateutil
56

67

78
class TimestampConstruction(object):
@@ -29,7 +30,8 @@ def time_fromtimestamp(self):
2930

3031

3132
class TimestampProperties(object):
32-
_tzs = [None, pytz.timezone('Europe/Amsterdam')]
33+
_tzs = [None, pytz.timezone('Europe/Amsterdam'), pytz.UTC,
34+
dateutil.tz.tzutc()]
3335
_freqs = [None, 'B']
3436
params = [_tzs, _freqs]
3537
param_names = ['tz', 'freq']
@@ -87,7 +89,8 @@ def time_microsecond(self, tz, freq):
8789

8890

8991
class TimestampOps(object):
90-
params = [None, 'US/Eastern']
92+
params = [None, 'US/Eastern', pytz.UTC,
93+
dateutil.tz.tzutc()]
9194
param_names = ['tz']
9295

9396
def setup(self, tz):
@@ -102,6 +105,17 @@ def time_replace_None(self, tz):
102105
def time_to_pydatetime(self, tz):
103106
self.ts.to_pydatetime()
104107

108+
def time_normalize(self, tz):
109+
self.ts.normalize()
110+
111+
def time_tz_convert(self, tz):
112+
if self.ts.tz is not None:
113+
self.ts.tz_convert(tz)
114+
115+
def time_tz_localize(self, tz):
116+
if self.ts.tz is None:
117+
self.ts.tz_localize(tz)
118+
105119

106120
class TimestampAcrossDst(object):
107121
def setup(self):

ci/deps/azure-27-compat.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ dependencies:
1616
- pytz=2013b
1717
- scipy=0.18.1
1818
- sqlalchemy=0.7.8
19-
- xlrd=0.9.2
19+
- xlrd=1.0.0
2020
- xlsxwriter=0.5.2
2121
- xlwt=0.7.5
2222
# universal

ci/deps/travis-27-locale.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ dependencies:
1616
- pytz=2013b
1717
- scipy
1818
- sqlalchemy=0.8.1
19-
- xlrd=0.9.2
19+
- xlrd=1.0.0
2020
- xlsxwriter=0.5.2
2121
- xlwt=0.7.5
2222
# universal

ci/deps/travis-27.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ dependencies:
3535
- scipy
3636
- sqlalchemy=0.9.6
3737
- xarray=0.9.6
38-
- xlrd=0.9.2
38+
- xlrd=1.0.0
3939
- xlsxwriter=0.5.2
4040
- xlwt=0.7.5
4141
# universal

doc/source/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ def linkcode_resolve(domain, info):
586586
for part in fullname.split('.'):
587587
try:
588588
obj = getattr(obj, part)
589-
except:
589+
except AttributeError:
590590
return None
591591

592592
try:
@@ -595,14 +595,14 @@ def linkcode_resolve(domain, info):
595595
fn = inspect.getsourcefile(inspect.unwrap(obj))
596596
else:
597597
fn = inspect.getsourcefile(obj)
598-
except:
598+
except TypeError:
599599
fn = None
600600
if not fn:
601601
return None
602602

603603
try:
604604
source, lineno = inspect.getsourcelines(obj)
605-
except:
605+
except OSError:
606606
lineno = None
607607

608608
if lineno:

doc/source/contributing.rst

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -591,21 +591,14 @@ run this slightly modified command::
591591

592592
git diff master --name-only -- "*.py" | grep "pandas/" | xargs flake8
593593

594-
Note that on Windows, these commands are unfortunately not possible because
595-
commands like ``grep`` and ``xargs`` are not available natively. To imitate the
596-
behavior with the commands above, you should run::
594+
Windows does not support the ``grep`` and ``xargs`` commands (unless installed
595+
for example via the `MinGW <http://www.mingw.org/>`__ toolchain), but one can
596+
imitate the behaviour as follows::
597597

598-
git diff master --name-only -- "*.py"
598+
for /f %i in ('git diff upstream/master --name-only ^| findstr pandas/') do flake8 %i
599599

600-
This will list all of the Python files that have been modified. The only ones
601-
that matter during linting are any whose directory filepath begins with "pandas."
602-
For each filepath, copy and paste it after the ``flake8`` command as shown below:
603-
604-
flake8 <python-filepath>
605-
606-
Alternatively, you can install the ``grep`` and ``xargs`` commands via the
607-
`MinGW <http://www.mingw.org/>`__ toolchain, and it will allow you to run the
608-
commands above.
600+
This will also get all the files being changed by the PR (and within the
601+
``pandas/`` folder), and run ``flake8`` on them one after the other.
609602

610603
.. _contributing.import-formatting:
611604

doc/source/install.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ Optional Dependencies
269269
* `matplotlib <http://matplotlib.org/>`__: for plotting, Version 2.0.0 or higher.
270270
* For Excel I/O:
271271

272-
* `xlrd/xlwt <http://www.python-excel.org/>`__: Excel reading (xlrd) and writing (xlwt)
272+
* `xlrd/xlwt <http://www.python-excel.org/>`__: Excel reading (xlrd), version 1.0.0 or higher required, and writing (xlwt)
273273
* `openpyxl <https://openpyxl.readthedocs.io/en/stable/>`__: openpyxl version 2.4.0
274274
for writing .xlsx files (xlrd >= 0.9.0)
275275
* `XlsxWriter <https://pypi.org/project/XlsxWriter>`__: Alternative Excel writer
@@ -286,7 +286,9 @@ Optional Dependencies
286286
`xsel <http://www.vergenet.net/~conrad/software/xsel/>`__, or
287287
`xclip <https://github.com/astrand/xclip/>`__: necessary to use
288288
:func:`~pandas.read_clipboard`. Most package managers on Linux distributions will have ``xclip`` and/or ``xsel`` immediately available for installation.
289-
* `pandas-gbq <https://pandas-gbq.readthedocs.io/en/latest/install.html#dependencies>`__: for Google BigQuery I/O.
289+
* `pandas-gbq
290+
<https://pandas-gbq.readthedocs.io/en/latest/install.html#dependencies>`__:
291+
for Google BigQuery I/O. (pandas-gbq >= 0.8.0)
290292

291293

292294
* `Backports.lzma <https://pypi.org/project/backports.lzma/>`__: Only for Python 2, for writing to and/or reading from an xz compressed DataFrame in CSV; Python 3 support is built into the standard library.

0 commit comments

Comments
 (0)