Skip to content

Commit 618bc46

Browse files
authored
Merge branch 'master' into fix_4792
2 parents 184378d + c23b1a4 commit 618bc46

File tree

265 files changed

+13883
-19538
lines changed

Some content is hidden

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

265 files changed

+13883
-19538
lines changed

ci/requirements-2.7.run

-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,5 @@ patsy
1818
pymysql=0.6.3
1919
html5lib=1.0b2
2020
beautiful-soup=4.2.1
21-
statsmodels
2221
jinja2=2.8
2322
xarray=0.8.0

ci/requirements-2.7_COMPAT.run

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ pytz=2013b
44
scipy=0.11.0
55
xlwt=0.7.5
66
xlrd=0.9.2
7-
statsmodels=0.4.3
87
bottleneck=0.8.0
98
numexpr=2.2.2
109
pytables=3.0.0

ci/requirements-2.7_LOCALE.run

-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,4 @@ html5lib=1.0b2
1313
lxml=3.2.1
1414
scipy=0.11.0
1515
beautiful-soup=4.2.1
16-
statsmodels=0.4.3
1716
bigquery=2.0.17

ci/requirements-2.7_SLOW.run

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ numpy=1.8.2
44
matplotlib=1.3.1
55
scipy
66
patsy
7-
statsmodels
87
xlwt
98
openpyxl
109
xlsxwriter

ci/requirements-3.4_SLOW.pip

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
httplib2
2+
google-api-python-client
3+
oauth2client

ci/requirements-3.4_SLOW.run

-1
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,4 @@ sqlalchemy
1717
bottleneck
1818
pymysql
1919
psycopg2
20-
statsmodels
2120
jinja2=2.8

doc/source/install.rst

+5-8
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,9 @@ Optional Dependencies
250250
* `Feather Format <https://github.com/wesm/feather>`__: necessary for feather-based storage, version 0.3.1 or higher.
251251
* `SQLAlchemy <http://www.sqlalchemy.org>`__: for SQL database support. Version 0.8.1 or higher recommended. Besides SQLAlchemy, you also need a database specific driver. You can find an overview of supported drivers for each SQL dialect in the `SQLAlchemy docs <http://docs.sqlalchemy.org/en/latest/dialects/index.html>`__. Some common drivers are:
252252

253-
- `psycopg2 <http://initd.org/psycopg/>`__: for PostgreSQL
254-
- `pymysql <https://github.com/PyMySQL/PyMySQL>`__: for MySQL.
255-
- `SQLite <https://docs.python.org/3.5/library/sqlite3.html>`__: for SQLite, this is included in Python's standard library by default.
253+
* `psycopg2 <http://initd.org/psycopg/>`__: for PostgreSQL
254+
* `pymysql <https://github.com/PyMySQL/PyMySQL>`__: for MySQL.
255+
* `SQLite <https://docs.python.org/3.5/library/sqlite3.html>`__: for SQLite, this is included in Python's standard library by default.
256256

257257
* `matplotlib <http://matplotlib.org/>`__: for plotting
258258
* For Excel I/O:
@@ -272,11 +272,8 @@ Optional Dependencies
272272
<http://www.vergenet.net/~conrad/software/xsel/>`__, or `xclip
273273
<https://github.com/astrand/xclip/>`__: necessary to use
274274
:func:`~pandas.read_clipboard`. Most package managers on Linux distributions will have ``xclip`` and/or ``xsel`` immediately available for installation.
275-
* Google's `python-gflags <<https://github.com/google/python-gflags/>`__ ,
276-
`oauth2client <https://github.com/google/oauth2client>`__ ,
277-
`httplib2 <http://pypi.python.org/pypi/httplib2>`__
278-
and `google-api-python-client <http://github.com/google/google-api-python-client>`__
279-
: Needed for :mod:`~pandas.io.gbq`
275+
* For Google BigQuery I/O - see :ref:`here <io.bigquery_deps>`.
276+
280277
* `Backports.lzma <https://pypi.python.org/pypi/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.
281278
* One of the following combinations of libraries is needed to use the
282279
top-level :func:`~pandas.read_html` function:

doc/source/io.rst

+47-14
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ object.
3939
* :ref:`read_json<io.json_reader>`
4040
* :ref:`read_msgpack<io.msgpack>`
4141
* :ref:`read_html<io.read_html>`
42-
* :ref:`read_gbq<io.bigquery_reader>`
42+
* :ref:`read_gbq<io.bigquery>`
4343
* :ref:`read_stata<io.stata_reader>`
4444
* :ref:`read_sas<io.sas_reader>`
4545
* :ref:`read_clipboard<io.clipboard>`
@@ -55,7 +55,7 @@ The corresponding ``writer`` functions are object methods that are accessed like
5555
* :ref:`to_json<io.json_writer>`
5656
* :ref:`to_msgpack<io.msgpack>`
5757
* :ref:`to_html<io.html>`
58-
* :ref:`to_gbq<io.bigquery_writer>`
58+
* :ref:`to_gbq<io.bigquery>`
5959
* :ref:`to_stata<io.stata_writer>`
6060
* :ref:`to_clipboard<io.clipboard>`
6161
* :ref:`to_pickle<io.pickle>`
@@ -4648,16 +4648,11 @@ DataFrame with a shape and data types derived from the source table.
46484648
Additionally, DataFrames can be inserted into new BigQuery tables or appended
46494649
to existing tables.
46504650

4651-
You will need to install some additional dependencies:
4652-
4653-
- Google's `python-gflags <https://github.com/google/python-gflags/>`__
4654-
- `httplib2 <http://pypi.python.org/pypi/httplib2>`__
4655-
- `google-api-python-client <http://github.com/google/google-api-python-client>`__
4656-
46574651
.. warning::
46584652

46594653
To use this module, you will need a valid BigQuery account. Refer to the
4660-
`BigQuery Documentation <https://cloud.google.com/bigquery/what-is-bigquery>`__ for details on the service itself.
4654+
`BigQuery Documentation <https://cloud.google.com/bigquery/what-is-bigquery>`__
4655+
for details on the service itself.
46614656

46624657
The key functions are:
46634658

@@ -4671,7 +4666,44 @@ The key functions are:
46714666

46724667
.. currentmodule:: pandas
46734668

4674-
.. _io.bigquery_reader:
4669+
4670+
Supported Data Types
4671+
++++++++++++++++++++
4672+
4673+
Pandas supports all these `BigQuery data types <https://cloud.google.com/bigquery/data-types>`__:
4674+
``STRING``, ``INTEGER`` (64bit), ``FLOAT`` (64 bit), ``BOOLEAN`` and
4675+
``TIMESTAMP`` (microsecond precision). Data types ``BYTES`` and ``RECORD``
4676+
are not supported.
4677+
4678+
Integer and boolean ``NA`` handling
4679+
+++++++++++++++++++++++++++++++++++
4680+
4681+
.. versionadded:: 0.20
4682+
4683+
Since all columns in BigQuery queries are nullable, and NumPy lacks of ``NA``
4684+
support for integer and boolean types, this module will store ``INTEGER`` or
4685+
``BOOLEAN`` columns with at least one ``NULL`` value as ``dtype=object``.
4686+
Otherwise those columns will be stored as ``dtype=int64`` or ``dtype=bool``
4687+
respectively.
4688+
4689+
This is opposite to default pandas behaviour which will promote integer
4690+
type to float in order to store NAs. See the :ref:`gotchas<gotchas.intna>`
4691+
for detailed explaination.
4692+
4693+
While this trade-off works well for most cases, it breaks down for storing
4694+
values greater than 2**53. Such values in BigQuery can represent identifiers
4695+
and unnoticed precision lost for identifier is what we want to avoid.
4696+
4697+
.. _io.bigquery_deps:
4698+
4699+
Dependencies
4700+
++++++++++++
4701+
4702+
This module requires following additional dependencies:
4703+
4704+
- `httplib2 <https://github.com/httplib2/httplib2>`__: HTTP client
4705+
- `google-api-python-client <http://github.com/google/google-api-python-client>`__: Google's API client
4706+
- `oauth2client <https://github.com/google/oauth2client>`__: authentication and authorization for Google's API
46754707

46764708
.. _io.bigquery_authentication:
46774709

@@ -4686,7 +4718,7 @@ Is possible to authenticate with either user account credentials or service acco
46864718
Authenticating with user account credentials is as simple as following the prompts in a browser window
46874719
which will be automatically opened for you. You will be authenticated to the specified
46884720
``BigQuery`` account using the product name ``pandas GBQ``. It is only possible on local host.
4689-
The remote authentication using user account credentials is not currently supported in Pandas.
4721+
The remote authentication using user account credentials is not currently supported in pandas.
46904722
Additional information on the authentication mechanism can be found
46914723
`here <https://developers.google.com/identity/protocols/OAuth2#clientside/>`__.
46924724

@@ -4695,8 +4727,6 @@ is particularly useful when working on remote servers (eg. jupyter iPython noteb
46954727
Additional information on service accounts can be found
46964728
`here <https://developers.google.com/identity/protocols/OAuth2#serviceaccount>`__.
46974729

4698-
You will need to install an additional dependency: `oauth2client <https://github.com/google/oauth2client>`__.
4699-
47004730
Authentication via ``application default credentials`` is also possible. This is only valid
47014731
if the parameter ``private_key`` is not provided. This method also requires that
47024732
the credentials can be fetched from the environment the code is running in.
@@ -4716,6 +4746,7 @@ Additional information on
47164746
A private key can be obtained from the Google developers console by clicking
47174747
`here <https://console.developers.google.com/permissions/serviceaccounts>`__. Use JSON key type.
47184748

4749+
.. _io.bigquery_reader:
47194750

47204751
Querying
47214752
''''''''
@@ -4775,7 +4806,6 @@ For more information about query configuration parameters see
47754806

47764807
.. _io.bigquery_writer:
47774808

4778-
47794809
Writing DataFrames
47804810
''''''''''''''''''
47814811

@@ -4865,6 +4895,8 @@ For example:
48654895
often as the service seems to be changing and evolving. BiqQuery is best for analyzing large
48664896
sets of data quickly, but it is not a direct replacement for a transactional database.
48674897

4898+
.. _io.bigquery_create_tables:
4899+
48684900
Creating BigQuery Tables
48694901
''''''''''''''''''''''''
48704902

@@ -4894,6 +4926,7 @@ produce the dictionary representation schema of the specified pandas DataFrame.
48944926
the new table with a different name. Refer to
48954927
`Google BigQuery issue 191 <https://code.google.com/p/google-bigquery/issues/detail?id=191>`__.
48964928

4929+
48974930
.. _io.stata:
48984931

48994932
Stata Format

doc/source/whatsnew/v0.20.0.txt

+10-2
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ support for bz2 compression in the python 2 c-engine improved (:issue:`14874`).
9696

9797
.. _whatsnew_0200.enhancements.uint64_support:
9898

99+
UInt64 Support Improved
100+
^^^^^^^^^^^^^^^^^^^^^^^
101+
99102
Pandas has significantly improved support for operations involving unsigned,
100103
or purely non-negative, integers. Previously, handling these integers would
101104
result in improper rounding or data-type casting, leading to incorrect results.
@@ -146,6 +149,7 @@ Other enhancements
146149
- ``Series/DataFrame.asfreq()`` have gained a ``fill_value`` parameter, to fill missing values (:issue:`3715`).
147150
- ``Series/DataFrame.resample.asfreq`` have gained a ``fill_value`` parameter, to fill missing values during resampling (:issue:`3715`).
148151
- ``pandas.tools.hashing`` has gained a ``hash_tuples`` routine, and ``hash_pandas_object`` has gained the ability to hash a ``MultiIndex`` (:issue:`15224`)
152+
- ``Series/DataFrame.squeeze()`` have gained the ``axis`` parameter. (:issue:`15339`)
149153

150154
.. _ISO 8601 duration: https://en.wikipedia.org/wiki/ISO_8601#Durations
151155

@@ -418,7 +422,8 @@ Other API Changes
418422
- ``pd.read_csv()`` will now raise a ``ValueError`` for the C engine if the quote character is larger than than one byte (:issue:`11592`)
419423
- ``inplace`` arguments now require a boolean value, else a ``ValueError`` is thrown (:issue:`14189`)
420424
- ``pandas.api.types.is_datetime64_ns_dtype`` will now report ``True`` on a tz-aware dtype, similar to ``pandas.api.types.is_datetime64_any_dtype``
421-
- ``DataFrame.asof()`` will return a null filled ``Series`` instead the scalar ``NaN`` if a match is not found (:issue:`15118`)
425+
- ``DataFrame.asof()`` will return a null filled ``Series`` instead the scalar ``NaN`` if a match is not found (:issue:`15118`)
426+
- The :func:`pd.read_gbq` method now stores ``INTEGER`` columns as ``dtype=object`` if they contain ``NULL`` values. Otherwise they are stored as ``int64``. This prevents precision lost for integers greather than 2**53. Furthermore ``FLOAT`` columns with values above 10**4 are no more casted to ``int64`` which also caused precision lost (:issue: `14064`, :issue:`14305`).
422427

423428
.. _whatsnew_0200.deprecations:
424429

@@ -446,7 +451,7 @@ Removal of prior version deprecations/changes
446451
- The ``pandas.io.ga`` module with a ``google-analytics`` interface is removed (:issue:`11308`).
447452
Similar functionality can be found in the `Google2Pandas <https://github.com/panalysis/Google2Pandas>`__ package.
448453
- ``pd.to_datetime`` and ``pd.to_timedelta`` have dropped the ``coerce`` parameter in favor of ``errors`` (:issue:`13602`)
449-
454+
- ``pandas.stats.fama_macbeth``, ``pandas.stats.ols``, ``pandas.stats.plm`` and ``pandas.stats.var``, as well as the top-level ``pandas.fama_macbeth`` and ``pandas.ols`` routines are removed. Similar functionaility can be found in the `statsmodels <shttp://www.statsmodels.org/dev/>`__ package. (:issue:`11898`)
450455

451456

452457

@@ -485,9 +490,11 @@ Bug Fixes
485490
- Bug in ``pd.read_csv()`` in which missing data was being improperly handled with ``usecols`` (:issue:`6710`)
486491
- Bug in ``pd.read_csv()`` in which a file containing a row with many columns followed by rows with fewer columns would cause a crash (:issue:`14125`)
487492
- Bug in ``pd.tools.hashing.hash_pandas_object()`` in which hashing of categoricals depended on the ordering of categories, instead of just their values. (:issue:`15143`)
493+
- Bug in ``.groupby(..).resample()`` when passed the ``on=`` kwarg. (:issue:`15021`)
488494

489495
- Bug in ``DataFrame.loc`` with indexing a ``MultiIndex`` with a ``Series`` indexer (:issue:`14730`)
490496

497+
491498
- Bug in ``pd.read_msgpack()`` in which ``Series`` categoricals were being improperly processed (:issue:`14901`)
492499
- Bug in ``Series.ffill()`` with mixed dtypes containing tz-aware datetimes. (:issue:`14956`)
493500

@@ -566,3 +573,4 @@ Bug Fixes
566573

567574
- Bug in ``DataFrame.boxplot`` where ``fontsize`` was not applied to the tick labels on both axes (:issue:`15108`)
568575
- Bug in ``Series.replace`` and ``DataFrame.replace`` which failed on empty replacement dicts (:issue:`15289`)
576+
- Bug in ``.eval()`` which caused multiline evals to fail with local variables not on the first line (:issue:`15342`)

pandas/__init__.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
missing_dependencies.append(dependency)
1616

1717
if missing_dependencies:
18-
raise ImportError("Missing required dependencies {0}".format(missing_dependencies))
18+
raise ImportError(
19+
"Missing required dependencies {0}".format(missing_dependencies))
1920
del hard_dependencies, dependency, missing_dependencies
2021

2122
# numpy compat
@@ -24,7 +25,8 @@
2425
try:
2526
from pandas import hashtable, tslib, lib
2627
except ImportError as e: # pragma: no cover
27-
module = str(e).lstrip('cannot import name ') # hack but overkill to use re
28+
# hack but overkill to use re
29+
module = str(e).lstrip('cannot import name ')
2830
raise ImportError("C extension: {0} not built. If you want to import "
2931
"pandas from the source directory, you may need to run "
3032
"'python setup.py build_ext --inplace --force' to build "
@@ -61,5 +63,5 @@
6163
# use the closest tagged version if possible
6264
from ._version import get_versions
6365
v = get_versions()
64-
__version__ = v.get('closest-tag',v['version'])
66+
__version__ = v.get('closest-tag', v['version'])
6567
del get_versions, v

pandas/_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose):
157157
# "stabilization", as well as "HEAD" and "master".
158158
tags = set([r for r in refs if re.search(r'\d', r)])
159159
if verbose:
160-
print("discarding '%s', no digits" % ",".join(refs-tags))
160+
print("discarding '%s', no digits" % ",".join(refs - tags))
161161
if verbose:
162162
print("likely tags: %s" % ",".join(sorted(tags)))
163163
for ref in sorted(tags):

pandas/api/tests/test_api.py

+2-9
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
from pandas.api import types
99
from pandas.util import testing as tm
1010

11-
_multiprocess_can_split_ = True
12-
1311

1412
class Base(object):
1513

@@ -44,7 +42,7 @@ class TestPDApi(Base, tm.TestCase):
4442
'json', 'lib', 'index', 'parser']
4543

4644
# these are already deprecated; awaiting removal
47-
deprecated_modules = ['ols', 'stats', 'datetools']
45+
deprecated_modules = ['stats', 'datetools']
4846

4947
# misc
5048
misc = ['IndexSlice', 'NaT']
@@ -111,7 +109,7 @@ class TestPDApi(Base, tm.TestCase):
111109
'expanding_max', 'expanding_mean', 'expanding_median',
112110
'expanding_min', 'expanding_quantile',
113111
'expanding_skew', 'expanding_std', 'expanding_sum',
114-
'expanding_var', 'fama_macbeth', 'rolling_apply',
112+
'expanding_var', 'rolling_apply',
115113
'rolling_corr', 'rolling_count', 'rolling_cov',
116114
'rolling_kurt', 'rolling_max', 'rolling_mean',
117115
'rolling_median', 'rolling_min', 'rolling_quantile',
@@ -227,8 +225,3 @@ def test_deprecation_access_obj(self):
227225
with tm.assert_produces_warning(FutureWarning,
228226
check_stacklevel=False):
229227
pd.datetools.monthEnd
230-
231-
if __name__ == '__main__':
232-
import nose
233-
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
234-
exit=False)

0 commit comments

Comments
 (0)