Skip to content

TST/DOC: addtl tests and docs for (GH6056) #6058

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

Merged
merged 1 commit into from
Jan 24, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 doc/source/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ Bug Fixes
- Bug in Series.xs with a multi-index (:issue:`6018`)
- Bug in Series construction of mixed type with datelike and an integer (which should result in
object type and not automatic conversion) (:issue:`6028`)
- Possible segfault when chained indexing with an object array under numpy 1.7.1 (:issue:`6016`)
- Possible segfault when chained indexing with an object array under numpy 1.7.1 (:issue:`6026`, :issue:`6056`)
- Bug in setting using fancy indexing a single element with a non-scalar (e.g. a list),
(:issue:`6043`)
- Regression in ``.get(None)`` indexing from 0.12 (:issue:`5652`)
Expand Down
6 changes: 3 additions & 3 deletions doc/source/tutorials.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.. _tutorials:

****************
Pandas Tutorials
****************
*********
Tutorials
*********

This is a guide to many pandas tutorials, geared mainly for new users.

Expand Down
22 changes: 22 additions & 0 deletions doc/source/v0.13.1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,28 @@ There are several new or updated docs sections including:
- :ref:`Tutorials<tutorials>`, a guide to community developed pandas tutorials.
- :ref:`Pandas Ecosystem<ecosystem>`, a guide to complementary projects built on top of pandas.

.. warning::

0.13.1 fixes a bug that was caused by a combination of having numpy < 1.8, and doing
chained assignent on a string-like array. Please review :ref:`the docs<indexing.view_versus_copy>`,
chained indexing can have unexpected results and should generally be avoided.

This would previously segfault:

.. ipython:: python

df = DataFrame(dict(A = np.array(['foo','bar','bah','foo','bar'])))
df['A'].iloc[0] = np.nan
df

The recommended way to do this type of assignment is:

.. ipython:: python

df = DataFrame(dict(A = np.array(['foo','bar','bah','foo','bar'])))
df.ix[0,'A'] = np.nan
df

API changes
~~~~~~~~~~~

Expand Down
12 changes: 12 additions & 0 deletions pandas/tests/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2015,6 +2015,18 @@ def test_setitem_chained_setfault(self):
df.response[mask] = 'none'
assert_frame_equal(df, DataFrame({'response': mdata, 'response1' : data }))

# GH 6056
expected = DataFrame(dict(A = [np.nan,'bar','bah','foo','bar']))
df = DataFrame(dict(A = np.array(['foo','bar','bah','foo','bar'])))
df['A'].iloc[0] = np.nan
result = df.head()
assert_frame_equal(result, expected)

df = DataFrame(dict(A = np.array(['foo','bar','bah','foo','bar'])))
df.A.iloc[0] = np.nan
result = df.head()
assert_frame_equal(result, expected)

def test_detect_chained_assignment(self):

pd.set_option('chained_assignment','raise')
Expand Down