Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into io_csv_docstring_…
Browse files Browse the repository at this point in the history
…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)
  ...
  • Loading branch information
thoo committed Nov 19, 2018
2 parents 5a95500 + deb7b4d commit 7732fbd
Show file tree
Hide file tree
Showing 161 changed files with 6,762 additions and 5,143 deletions.
1 change: 0 additions & 1 deletion .pep8speaks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ pycodestyle:
- W503, # line break before binary operator
- W504, # line break after binary operator
- E402, # module level import not at top of file
- E722, # do not use bare except
- E731, # do not assign a lambda expression, use a def
- C406, # Unnecessary list literal - rewrite as a dict literal.
- C408, # Unnecessary dict call - rewrite as a literal.
Expand Down
38 changes: 31 additions & 7 deletions asv_bench/benchmarks/timeseries.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from datetime import timedelta

import dateutil
import numpy as np
from pandas import to_datetime, date_range, Series, DataFrame, period_range
from pandas.tseries.frequencies import infer_freq
Expand Down Expand Up @@ -57,7 +58,10 @@ def time_to_pydatetime(self, index_type):

class TzLocalize(object):

def setup(self):
params = [None, 'US/Eastern', 'UTC', dateutil.tz.tzutc()]
param_names = 'tz'

def setup(self, tz):
dst_rng = date_range(start='10/29/2000 1:00:00',
end='10/29/2000 1:59:59', freq='S')
self.index = date_range(start='10/29/2000',
Expand All @@ -68,8 +72,8 @@ def setup(self):
end='10/29/2000 3:00:00',
freq='S'))

def time_infer_dst(self):
self.index.tz_localize('US/Eastern', ambiguous='infer')
def time_infer_dst(self, tz):
self.index.tz_localize(tz, ambiguous='infer')


class ResetIndex(object):
Expand Down Expand Up @@ -377,15 +381,35 @@ def time_dup_string_tzoffset_dates(self, cache):

class DatetimeAccessor(object):

def setup(self):
params = [None, 'US/Eastern', 'UTC', dateutil.tz.tzutc()]
param_names = 'tz'

def setup(self, tz):
N = 100000
self.series = Series(date_range(start='1/1/2000', periods=N, freq='T'))
self.series = Series(
date_range(start='1/1/2000', periods=N, freq='T', tz=tz)
)

def time_dt_accessor(self):
def time_dt_accessor(self, tz):
self.series.dt

def time_dt_accessor_normalize(self):
def time_dt_accessor_normalize(self, tz):
self.series.dt.normalize()

def time_dt_accessor_month_name(self, tz):
self.series.dt.month_name()

def time_dt_accessor_day_name(self, tz):
self.series.dt.day_name()

def time_dt_accessor_time(self, tz):
self.series.dt.time

def time_dt_accessor_date(self, tz):
self.series.dt.date

def time_dt_accessor_year(self, tz):
self.series.dt.year


from .pandas_vb_common import setup # noqa: F401
18 changes: 16 additions & 2 deletions asv_bench/benchmarks/timestamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from pandas import Timestamp
import pytz
import dateutil


class TimestampConstruction(object):
Expand Down Expand Up @@ -29,7 +30,8 @@ def time_fromtimestamp(self):


class TimestampProperties(object):
_tzs = [None, pytz.timezone('Europe/Amsterdam')]
_tzs = [None, pytz.timezone('Europe/Amsterdam'), pytz.UTC,
dateutil.tz.tzutc()]
_freqs = [None, 'B']
params = [_tzs, _freqs]
param_names = ['tz', 'freq']
Expand Down Expand Up @@ -87,7 +89,8 @@ def time_microsecond(self, tz, freq):


class TimestampOps(object):
params = [None, 'US/Eastern']
params = [None, 'US/Eastern', pytz.UTC,
dateutil.tz.tzutc()]
param_names = ['tz']

def setup(self, tz):
Expand All @@ -102,6 +105,17 @@ def time_replace_None(self, tz):
def time_to_pydatetime(self, tz):
self.ts.to_pydatetime()

def time_normalize(self, tz):
self.ts.normalize()

def time_tz_convert(self, tz):
if self.ts.tz is not None:
self.ts.tz_convert(tz)

def time_tz_localize(self, tz):
if self.ts.tz is None:
self.ts.tz_localize(tz)


class TimestampAcrossDst(object):
def setup(self):
Expand Down
2 changes: 1 addition & 1 deletion ci/deps/azure-27-compat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dependencies:
- pytz=2013b
- scipy=0.18.1
- sqlalchemy=0.7.8
- xlrd=0.9.2
- xlrd=1.0.0
- xlsxwriter=0.5.2
- xlwt=0.7.5
# universal
Expand Down
2 changes: 1 addition & 1 deletion ci/deps/travis-27-locale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dependencies:
- pytz=2013b
- scipy
- sqlalchemy=0.8.1
- xlrd=0.9.2
- xlrd=1.0.0
- xlsxwriter=0.5.2
- xlwt=0.7.5
# universal
Expand Down
2 changes: 1 addition & 1 deletion ci/deps/travis-27.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ dependencies:
- scipy
- sqlalchemy=0.9.6
- xarray=0.9.6
- xlrd=0.9.2
- xlrd=1.0.0
- xlsxwriter=0.5.2
- xlwt=0.7.5
# universal
Expand Down
6 changes: 3 additions & 3 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ def linkcode_resolve(domain, info):
for part in fullname.split('.'):
try:
obj = getattr(obj, part)
except:
except AttributeError:
return None

try:
Expand All @@ -595,14 +595,14 @@ def linkcode_resolve(domain, info):
fn = inspect.getsourcefile(inspect.unwrap(obj))
else:
fn = inspect.getsourcefile(obj)
except:
except TypeError:
fn = None
if not fn:
return None

try:
source, lineno = inspect.getsourcelines(obj)
except:
except OSError:
lineno = None

if lineno:
Expand Down
19 changes: 6 additions & 13 deletions doc/source/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -591,21 +591,14 @@ run this slightly modified command::

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

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

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

This will list all of the Python files that have been modified. The only ones
that matter during linting are any whose directory filepath begins with "pandas."
For each filepath, copy and paste it after the ``flake8`` command as shown below:

flake8 <python-filepath>

Alternatively, you can install the ``grep`` and ``xargs`` commands via the
`MinGW <http://www.mingw.org/>`__ toolchain, and it will allow you to run the
commands above.
This will also get all the files being changed by the PR (and within the
``pandas/`` folder), and run ``flake8`` on them one after the other.

.. _contributing.import-formatting:

Expand Down
6 changes: 4 additions & 2 deletions doc/source/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ Optional Dependencies
* `matplotlib <http://matplotlib.org/>`__: for plotting, Version 2.0.0 or higher.
* For Excel I/O:

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


* `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.
Expand Down
Loading

0 comments on commit 7732fbd

Please sign in to comment.