BrandonFors/pandas-github-issues huggingface dataset:
DOC: fix PR09,PR08 doc string errors in Timestamp, NaT, Timedelta class
State: closed

This fixes PR09,PR08 errors in Timestamp, NaT, Timedelta classes

Example:

```
pandas.Timestamp.ceil: Parameter "ambiguous" description should finish with "."
pandas.Timestamp.ceil: Parameter "nonexistent" description should finish with "."
pandas.Timestamp.day_name: Parameter "locale" description should finish with "."
pandas.Timestamp.floor: Parameter "ambiguous" description should finish with "."
pandas.Timestamp.floor: Parameter "nonexistent" description should finish with "."
pandas.Timestamp.fromordinal: Parameter "ordinal" description should finish with "."
pandas.Timestamp.fromordinal: Parameter "freq" description should finish with "."
pandas.Timestamp.month_name: Parameter "locale" description should finish with "."
pandas.Timestamp.now: Parameter "tz" description should finish with "."
pandas.Timestamp.round: Parameter "ambiguous" description should finish with "."
pandas.Timestamp.round: Parameter "nonexistent" description should finish with "."
pandas.Timestamp.today: Parameter "tz" description should finish with "."
pandas.Timestamp.tz_localize: Parameter "ambiguous" description should finish with "."
pandas.Timestamp.tz_localize: Parameter "nonexistent" description should finish with "."
pandas.Timestamp.tz_localize: Parameter "errors" description should finish with "."
```

closes #28673

- [x] closes #xxxx
- [x] tests added / passed


Labels:
name: Docs

Comments:
looks like the tests are failing due to:

```
compare = (<class 'pandas._libs.tslibs.timestamps.Timestamp'>, 'ceil')

    @pytest.mark.parametrize(
        "compare",
        (
            _get_overlap_public_nat_methods(Timestamp, True)
            + _get_overlap_public_nat_methods(Timedelta, True)
        ),
    )
    def test_nat_doc_strings(compare):
        # see gh-17327
        #
        # The docstrings for overlapping methods should match.
        klass, method = compare
        klass_doc = getattr(klass, method).__doc__
```

which i am assuming means i will also need to edit the Timedelta class 
adding NaT, Timedelta class since it looks like I'll have to fix those too to get it to past the tests
confirmed that this fixes PR09 for `Timedelta,Timestamp,NaT` classes:

```
./scripts/validate_docstrings.py --errors=PR09,PR08 | grep -E "Timedelta\.|Timestamp\.|NaT\."
```
this is related to #27977 and #28602 (adding for visibility)
sorry about re-adding all the commits @datapythonista ; something was screwed up with how I had my local branch set up. should be fixed now.
apologies, i am a little confused on this one and cant figure out what im doing wrong. I ran:

```
git checkout PR09-Timestamp-fix
git fetch upstream
git merge upstream/master
```

but this adds more commits into the PR. let me read up on github docs and figure out what im doing and then ill take a another stab at opening a PR
BUG: restore limit in RangeIndex.get_indexer
State: closed

- [x] closes #28631 
- [x] tests added / passed
- [x] passes `black pandas`
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry


Labels:
name: Bug
name: Indexing
description: Related to indexing on series/frames, not to indexes themselves

Comments:
thanks @simonjayhawkins updated reflecting reviews! 
Good morning @simonjayhawkins ! and thanks for your reviews! All changed based on your reviews! Have a great day! ^^
@charlesdong1991 thanks a lot for the PR!
@MeeseeksDev backport 0.25.x
Fix incorrect doc for to_datetime
State: closed

- [ ] closes #xxxx
- [ ] tests added / passed
- [ ] passes `black pandas`
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry

This PR fixes incorrect doc for `pandas.to_datetime`.

Labels:
name: Docs

Comments:
thanks @harupy
DOC: Updating See Also section in IndexOpsMixin
State: closed

- [x] Updated the "See Also" section for the IndexOpsMixin '''_is_homogenous_type'''


Labels:
name: Docs

Comments:
Thanks!

Can you also update the See Also section for `MultiIndex._is_homogeneous_type` in a similar manner:
https://github.com/pandas-dev/pandas/blob/b1c3a9031569334cafc4e8d45d35408421f7dea4/pandas/core/indexes/multi.py#L666-L669

And can you add a See Also section to `DataFrame._is_homogeneous_type`?  It should essentially be a copy/paste combining the Index/MultiIndex entries from the other See Also sections:
https://github.com/pandas-dev/pandas/blob/b1c3a9031569334cafc4e8d45d35408421f7dea4/pandas/core/frame.py#L530-L552
The changes have been added @jschendel 
Thanks @Sedosa
BUG: fix broken error message in ujson.encode() (GH18878)
State: closed

- [x] closes #18878
- [x] tests added / passed
- [ ] passes `black pandas`
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry


Labels:
name: Error Reporting
description: Incorrect or improved errors from pandas
name: IO JSON
description: read_json, to_json, json_normalize

Comments:
thanks @rlamy
PERF: Make matplotlib import lazy
State: closed

Cuts import time by about 23%, from 393ms to 303ms (note these measurements are pretty noisy).  The percentage edges up to 26% if we ignore get_version, since that is negligible in a release.

Downside: we lose some docstrings on plotting methods.  Will need to decide if it is worth a refactor to keep them in place.

Labels:
name: Performance
description: Memory or execution speed performance
name: Dependencies
description: Required and optional dependencies

Comments:
Looks like the CI failures are related to missing docstrings
I have an alternative fix for this. Should have it up tonight or tomorrow. 
Closing in favor of Tom's approach.
accept a dictionary in plot colors
State: closed

- [ ] closes #8193
- [ ] tests added / passed
- [ ] passes `black pandas`
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry

Line/bar plot accepts color by dictonary.
@elisamalzoni

Labels:
name: Visualization
description: plotting

Comments:
Hello @Leostayner! Thanks for updating this PR. We checked the lines you've touched for [PEP 8](https://www.python.org/dev/peps/pep-0008) issues, and found:







There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers: 

##### Comment last updated at 2020-01-19 08:16:24 UTC
can you merge master
@jreback, Merged!
Updated whatsnew. Now where should I update the `.plot` docstring? Here is where I think it should be, is it right?

https://github.com/pandas-dev/pandas/blob/c0050e071d0cc31501d4f730c27a81f3a126fc5c/pandas/plotting/_core.py#L855

https://github.com/pandas-dev/pandas/blob/c0050e071d0cc31501d4f730c27a81f3a126fc5c/pandas/plotting/_core.py#L924
can you merge master
Hi @Leostayner - sorry to chase you up, just wanted to ask whether you're still working on this PR :)
@MarcoGorelli - given the silence, I think you're okay to finish this up if you want.
Sure. Looks like it's gone stale, so I've taken it forward in #31071 (note to OP: you're welcome to reopen this if you want to keep working on it)
DOC: Fixed PR08 docstring errors in pandas.DataFrame
State: closed

This relates to: [27977](https://github.com/pandas-dev/pandas/issues/27977). I have fixed the doc PR08 formatting issues for:
```
pandas.DataFrame.insert: Parameter "column" description should start with a capital letter
pandas.DataFrame.apply: Parameter "raw" description should start with a capital letter
pandas.DataFrame.pipe: Parameter "func" description should start with a capital letter
pandas.DataFrame.pipe: Parameter "args" description should start with a capital letter
pandas.DataFrame.pipe: Parameter "kwargs" description should start with a capital letter
pandas.DataFrame.corr: Parameter "method" description should start with a capital letter
pandas.DataFrame.corrwith: Parameter "axis" description should start with a capital letter
pandas.DataFrame.corrwith: Parameter "method" description should start with a capital letter
pandas.DataFrame.drop_duplicates: Parameter "keep" description should start with a capital letter
pandas.DataFrame.duplicated: Parameter "keep" description should start with a capital letter
pandas.DataFrame.idxmax: Parameter "axis" description should start with a capital letter
pandas.DataFrame.idxmin: Parameter "axis" description should start with a capital letter
pandas.DataFrame.unstack: Parameter "fill_value" description should start with a capital letter
pandas.DataFrame.plot: Parameter "kind" description should start with a capital letter
pandas.DataFrame.plot: Parameter "style" description should start with a capital letter
pandas.DataFrame.to_feather: Parameter "fname" description should start with a capital letter
pandas.DataFrame.to_msgpack: Parameter "path" description should start with a capital letter
pandas.DataFrame.to_msgpack: Parameter "append" description should start with a capital letter
pandas.DataFrame.to_msgpack: Parameter "compress" description should start with a capital letter
pandas.DataFrame.to_clipboard: Parameter "excel" description should start with a capital letter
```

- [x] tests added / passed
- [x] passes `black pandas`
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`

Will continue to work through all PR08 docstring errors.

Labels:
name: Docs
name: Code Style
description: Code style, linting, code_checks

Comments:
Hello @jackbicknell14! Thanks for updating this PR. We checked the lines you've touched for [PEP 8](https://www.python.org/dev/peps/pep-0008) issues, and found:







There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers: 

##### Comment last updated at 2019-09-29 08:39:19 UTC
So close!  If you can fix the merge conflict.
> So close! If you can fix the merge conflict.

Thanks for the help @gfyoung 

Have updated and resolved the merge conflict. Please could you also check out my other PR for similar doc issues in PR[28571](https://github.com/pandas-dev/pandas/pull/28571)? I think that one is all good to go.

Thanks!
Thanks @jackbicknell14 !
CLN: Define and pin GroupBy properties without exec
State: closed

- [x] closes #16959
- [x] tests added / passed
- [x] passes `black pandas`
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`

In an unrelated branch I found that this exec-generated code is a PITA to debug.  So this PR finally gets rid of it.

Labels:
name: Groupby
name: Clean

Comments:
thanks @jbrockmendel
CLN: Exception in io, plotting
State: closed


Labels:
name: Clean

Comments:
@datapythonista the two failures in the slow build are showing up for me locally (OSX, py37, up-to-date numpy).  I'm having a hard time troubleshooting them.  Any idea who to talk to?
Not sure if I understand. Do you mean you can't reproduce them locally?

My view is that we shouldn't be using `pyplot`. `pyplot` is a convenient API for users in a notebook. But for production code using an API that changes an internal state of a module like `pyplot` does makes things very tricky. Mainly for the tests, since tests running in parallel keep changing the internal state of `pyplot` affecting each other. Matplotlib offers more Pythonic APIs.

Of course there is a huge amount of work in the Matplotlib backend, and implementing one based on the object based Matplotlib API is not an immediate fix, but  a wish for the long term. But I guess it's useful to keep that in mind.

In #27009 I had all sort of weird errors related to this. One of them was that some tests broke just by adding a `from pandas import Series` somewhere. I didn't find a proper fix, but just kept reverting things and looking for alternative ways until errors disappeared.

May be things will be better after we merge #28531. Not sure if in the case of Matplolib it'll make a difference, since there are several files of tests. But not parallelizing tests in the same file can help, since I guess tests in the same file are likely to affect the same parts of `pyplot`.

Hope it helps. If I misunderstood and you think talking to someone from Matplotlib or Azure may help, let me know.
> Not sure if I understand. Do you mean you can't reproduce them locally?

I can reproduce it locally, I just can't figure out how to fix it.
> I can reproduce it locally, I just can't figure out how to fix it.

I see. Had a look, but can't really tell. Not sure if you can open a separate PR for each change, and at least we'll know which one if causing the error.
Separate PRs it is.
Closing while I troubleshoot this locally.
ENH: When using another plotting backend, minimize pre-processing
State: closed

- [ ] closes #xxxx
- [ ] tests added / passed
- [x] passes `black pandas`
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry

I ran into this while implementing the hvplot backend. In hvplot you can do:

```python
df.hvplot.hist(y='y', by='category')
```

but with the pandas version 

```python
pd.options.plotting.backend= 'holoviews'
df.plot.hist(y='y', by='category')
```

 will fail because `data = data[y]`  is called before the plotting is passed off to the backend. 

Basically it seems like backend writers should be free to get the passed pandas objects with as little interference as possible.



Labels:
name: Visualization
description: plotting

Comments:
@datapythonista does this seem reasonable to you?
I guess it could be perceived as related to those issues if you think the best fix would be to try to know all the options that can accept column names and then reduce the data to only those columns. That will never be sufficient for `hvplot` though because of options like `hover_cols` which `matplotlib` will never have.  

I think the more essential issue is that `pandas.plotting` should do minimal data transforming before handing off the data to the plotting backend. I just wasn't sure whether folks from other backends would agree that we don't want processing done ahead of time. Maybe @jakevdp can comment on what would be best for altair? 
I'm happy with that. The way it is now it's based in how the matplotlib backend was implemented when was coupled.

Besides being simpler in the pandas side, I see advantages on passing the whole dataframe, like backends being able to use other columns for hover and things like that.

I think making the changes shouldn't be hard.

@TomAugspurger what do you think?
Thanks @jsignell
CLN: remove unused categories/ordered handling in astype
State: closed

This removes some unused code in the internals `astype`. There is a small change in behaviour though, when passing the categories/ordered keyword you now get TypeError instead of ValueError. But since that is Python's default behaviour, I would say this is rather a good fix.

Labels:
name: Dtype Conversions
description: Unexpected or buggy dtype conversions
name: Clean

Comments:
No opinion on the TypeError vs ValueError.  Looks like a nice cleanup.
Shouldn't this get an entry in the whatsnew ("Removal of prior version deprecations/changes"). else no comment.
> Shouldn't this get an entry in the whatsnew ("Removal of prior version deprecations/changes").

It was already removed before. It was only not "fully" removed, and instead of just removing kwargs, we explicitly raised an error if categories or ordered was passed as a kwarg (instead of relying on python to raise that error).

lgtm. thanks @jorisvandenbossche
Doc contribution pr06
State: closed

Documentation update fixing some of the methods with a PR06 error code which involved updating  

- string to str

- integer to int

- boolean to bool

No tests required


Labels:
name: Docs

Comments:
Thanks @tolaa001 
These aren't all of the methods yet right? Do you know how many more still outstanding?
@WillAyd no these are not all the methods. There are a few left and will continue to work through it in another PR :)
Great thanks!

Sent from my iPhone

> On Sep 27, 2019, at 10:02 AM, Tola A <notifications@github.com> wrote:
> 
> ﻿
> @WillAyd no these are not all the methods. There are a few left and will continue to work through it in another PR :)
> 
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub, or mute the thread.
BUG: Fix TypeError raised in libreduction
State: closed

This is a PITA and I'm not 100% happy with the solution here, open to suggestions.

There is a call to `util.get_value_at(labels, i)` that raises `TypeError` if `labels` is not an `ndarray`.  This fixes that by checking for non-ndarray and handling that case correctly.

There is _also_ a case in master where we get an `UnboundLocalError` by referencing `result` before it is assigned.  This patches that to raise a `ValueError` instead, _but_ AFAICT fixing the ndarray bug above made it so that the UnboundLocalError case is no longer reached in the tests.  i.e. this change is definitely more correct, but we don't have a test case specific to it.

I'm also not wild about the specific exception-catching on L297-307 in core.apply, but don't see a viable alternative.  Suggestions welcome.

Labels:
name: Error Reporting
description: Incorrect or improved errors from pandas

Comments:
Gentle ping; this is a blocker for further progress in groupby/apply/resample exception catching
> This is a PITA and I'm not 100% happy with the solution here, open to suggestions

agreed, but ok for now :->
"series_examples": _ne_example_SERIES added
State: closed

"series_examples": _ne_example_SERIES added

- [ ] closes #xxxx
- [ ] tests added / passed
- [ ] passes `black pandas`
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry


Labels:

Comments:
Hello @RanDan363! Thanks for updating this PR. We checked the lines you've touched for [PEP 8](https://www.python.org/dev/peps/pep-0008) issues, and found:



There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers: 

##### Comment last updated at 2019-10-21 15:11:01 UTC
@RanDan363 can you address comments.  I think this is close to ready
@RanDan363 can you rebase and address comments.  itd be nice to get this in
BUG: value_counts can handle the case even with empty groups (#28479)
State: closed

* If applying rep to recons_labels go fail, use ids which has no
  consecutive duplicates instead. 

- [x] closes #28479 
- [x] tests added / passed
- [x] passes `black pandas`
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

xuancong84 found that value_counts() crashes if `groupby` object contains empty groups.
However, even though I made the construction of DataFrame don't skip empty rows, it still crashed.
Till then, I already tried in many ways though, in this time I tried to correct the callee `self.grouper.recons_labels`. After several tests, I found that If freq of `Grouper` is too long so that it has empty groups in some periods then it crashes. And also have found that this is solved by using `ids` which has no consecutive duplicates instead of `self.grouper.recons_labels`.

Labels:
name: Bug
name: Groupby

Comments:
Sorry for the second commit... Can it be squashed..?
@0xF4D3C0D3 FYI you don't need to create a new PR, you can simply rebase and push to the existing one (leave this as its already done)
@jreback Thanks for your advice, I just worried that if I had committed something like a trivial typo, it would have made the history of main repo dirty. So for the sake of only one commit, I checkout with another branch and commit with a random message and `git reset --soft HEAD~2` and `git commit --edit -m"$(git log --format=%B --reverse HEAD..HEAD@{1})"` for squashing. You mean that I don't need all this fuss and it's ok that PR with multiple commits as it can be squashed when it merged?
> You mean that I don't need all this fuss and it's ok that PR with multiple commits as it can be squashed when it merged?

yes you can do whatever you want, including merges & rebases on a branch; on merge we will squash to a single commit.
Wow, that's cool! sorry for my inexperience D: 
I'll practice and learn more to better contribution. Thanks
thanks @0xF4D3C0D3
BUG: DataFrame.to_html validates formatters has the correct length
State: closed

- [x] closes #28469
- [x] tests added / passed
- [x] passes `black pandas`
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

@gabriellm1 @hugoecarl

Labels:
name: IO HTML
description: read_html, to_html, Styler.apply, Styler.applymap

Comments:
Thanks @guipleite !
TST: loc misbehaves when Period is at start of 3-level MultiIndex
State: closed

If index is MultiIndex and level of 0 is PeriodIndex, loc function raise
exception if all input of loc does not match index values

Background: This bug only happens when MultiIndex's level is 3 and first level index is PeriodIndex. In this situation, if someone access one row using a '.loc' with a miss match key, then would not raise exception.

Someone already change what i try to do `parse_time_string` function in '_libs.tslibs.parsing'.
in the past,
```
def parse_time_string(arg, freq=None, dayfirst=None, yearfirst=None):
    if not isinstance(arg, str):
        return arg
```

What i try to do:

```
def parse_time_string(arg, freq=None, dayfirst=None, yearfirst=None):
    if not isinstance(arg, str):
        raise TypeError
```

now in master:
```
def parse_time_string(arg, freq=None, dayfirst=None, yearfirst=None):
    if not isinstance(arg, str):
        raise TypeError("parse_time_string argument must be str")
```
Just add tests for issue. 

- [x] closes (#20684)
- [x] tests added / passed
- [x] passes `black pandas`
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry


Labels:
name: Indexing
description: Related to indexing on series/frames, not to indexes themselves
name: Period
description: Period data type
name: MultiIndex

Comments:
Can you add tests specific to parse_time_string.  That would go in tests.tslibs.test_parsing
@jbrockmendel ping?
can you also make sure we have tests for the entire example in the OP (IOW the working cases as well)
@jreback  could you also check #29038 ?
thanks @proost 
@jbrockmendel  @jreback 
Thank you for your feedback.
Backport PR #28357 on branch 0.25.x (Change conda channel order for Windows builds)
State: closed

Backport PR #28357: Change conda channel order for Windows builds

Labels:

Comments:
CI is failing, but going to merge this:

- No idea why the style check is failing, but it's not related to this PR, so will fix separately
- The travis failures are related to S3, which is being handled in the other backport PR (and the other one is failing due to the failure that is being fixed in this PR)
Ah, the flake8 error is also fixed in https://github.com/pandas-dev/pandas/pull/28615
REF: Assert json roundtrip equal
State: closed

Replaces a some frequently repeated lines with a function.

- [x] closes #28555
- [ ] tests added / passed
- [x] passes `black pandas`
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry

Labels:
name: Testing
description: pandas testing functions or related to the test suite

Comments:
Hello @bganglia! Thanks for updating this PR. We checked the lines you've touched for [PEP 8](https://www.python.org/dev/peps/pep-0008) issues, and found:



There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers: 

##### Comment last updated at 2019-09-27 21:29:07 UTC
This is really nice, thanks.  Looks like the linter is finding trailing whitespace that you need to delete
Thank you, yes. I will do that now.
Thanks @bganglia nice PR and great first contribution. Would welcome more PRs to tackle other issues!