Skip to content

Conversation

sahildua2305
Copy link
Contributor

@sahildua2305 sahildua2305 commented Jul 20, 2016

@jreback
Copy link
Contributor

jreback commented Jul 20, 2016

you always needs tests

@sahildua2305
Copy link
Contributor Author

@jreback I'm not sure what to add in tests for this one. Can you please help me here?

@jreback
Copy link
Contributor

jreback commented Jul 20, 2016

you are adding keywords so need tests - look at what Dataframe tests for snd mirror those

@sahildua2305
Copy link
Contributor Author

I tried looking into test_frame.py. It has no test containing kind or na_position. Am I missing something or looking at wrong place?

@jreback
Copy link
Contributor

jreback commented Jul 20, 2016

rebase on master you have a really old master
just recursive grep

@sahildua2305
Copy link
Contributor Author

just recursive grep

Thanks for the hint, @jreback. Please check the tests I have added if they are sufficient or not.

@@ -1756,7 +1756,7 @@ def _try_kind_sort(arr):

@Appender(generic._shared_docs['sort_index'] % _shared_doc_kwargs)
def sort_index(self, axis=0, level=None, ascending=True, inplace=False,
sort_remaining=True):
kind='quicksort', na_position='last', sort_remaining=True):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these in the same order as DataFrame.sort_index?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

@jreback jreback added API Design Algos Non-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diff Compat pandas objects compatability with Numpy or Python functions labels Jul 24, 2016
@@ -731,3 +731,5 @@ Bug Fixes
- Bug where ``pd.read_gbq()`` could throw ``ImportError: No module named discovery`` as a result of a naming conflict with another python package called apiclient (:issue:`13454`)
- Bug in ``Index.union`` returns an incorrect result with a named empty index (:issue:`13432`)
- Bugs in ``Index.difference`` and ``DataFrame.join`` raise in Python3 when using mixed-integer indexes (:issue:`13432`, :issue:`12814`)

- Bug in ``Series.sort_index`` didn't accept kwargs ``kind`` and ``na_position`` (:issue:`13589`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its not a bug, rather an API change, where Series.sort_index gained these kwargs (they are somewhat similar, but in this case we are highliting the change).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather put it in the 'other enhancements' section, as it is adding keywords, not changing behaviour of existing ones

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added in API changes. Should I update again?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's OK (we do some clean-up of those files anyway before releasing)

@sahildua2305
Copy link
Contributor Author

@jreback Is this fine?

@@ -111,6 +111,8 @@ class Series(base.IndexOpsMixin, strings.StringAccessorMixin,
associated index values-- they need not be the same length. The result
index will be the sorted union of the two indexes.

`kind` and `na_position` were added in 0.19.0 to Series.sort_index()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can u change sort_index docstring rather than the class itself (u have to modify sort_index template appropriately). Also, pls use versionadded tag for each options.

@jorisvandenbossche
Copy link
Member

@sahildua2305 Only a few small comments, for the rest this is already looking fine!

@sahildua2305
Copy link
Contributor Author

@jorisvandenbossche I've updated the PR. Please check if it's good now.

@jreback
Copy link
Contributor

jreback commented Sep 9, 2016

can you rebase / update?

@sahildua2305
Copy link
Contributor Author

Yes! I'll do so.

Add tests for testing na_position and kind kwargs in Series.sort_index

Fix minor issues with tests for Series.sort_index

Update whatsnew entry; fix tests

Update Series doc-string to mention new additions

Remove update from Series doc-string

Mention versionadded in Series.sort_index() doc-string

Revert: Remove version tag from docstring

Add test for invalid arguments
@jreback
Copy link
Contributor

jreback commented Nov 25, 2016

closing in favor of #14445

@jreback jreback closed this Nov 25, 2016
@jorisvandenbossche jorisvandenbossche added this to the No action milestone Nov 25, 2016
@sahildua2305 sahildua2305 deleted the series-sort-index-bug branch July 16, 2017 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Algos Non-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diff API Design Compat pandas objects compatability with Numpy or Python functions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Series.sort_index does not accept kwargs kind and na_position.
4 participants