BrandonFors/pandas-github-issues huggingface dataset:
DOC: Code style documentation
State: closed

- [x] ref [(comment)](https://github.com/pandas-dev/pandas/pull/29963#discussion_r353760238)
- [x] tests added / passed
- [x] passes `black pandas`
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry

This still needs a lot more work.
I will appreciate any advice/idea/fix.

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

Comments:
Thanks @MomIsBestFriend 

@WillAyd can you have a look and see if your comments were addressed please?
@MomIsBestFriend can you have a look at the CI please? Seems some things are failing.
```
 Linting code-blocks in .rst documentation
##[error]doc/source/development/contributing_code_guide.rst:59:10:F821:undefined name 'new_function_name'
##[error]doc/source/development/contributing_code_guide.rst:59:21:F821:undefined name 'old_function_name'
##[error]doc/source/development/contributing_code_guide.rst:69:10:F821:undefined name 'new_function_name'
##[error]doc/source/development/contributing_code_guide.rst:69:21:F821:undefined name 'old_function_name'
```
I have no idea how to solve it

https://github.com/pandas-dev/pandas/commit/02c0ab52d13dc00623bdf58a08bc51bc5818a2a1/checks?check_suite_id=379658620#step:6:2335
> I have no idea how to solve it

You can add the new page to this index. So, it's visible, and the error should also disappear.
Sorry, I see I forgot to copy the link. Another option is to add the document to this index, instead of creating a new one: https://github.com/pandas-dev/pandas/blob/master/doc/source/development/index.rst
> Sorry, I see I forgot to copy the link. Another option is to add the document to this index, instead of creating a new one: https://github.com/pandas-dev/pandas/blob/master/doc/source/development/index.rst

This is your preferred way?
Up to you, but I think it'd make the page more visible if it's in that index. 
> Up to you, but I think it'd make the page more visible if it's in that index.

Since you suggested it, I will go with that.

Do I just put ```contributing_code_guide``` under ```developer``` for example?

(and remove the ```doctree``` in ```contributing.rst```?)
Yep, just have your page as one more item in the list, not sure what's the best position, up to you.

You can probably leave a regular link in contributing, I guess you added an index because of the error
I'm considering changing the file name to ```style``` or something like that, to make it one word, instead of three.
> I guess you added an index because of the error

Correct.
I hope I did it correct.
> I'm considering changing the file name to `style` or something like that, to make it one word, instead of three.

I think style may be a bit ambiguous with other parts of the docs. But renaming to `code_style` sounds like a great idea.
@WillAyd can you have a look please? This should be ready
Thanks @momisbestfriend
CLN: ci code checks
State: closed

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


Labels:
name: Clean

Comments:
> Do these changes solve an issue

No, it will only solve my obnoxious OCD.

> are you sure they work across platforms / shells?

The thing is, I didn't write anything new, I just saw for example that on one line the ```include``` syntax is used like this:

```
--include "*.pyx" --include "*.py"
```

And on another line, it was used like:

```
--include=*.{py,pyx}
```

Because they're doing the exact same thing, I decided to pick one syntax (The second one just seems more compact), and apply it to every line that uses the ```--include``` flag.
CLN: f-string in pandas/core/arrays/*
State: closed

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


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

Comments:
Thanks @ganevgv !
CLN: f-string in pandas/core/arrays/sparse/*
State: closed

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


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

Comments:
Thanks @ganevgv
CLN: f-string in pandas/core/accessor.py and pandas/core/algorithms.py
State: closed

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


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

Comments:
Thanks @ganevgv
DOC: Style format
State: closed

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


Labels:
name: Docs

Comments:
cc @datapythonista 
Thanks @MomIsBestFriend
STY: change .format() to fstring
State: closed

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

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

Comments:
thanks @AlpAribal
DEPR: msgpack
State: closed

there are two msgpack files in LICENSES, should those go?

Labels:
name: Deprecate
description: Functionality to remove in pandas

Comments:
could use some help on the whatsnew 0.13.0 file
I would think OK to just remove that section of the whatsnew
> could use some help on the whatsnew 0.13.0 file

can you leave it as a code-block?
> can you leave it as a code-block?

leaving it as-is I get errors in the docbuild bc the msgpack funcs arent defined.  
> there are two msgpack files in LICENSES, should those go?

I suppose so yes? If we don't keep any code of it, we can remove the licenses as well?
> > there are two msgpack files in LICENSES, should those go?
> 
> I suppose so yes? If we don't keep any code of it, we can remove the licenses as well?

yes for sure
pls rebase
lgtm. @jorisvandenbossche 
Thanks @jbrockmendel !
Fixing 'names' doc for 'read_csv'
State: closed

- [ ] closes #xxxx
- [ ] tests added / passed
- [ ] passes `black pandas`
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry

I think there is a bug in the docs. This Jupyter notebook shows that the code does not work as expected from the docs https://gist.github.com/bessarabov/5e42bbb359fb86aaa87aed6c12a95bc9

So I've fixed the doc to match behaviour.


Labels:
name: Docs

Comments:
I made one more python notebook to check how the code works when there is no header in csv:

 * [pandas read_csv no-header.ipynb](https://gist.github.com/bessarabov/ff2ba9920e6b6823112611e7c3604289)
 * [pandas read_csv with-header.ipynb](https://gist.github.com/bessarabov/e102f8a29108d08b7da1617cf09fe38d)

The current doc text is:

> names : array-like, optional
> List of column names to use. If file contains no header row, then you should explicitly pass
> header=None. Duplicates in this list are not allowed.

As you can see from [pandas read_csv no-header.ipynb](https://gist.github.com/bessarabov/ff2ba9920e6b6823112611e7c3604289)
 * [pandas read_csv with-header.ipynb] there is no need to explicitly pass `header=None` the code works without `header=None` as it does with `header=None`

So I think there should be no such text in the doc.

But when there is a header in csv file you must specify `header=0` to make the code work as expected — [pandas read_csv with-header.ipynb](https://gist.github.com/bessarabov/e102f8a29108d08b7da1617cf09fe38d)
thanks @bessarabov
%s changed to fstring, single quotes in f string changed to double qu…
State: closed

https://github.com/pandas-dev/pandas/issues/29547#issuecomment-562164065
https://github.com/pandas-dev/pandas/issues/29547

- [x] pandas/_libs/tslibs/frequencies.pyx
- [x] pandas/_libs/tslibs/period.pyx
- [x] pandas/_libs/tslibs/strptime.pyx

changed %s to f strings and f ' '  to f " ".
str.format() remained unchanged due to:
https://github.com/pandas-dev/pandas/issues/29547#issuecomment-562227987 

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

Comments:
https://github.com/pandas-dev/pandas/pull/30094 can you submit updates on the same PR opposed to a new PR in the future 
LGTM
over to you @WillAyd 
Thanks @Behemkot and @jbrockmendel
DEPR: Index.contains, DatetimeIndex.offset
State: closed

DatetimeIndex.offset I thought was removed in #29801, but apparently slipped through the cracks.

Labels:
name: Deprecate
description: Functionality to remove in pandas

Comments:
reverted the RangeIndex bits since fastparquet still uses them
Also, the start/stop/step were only at deprecation warning, we should maybe first elevate that to future warning?
The offset note made it into #29801, just the actual removal fell through the cracks
> Also, the start/stop/step were only at deprecation warning, we should maybe first elevate that to future warning?

Seems reasonable.  Should we have a section in #6581 for DeprecationWarnings to upgrade to FutureWarnings? (or a separate tracker, but id prefer to keep it unified)
> > Also, the start/stop/step were only at deprecation warning, we should maybe first elevate that to future warning?
> 
> Seems reasonable. Should we have a section in #6581 for DeprecationWarnings to upgrade to FutureWarnings? (or a separate tracker, but id prefer to keep it unified)

we usually create a specific issue on that milestone, e.g. 1.1 or whatever (and/or can put on a unified tracker)
pls rebase
rebased + green
thanks @jbrockmendel
REF: implement io.pytables.DataCol._get_atom
State: closed

companion to #30101 with promised payoff (logically orthgonal, but will have merge conflict when the time comes)

This implements _get_atom and makes only one call to it on 3949.  By making all the relevant methods into classmethods, we can call it before we've instantiated an instance.  Then following #30100, we'll be able to pass `typ` to the constructor instead of pinning it.  This in turn will let us pass `pos` instead of calling `set_pos`.

Also after both this and #30101, we can get to rip out a bunch of no-longer-needed state-altering methods.

Labels:
name: Refactor
description: Internal refactoring of code
name: IO HDF5
description: read_hdf, HDFStore

Comments:
updated to use `is_foo_dtype`, and green ex the resource warning
thanks
REF: collect pytables DataCol.set_data calls in one place
State: closed

This is part 1 of 2 of the payoff promised from #30074.

Labels:
name: Refactor
description: Internal refactoring of code
name: IO HDF5
description: read_hdf, HDFStore

Comments:
Rebased following #30102, we get to rip out a bunch of `set_atom_foo` methods.  After this and #30100, we'll finally be able to pass everything to the relevant constructors here.
thanks
REF: implement io.pytables._maybe_adjust_name
State: closed

Besides being a well-scoped utility function, this makes it easy to use the klass constructor directly instead of `klass.create_for_block` on L3905.  Note that now we are passing `values` to the constructor instead of pinning them afterwards.  Most of what we've been doing in this file has been building up towards being able to pass things into the constructor here and avoid pinning afterward.

Labels:
name: Refactor
description: Internal refactoring of code
name: IO HDF5
description: read_hdf, HDFStore

Comments:
can you rebase
rebased+green
thanks
CI: Checking in f-strings we use {repr(...)} instead of {...!r}
State: closed

- [x] ref #29886
- [x] tests added / passed
- [x] passes `black pandas`
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry

---

Can merge only after merging:

- [x] #29948 

- [x] #29950

- [x] #29953 

- [x] #29959

- [x] #29963


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

Comments:
@MomIsBestFriend I think all precursors are done (?) can you merge master?
@WillAyd sorry for the delay, was on vacation.

Do you have an idea on how to exclude patterns like ```%%r```?
> Do you have an idea on how to exclude patterns like %%r?

You want to grep for "%r" but exclude "%%r" right?

With regular grep you could do `grep -R --include=*.{py,pyx} '%r' pandas | grep -v '%%r'`.  I'm not sure what it will take to make this work with the `invgrep` in the code checks
> > Do you have an idea on how to exclude patterns like %%r?
> 
> You want to grep for "%r" but exclude "%%r" right?
> 
> With regular grep you could do `grep -R --include=*.{py,pyx} '%r' pandas | grep -v '%%r'`. I'm not sure what it will take to make this work with the `invgrep` in the code checks

That's an interesting way of doing it, the problem is that the return status is messing my head. because the ```invgrep```  is giving the opposite return status of ```grep```. I just changed the matching pattern to make my life easier.

Hope my way of thinking is good.
@MomIsBestFriend pls rebase.  did you figure out the grep issue?
> did you figure out the grep issue?

Yes, I am greping for ```<Space>%r``` because it's more common, all the rest are edge cases, so it's not really worth writing test cases for them.
Sorry for the short mess, messed something with the ```HEAD``` and the ```upstream/maser``` pointers.

It's all good now, correct?
thanks @MomIsBestFriend
API: Handle pow & rpow special cases
State: closed

Closes https://github.com/pandas-dev/pandas/issues/29997

@jorisvandenbossche do you have thoughts on where to document this behavior? I added a bit to `reference/arrays.rst` for now, but perhaps we'll eventually have a `user_guide/scalar_na.rst`?


Labels:
name: Missing-data
description: np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
name: Numeric Operations
description: Arithmetic, Comparison, and Logical operations

Comments:
> @jorisvandenbossche do you have thoughts on where to document this behavior? 

The NA scalar itself is currently documented in missing_data.rst. I would maybe add it there?
Didn't see that section. Moved the note there.

We will still need something in reference so that :class:\`NA\` points somewhere.
This is blocking https://github.com/pandas-dev/pandas/pull/29964, so it'd be nice to merge this in soon if possible.
Addressed those, thanks for catching that.
> General question - is this behavior defined or standardized somewhere?

It's part of some IEEE spec, but I haven't tracked down the source. Both Python and NumPy use this behavior for NaN.

For NA, I think it aligns with the principles behind Kleene logic. `True | NA` is True, since `True | anything` is True. Similarly, `NA ** 0` is 1, since `anything ** 0` is 1.
thanks @TomAugspurger
BUG: file leak in read_excel
State: closed

I _think_ this 
closes #30031
closes #29514 
 we'll probably want to wait a few days to make it official.

To make the new test decorator useful in the CI we'll need to add psutil to the environment (unless someone knows of a stdlib way of doing the same check?)

One more note, the check in check_no_file_leaks depends on `__del__` having been called, which in turn depends on the gc.  I'm not sure, but that might induce another layer of flakiness.  If so, I think that can be fixed by calling `gc.collect()` before doing the `flist == flist2` check

Labels:
name: IO Excel
description: read_excel, to_excel

Comments:
LGTM - if this works! thanks for the fix!
great. maybe keep rebasing a few times this to see if it fails.
> maybe keep rebasing a few times this to see if it fails.

Seems like a more effective way of checking this against many runs would be to merge and see if the py36 failures go away?
> > maybe keep rebasing a few times this to see if it fails.
> 
> Seems like a more effective way of checking this against many runs would be to merge and see if the py36 failures go away?

sure
@jbrockmendel xref #47656: Does this miss a `gc.collect()` before the leak check? Some leaks will go away with a GC run. In #47656 there are a bunch of `boundmethod` objects that form a cycle with their originator class (`SAS7BDATReader`).
That's plausible, but I'll need a lot more caffeine to say more than that.  An extra better-safe-than-sorry gc.collect call wouldn't be the end of the world.
Convert to fstring
State: closed

https://github.com/pandas-dev/pandas/issues/29547

- [x] pandas/_libs/tslibs/frequencies.pyx
- [x] pandas/_libs/tslibs/period.pyx
- [x] pandas/_libs/tslibs/strptime.pyx


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

Comments:
My changes are causing problems, closing pull request .
STY: fstrings, repr pandas/io/html.py
State: closed

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


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

Comments:
Kicking off CI again - its this test. https://github.com/pandas-dev/pandas/issues/30031
@alimcmaster1 Travis passed before, right?

Is there anything wrong with the changes? any suggestions?
Looks like a segfault on the travis run unrelated to your changes @MomIsBestFriend 
thanks @MomIsBestFriend
BUG: preserve EA dtype in transpose
State: closed


Labels:
name: Reshaping
description: Concat, Merge/Join, Stack/Unstack, Explode
name: ExtensionArray
description: Extending pandas with custom dtypes or arrays.

Comments:
does this subsume #28048?
> does this subsume #28048?

Ah, yeah forgot about that one.
Easy to forget about, i closed it to clear the queue and then only reopened it a couple days ago.  I'm going to re-close it in favor or this one; maybe its worth salvaging some of the tests it implemented
Pushed a largeish refactor. We actually don't need NDFrame.transpose anymore. Series gets its from IndexOpsMixin. So I moved the logic to DataFrame.transpose, and was able to remove all the axes handling stuff.

> maybe its worth salvaging some of the tests it implemented

Added.

I think this is ready.
A handful of comments, generally looks good
@TomAugspurger merge master when you have a chance (or @jbrockmendel if this is a blocker)
rebased.  not a blocker for the blockwise PRs
thanks @TomAugspurger 

@jbrockmendel I don't think we had a dedicated issue for this to be closed......
#22120, since its about cyberpandas, i think we should ask tom to double-check that this fixes it.
DEPR: enforce deprecation of old set_axis signature
State: closed


Labels:
name: Deprecate
description: Functionality to remove in pandas

Comments:
lgtm ping on green.
We're running out of things to remove in #6581!  One thing there that could use a look from someone more experienced than me is the how/fill_method/resample one (now top of this list).  My last attempt to enforce it didn't go well.
> We're running out of things to remove in #6581! One thing there that could use a look from someone more experienced than me is the how/fill_method/resample one (now top of this list). My last attempt to enforce it didn't go well.

lol, yeah I added that too.

did you have a branch for this?
> did you have a branch for this?

not one that i pushed, will have to see if i still have it locally
de facto green.  im going to try to see if the same codecs.open thing can fix the CI failure were seeing here
booyah! tentatively figured out why we're leaking files that is failing the py36 build occasionally
thanks
REF: Standardize coercion in set_data
State: closed

See that after this, the way we are calling `self.set_data` is always with just `block.values` within the `set_atom_foo` methods (except for `set_atom_string`, which needs a small edit coming up in another PR).  Once set_atom_string joins the others, we can move these 7 calls to set_data up to just one place.

Labels:
name: Refactor
description: Internal refactoring of code
name: IO HDF5
description: read_hdf, HDFStore

Comments:
k thanks
Fixes Error thrown when None is passed to pd.to_datetime() with format as %Y%m%d
State: closed

- [ ] closes #30011 
- [x] tests added / passed
- [ ] passes `black pandas`
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry `bug fix of to_datetime for pandas versions >0.24. Now the change will avoid error even when value passed None to to_datetime`


Labels:
name: Bug
name: Datetime
description: Datetime data dtype

Comments:
can you add a test for the behavior this fixes
Updated about the issue and versions in Whats new entry row
Hello @maheshbapatu! 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-12-10 19:39:49 UTC
> comments + pls add a whtasnew entry in bug fixes for 1.0.0 in datetime section

Can you please elaborate about adding a whats new entry for 1.0.0 in datetime section. This is first commit of mine in open source field. Will be elated if you could describe it in detail .
@maheshbapatu For bug fixes, we include a description of what was fixed in a "whatsnew" document when the library is released. Specifically, please put the description here: https://github.com/pandas-dev/pandas/blob/master/doc/source/whatsnew/v1.0.0.rst#datetimelike
> @maheshbapatu For bug fixes, we include a description of what was fixed in a "whatsnew" document when the library is released. Specifically, please put the description here: https://github.com/pandas-dev/pandas/blob/master/doc/source/whatsnew/v1.0.0.rst#datetimelike

Thanks @mroeschke got it added changes accordingly.
thanks @maheshbapatu very nice
Thanks a lot @jreback and everyone who helped me all the way in my first open source contribution
REF: make pytables.IndexCol.itemsize a property
State: closed

Along with #30074 this is a bite-sized-pieces part of a series of PRs that ends with IndexCol attributes being set in the constructor and not mutated elsewhere

Labels:
name: IO HDF5
description: read_hdf, HDFStore

Comments:
Workflow related question: in your PRs that involve just pytables.py code, can you indicate this in the title? (eg to know this is not about eg Series.itemsize)
will do
Thanks!
@jbrockmendel ideally if you can lable with HDF5 and clean/ref as appropriate
TYP: Annotations in pandas/core/{accessor, sorting}.py
State: closed

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


Labels:
name: Typing
description: type annotations, mypy/pyright type checking

Comments:
pending word from @simonjayhawkins on whetheer we bother annotating `-> None` for `__init__`, LGTM
> pending word from @simonjayhawkins on whetheer we bother annotating `-> None` for `__init__`, LGTM

it's an undocumented convention that we're not annotating the return type of `__init__`
Thanks @MomIsBestFriend
BUG/TST: fix arrow roundtrip / parquet tests for recent pyarrow
State: closed

Closes https://github.com/pandas-dev/pandas/issues/29976

Labels:
name: Bug
name: Testing
description: pandas testing functions or related to the test suite
name: ExtensionArray
description: Extending pandas with custom dtypes or arrays.

Comments:
couple of questions, none blockers, LGTM
Going to merge this, as it fixes the tests. Will revisit extracting base functionality / utility function in the period/interval PR.
Fix PR06 docstring errors in sql.py and gbq.py
State: closed

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


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

Comments:
Thanks @HawkinsBA