Skip to content

Avoids exception when pandas.io.json.json_normalize contains items in… #14505

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
a560331
Avoids exception when pandas.io.json.json_normalize contains items in…
Oct 26, 2016
050bf60
COMPAT/TST: fix test for range testing of negative integers to neg po…
jreback Oct 26, 2016
66b4c83
BLD: Support Cython 0.25
robertwb Oct 26, 2016
6130e77
BUG: Accept unicode quotechars again in pd.read_csv
gfyoung Oct 26, 2016
6ac759d
BLD: fix 3.4 build for cython to 0.24.1
jreback Oct 26, 2016
31ca717
TST: simplify tests for GH14346 (#14502)
jorisvandenbossche Oct 27, 2016
e7ac84d
DOC: Expand on reference docs for read_json() (#14442)
cswarth Oct 27, 2016
d7fb5bd
BUG: fix DatetimeIndex._maybe_cast_slice_bound for empty index (GH143…
jorisvandenbossche Oct 27, 2016
096d886
MAINT: Expand lint for *.py (#14516)
gfyoung Oct 28, 2016
7f5a45c
BUG/ERR: raise correct error when sql driver is not installed (#14527)
jorisvandenbossche Oct 29, 2016
b793443
Added documentation and test for issue #14505
Oct 30, 2016
1ce6299
DOC: Simplify the gbq integration testing procedure for contributors …
parthea Oct 31, 2016
47f117d
BUG: tseries ceil doc fix (#14543)
tworec Oct 31, 2016
b088112
BUG: Don't parse inline quotes in skipped lines (#14514)
gfyoung Oct 31, 2016
60a335e
BUG: Dataframe constructor when given dict with None value (#14392)
brandonmburroughs Oct 31, 2016
e544362
Update ISSUE_TEMPLATE: be more explicit on where to paste the output …
jorisvandenbossche Nov 1, 2016
c3e25c6
Added keyword errors {'raise'|'ignore}
Nov 1, 2016
8b80562
asv compat for py3
jreback Nov 2, 2016
eb7bd99
BUG: don't close user-provided file handles in C parser (GH14418) (#1…
jorisvandenbossche Nov 2, 2016
52f31d4
BUG: DataFrame.quantile with NaNs (GH14357) (#14536)
jorisvandenbossche Nov 2, 2016
1d95179
PERF: casting loc to labels dtype before searchsorted (#14551)
jorisvandenbossche Nov 2, 2016
093aa82
DEPR: add deprecation warning for com.array_equivalent (#14567)
jorisvandenbossche Nov 3, 2016
7f0c4e0
DOC: rst fixes
jorisvandenbossche Nov 3, 2016
252526c
BUG/API: Index.append with mixed object/Categorical indices (#14545)
jorisvandenbossche Nov 3, 2016
e1cdc4b
DOC: update whatsnew/release notes for 0.19.1 (#14573)
jorisvandenbossche Nov 3, 2016
5aaf8fe
Avoids exception when pandas.io.json.json_normalize contains items in…
Oct 26, 2016
8928270
Added documentation and test for issue #14505
Oct 30, 2016
9848837
Added keyword errors {'raise'|'ignore}
Nov 1, 2016
cc2fdc2
Added documentation and test for issue #14505
Oct 30, 2016
33495bc
Merge branch 'master' of https://github.com/dickreuter/pandas
Nov 3, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
#### Output of ``pd.show_versions()``

<details>
# Paste the output here
# Paste the output here pd.show_versions() here

</details>
8 changes: 4 additions & 4 deletions asv_bench/benchmarks/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ class to_numeric(object):
N = 500000

data_dict = {
'string-int': (['1'] * (N / 2)) + ([2] * (N / 2)),
'string-nint': (['-1'] * (N / 2)) + ([2] * (N / 2)),
'string-int': (['1'] * (N // 2)) + ([2] * (N // 2)),
'string-nint': (['-1'] * (N // 2)) + ([2] * (N // 2)),
'datetime64': np.repeat(np.array(['1970-01-01', '1970-01-02'],
dtype='datetime64[D]'), N),
'string-float': (['1.1'] * (N / 2)) + ([2] * (N / 2)),
'int-list': ([1] * (N / 2)) + ([2] * (N / 2)),
'string-float': (['1.1'] * (N // 2)) + ([2] * (N // 2)),
'int-list': ([1] * (N // 2)) + ([2] * (N // 2)),
'int32': np.repeat(np.int32(1), N)
}

Expand Down
14 changes: 4 additions & 10 deletions ci/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,10 @@ source activate pandas
RET=0

if [ "$LINT" ]; then
echo "Linting"
for path in 'api' 'core' 'indexes' 'types' 'formats' 'io' 'stats' 'compat' 'sparse' 'tools' 'tseries' 'tests' 'computation' 'util'
do
echo "linting -> pandas/$path"
flake8 pandas/$path --filename '*.py'
if [ $? -ne "0" ]; then
RET=1
fi

done
# pandas/rpy is deprecated and will be removed.
# pandas/src is C code, so no need to search there.
echo "Linting *.py"
flake8 pandas --filename '*.py' --exclude pandas/rpy,pandas/src
echo "Linting *.py DONE"

echo "Linting *.pyx"
Expand Down
2 changes: 1 addition & 1 deletion ci/requirements-3.4.build
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
numpy=1.8.1
cython
cython=0.24.1
libgfortran=1.0
11 changes: 5 additions & 6 deletions ci/travis_encrypt_gbq.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#!/bin/bash

GBQ_JSON_FILE=$1
GBQ_PROJECT_ID=$2

if [[ $# -ne 2 ]]; then
if [[ $# -ne 1 ]]; then
echo -e "Too few arguments.\nUsage: ./travis_encrypt_gbq.sh "\
"<gbq-json-credentials-file> <gbq-project-id>"
"<gbq-json-credentials-file>"
exit 1
fi

Expand All @@ -23,9 +22,9 @@ echo "Encrypting $GBQ_JSON_FILE..."
read -d "\n" TRAVIS_KEY TRAVIS_IV <<<$(travis encrypt-file $GBQ_JSON_FILE \
travis_gbq.json.enc -f | grep -o "\w*_iv\|\w*_key");

echo "Adding your secure key and project id to travis_gbq_config.txt ..."
echo -e "TRAVIS_IV_ENV=$TRAVIS_IV\nTRAVIS_KEY_ENV=$TRAVIS_KEY\n"\
"GBQ_PROJECT_ID='$GBQ_PROJECT_ID'" > travis_gbq_config.txt
echo "Adding your secure key to travis_gbq_config.txt ..."
echo -e "TRAVIS_IV_ENV=$TRAVIS_IV\nTRAVIS_KEY_ENV=$TRAVIS_KEY"\
> travis_gbq_config.txt

echo "Done. Removing file $GBQ_JSON_FILE"
rm $GBQ_JSON_FILE
Expand Down
1 change: 0 additions & 1 deletion ci/travis_gbq_config.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
TRAVIS_IV_ENV=encrypted_1d9d7b1f171b_iv
TRAVIS_KEY_ENV=encrypted_1d9d7b1f171b_key
GBQ_PROJECT_ID='pandas-travis'
6 changes: 4 additions & 2 deletions ci/travis_process_gbq_encryption.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

source ci/travis_gbq_config.txt

if [[ -n ${!TRAVIS_IV_ENV} ]]; then
if [[ -n ${SERVICE_ACCOUNT_KEY} ]]; then
echo "${SERVICE_ACCOUNT_KEY}" > ci/travis_gbq.json;
elif [[ -n ${!TRAVIS_IV_ENV} ]]; then
openssl aes-256-cbc -K ${!TRAVIS_KEY_ENV} -iv ${!TRAVIS_IV_ENV} \
-in ci/travis_gbq.json.enc -out ci/travis_gbq.json -d;
export GBQ_PROJECT_ID=$GBQ_PROJECT_ID;
export GBQ_PROJECT_ID='pandas-travis';
echo 'Successfully decrypted gbq credentials'
fi

30 changes: 16 additions & 14 deletions doc/source/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -643,20 +643,22 @@ on Travis-CI and are only accessible from the pandas-dev/pandas repository. The
credentials won't be available on forks of pandas. Here are the steps to run
gbq integration tests on a forked repository:

#. First, complete all the steps in the `Encrypting Files Prerequisites
<https://docs.travis-ci.com/user/encrypting-files/>`__ section.
#. Sign into `Travis <https://travis-ci.org/>`__ using your GitHub account.
#. Enable your forked repository of pandas for testing in `Travis
<https://travis-ci.org/profile/>`__.
#. Run the following command from terminal where the current working directory
is the ``ci`` folder::

./travis_encrypt_gbq.sh <gbq-json-credentials-file> <gbq-project-id>

#. Create a new branch from the branch used in your pull request. Commit the
encrypted file called ``travis_gbq.json.enc`` as well as the file
``travis_gbq_config.txt``, in an otherwise empty commit. DO NOT commit the
``*.json`` file which contains your unencrypted private key.
#. Go to `Travis CI <https://travis-ci.org/>`__ and sign in with your GitHub
account.
#. Click on the ``+`` icon next to the ``My Repositories`` list and enable
Travis builds for your fork.
#. Click on the gear icon to edit your travis build, and add two environment
variables:

- ``GBQ_PROJECT_ID`` with the value being the ID of your BigQuery project.

- ``SERVICE_ACCOUNT_KEY`` with the value being the contents of the JSON key
that you downloaded for your service account. Use single quotes around
your JSON key to ensure that it is treated as a string.

For both environment variables, keep the "Display value in build log" option
DISABLED. These variables contain sensitive data and you do not want their
contents being exposed in build logs.
#. Your branch should be tested automatically once it is pushed. You can check
the status by visiting your Travis branches page which exists at the
following location: https://travis-ci.org/your-user-name/pandas/branches .
Expand Down
2 changes: 1 addition & 1 deletion doc/source/ecosystem.rst
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ both "column wise min/max and global min/max coloring."
API
-----

`pandas-datareader <https://github.com/pandas-dev/pandas-datareader>`__
`pandas-datareader <https://github.com/pydata/pandas-datareader>`__
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``pandas-datareader`` is a remote data access library for pandas. ``pandas.io`` from pandas < 0.17.0 is now refactored/split-off to and importable from ``pandas_datareader`` (PyPI:``pandas-datareader``). Many/most of the supported APIs have at least a documentation paragraph in the `pandas-datareader docs <https://pandas-datareader.readthedocs.io/en/latest/>`_:

Expand Down
2 changes: 1 addition & 1 deletion doc/source/io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2789,7 +2789,7 @@ both on the writing (serialization), and reading (deserialization).
| 0.17 / Python 3 | >=0.18 / any Python |
+----------------------+------------------------+
| 0.18 | >= 0.18 |
+======================+========================+
+----------------------+------------------------+

Reading (files packed by older versions) is backward-compatibile, except for files packed with 0.17 in Python 2, in which case only they can only be unpacked in Python 2.

Expand Down
44 changes: 44 additions & 0 deletions doc/source/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,50 @@ analysis / manipulation tool available in any language.
* Binary installers on PyPI: http://pypi.python.org/pypi/pandas
* Documentation: http://pandas.pydata.org


pandas 0.19.1
-------------

**Release date:** November 3, 2016

This is a minor bug-fix release from 0.19.0 and includes some small regression fixes,
bug fixes and performance improvements.

See the :ref:`v0.19.1 Whatsnew <whatsnew_0191>` page for an overview of all
bugs that have been fixed in 0.19.1.

Thanks
~~~~~~

- Adam Chainz
- Anthonios Partheniou
- Arash Rouhani
- Ben Kandel
- Brandon M. Burroughs
- Chris
- chris-b1
- Chris Warth
- David Krych
- dubourg
- gfyoung
- Iván Vallés Pérez
- Jeff Reback
- Joe Jevnik
- Jon M. Mease
- Joris Van den Bossche
- Josh Owen
- Keshav Ramaswamy
- Larry Ren
- mattrijk
- Michael Felt
- paul-mannino
- Piotr Chromiec
- Robert Bradshaw
- Sinhrks
- Thiago Serafim
- Tom Bird


pandas 0.19.0
-------------

Expand Down
2 changes: 1 addition & 1 deletion doc/source/whatsnew/v0.13.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ Enhancements
.. ipython:: python

t = Timestamp('20130101 09:01:02')
t + pd.datetools.Nano(123)
t + pd.tseries.offsets.Nano(123)

- A new method, ``isin`` for DataFrames, which plays nicely with boolean indexing. The argument to ``isin``, what we're comparing the DataFrame to, can be a DataFrame, Series, dict, or array of values. See :ref:`the docs<indexing.basics.indexing_isin>` for more.

Expand Down
60 changes: 21 additions & 39 deletions doc/source/whatsnew/v0.19.1.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
.. _whatsnew_0191:

v0.19.1 (????, 2016)
---------------------
v0.19.1 (November 3, 2016)
--------------------------

This is a minor bug-fix release from 0.19.0 and includes a large number of
bug fixes along with several new features, enhancements, and performance improvements.
This is a minor bug-fix release from 0.19.0 and includes some small regression fixes,
bug fixes and performance improvements.
We recommend that all users upgrade to this version.

Highlights include:


.. contents:: What's new in v0.19.1
:local:
:backlinks: none
Expand All @@ -21,60 +18,45 @@ Performance Improvements
~~~~~~~~~~~~~~~~~~~~~~~~

- Fixed performance regression in factorization of ``Period`` data (:issue:`14338`)
- Fixed performance regression in ``Series.asof(where)`` when ``where`` is a scalar (:issue:`14461`)
- Improved performance in ``DataFrame.asof(where)`` when ``where`` is a scalar (:issue:`14461`)
- Improved performance in ``.to_json()`` when ``lines=True`` (:issue:`14408`)
- Improved performance in ``Series.asof(where)`` when ``where`` is a scalar (:issue:`14461)
- Improved performance in ``DataFrame.asof(where)`` when ``where`` is a scalar (:issue:`14461)


- Improved performance in certain types of `loc` indexing with a MultiIndex (:issue:`14551`).


.. _whatsnew_0191.bug_fixes:

Bug Fixes
~~~~~~~~~




- Source installs from PyPI will now again work without ``cython`` installed, as in previous versions (:issue:`14204`)
- Compat with Cython 0.25 for building (:issue:`14496`)
- Fixed regression where user-provided file handles were closed in ``read_csv`` (c engine) (:issue:`14418`).
- Fixed regression in ``DataFrame.quantile`` when missing values where present in some columns (:issue:`14357`).
- Fixed regression in ``Index.difference`` where the ``freq`` of a ``DatetimeIndex`` was incorrectly set (:issue:`14323`)
- Added back ``pandas.core.common.array_equivalent`` with a deprecation warning (:issue:`14555`).
- Bug in ``pd.read_csv`` for the C engine in which quotation marks were improperly parsed in skipped rows (:issue:`14459`)
- Bug in ``pd.read_csv`` for Python 2.x in which Unicode quote characters were no longer being respected (:issue:`14477`)
- Fixed regression in ``Index.append`` when categorical indices were appended (:issue:`14545`).
- Fixed regression in ``pd.DataFrame`` where constructor fails when given dict with ``None`` value (:issue:`14381`)
- Fixed regression in ``DatetimeIndex._maybe_cast_slice_bound`` when index is empty (:issue:`14354`).
- Bug in localizing an ambiguous timezone when a boolean is passed (:issue:`14402`)
- Bug in ``TimedeltaIndex`` addition with a Datetime-like object where addition overflow in the negative direction was not being caught (:issue:`14068`, :issue:`14453`)



- Bug in string indexing against data with ``object`` ``Index`` may raise ``AttributeError`` (:issue:`14424`)
- Corrrecly raise ``ValueError`` on empty input to ``pd.eval()`` and ``df.query()`` (:issue:`13139`)


- Bug in ``RangeIndex.intersection`` when result is a empty set (:issue:`14364`).
- Bug in union of differences from a ``DatetimeIndex`; this is a regression in 0.19.0 from 0.18.1 (:issue:`14323`)

- Bug in groupby-transform broadcasting that could cause incorrect dtype coercion (:issue:`14457`)


- Bug in ``Series.__setitem__`` which allowed mutating read-only arrays (:issue:`14359`).


- Source installs from PyPI will now work without ``cython`` installed, as in previous versions (:issue:`14204`)
- Bug in ``DataFrame.insert`` where multiple calls with duplicate columns can fail (:issue:`14291`)

- ``pd.merge()`` will raise ``ValueError`` with non-boolean parameters in passed boolean type arguments (:issue:`14434`)


- Bug in ``Timestamp`` where dates very near the minimum (1677-09) could underflow on creation (:issue:`14415`)

- Bug in ``pd.concat`` where names of the ``keys`` were not propagated to the resulting ``MultiIndex`` (:issue:`14252`)
- Bug in ``pd.concat`` where ``axis`` cannot take string parameters ``'rows'`` or ``'columns'`` (:issue:`14369`)
- Bug in ``pd.concat`` with dataframes heterogeneous in length and tuple ``keys`` (:issue:`14438`)
- Bug in ``MultiIndex.set_levels`` where illegal level values were still set after raising an error (:issue:`13754`)
- Bug in ``DataFrame.to_json`` where ``lines=True`` and a value contained a ``}`` character (:issue:`14391`)
- Bug in ``df.groupby`` causing an ``AttributeError`` when grouping a single index frame by a column and the index level (:issue`14327`)
- Bug in ``df.groupby`` where ``TypeError`` raised when ``pd.Grouper(key=...)`` is passed in a list (:issue:`14334`)








- Bug in ``pd.pivot_table`` may raise ``TypeError`` or ``ValueError`` when ``index`` or ``columns`` is not scalar and ``values`` is not specified (:issue:`14380`)
- Bug in ``pd.pivot_table`` may raise ``TypeError`` or ``ValueError`` when ``index`` or ``columns``
is not scalar and ``values`` is not specified (:issue:`14380`)
- Enhancement in ``pandas.io.json.json_normalize``Added errors{'raise','ignore'} for keys not found in meta (:issue: '14505')
7 changes: 7 additions & 0 deletions pandas/api/tests/test_api.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-

import numpy as np

import pandas as pd
from pandas.core import common as com
from pandas import api
Expand Down Expand Up @@ -184,6 +186,11 @@ def test_deprecation_core_common(self):
for t in self.allowed:
self.check_deprecation(getattr(com, t), getattr(types, t))

def test_deprecation_core_common_array_equivalent(self):

with tm.assert_produces_warning(DeprecationWarning):
com.array_equivalent(np.array([1, 2]), np.array([1, 2]))

def test_deprecation_core_common_moved(self):

# these are in pandas.types.common
Expand Down
9 changes: 9 additions & 0 deletions pandas/core/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ def wrapper(*args, **kwargs):
setattr(m, t, outer(t))


# deprecate array_equivalent

def array_equivalent(*args, **kwargs):
warnings.warn("'pandas.core.common.array_equivalent' is deprecated and "
"is no longer public API", DeprecationWarning, stacklevel=2)
from pandas.types import missing
return missing.array_equivalent(*args, **kwargs)


class PandasError(Exception):
pass

Expand Down
2 changes: 2 additions & 0 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4008,6 +4008,8 @@ def asfreq(self, freq, method=None, how=None, normalize=False):
-------
converted : type of caller

Notes
-----
To learn more about the frequency strings, please see `this link
<http://pandas.pydata.org/pandas-docs/stable/timeseries.html#offset-aliases>`__.
"""
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import warnings
import copy

from pandas.compat import(
from pandas.compat import (
zip, range, long, lzip,
callable, map
)
Expand Down
Loading