BrandonFors/pandas-github-issues huggingface dataset:
BUG: parsing ISO8601 string with `format=` and timezone name fails
State: closed

- [x] closes #49746 (Replace xxxx with the GitHub issue number)
- [x] closes #49748
- [ ] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


Labels:
name: Datetime
description: Datetime data dtype

Comments:
thanks for reviewing!
API: read_stata with index_col=None should return RangeIndex
State: closed

If `read_stata` was used with parameter `index=None`, an index based on `np.arange` was supplied to the constructed DataFrame, i.e. (pre pandas 2.0) an `Int64Index`.

`np.arange` has dtype `np.int_`, i.e. like `np.intp`, except is always 32bit on windows, which makes it annoying to use with tests when indexes can take all numpy numeric dtypes (like after #49560), so I'm looking into how `arange` is used in #49560. One case I found it was used is in `read_stata` and in that case it's better to use a `range`, so we get a `RangeIndex` instead of an `Index[int_]` when using `read_stata(index_col=None)`. 

This is a slight change in API, so I separate it out into its own PR here, so #49560, which is a large Pr, can be as focused as possible.

Labels:
name: IO Stata
description: read_stata, to_stata
name: Index
description: Related to the Index class or subclasses

Comments:
Updated.
Thanks @topper-123
STYLE enable pylint: global-variable-not-assigned
State: closed

Issue #48855. This PR enables pylint type "W" warning:` global-variable-not-assigned`
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).

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

Comments:
Thanks @natmokval
CLN: Don't intercept NotImplementedError in _cython_transform
State: closed

- [ ] closes #xxxx (Replace xxxx with the GitHub issue number)
- [ ] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.

Ref: https://github.com/pandas-dev/pandas/pull/49665#discussion_r1024528347

The one place in groupby where there is `raise NotImplementedError` is in `_reconstruct_ea_result`. This is not hit by tests.

cc @jbrockmendel

Labels:
name: Groupby
name: Clean

Comments:
lgtm. is this not user facing at all / worth a whatsnew?
> lgtm. is this not user facing at all / worth a whatsnew?

This was changed from raising NotImplementedError to a TypeError in #49665. So this PR is really just reverting that change.
BUG: Fixes dataFrame to_string(header=False)
State: closed

- [x] closes #49230 
- [x] [Tests added and passed] if fixing a bug or adding a new feature

- [x] All [code checks passed].
- [x] Added an entry in the latest `doc/source/whatsnew/v2.0.0.rst` file if fixing a bug or adding a new feature.


Labels:
name: Output-Formatting
description: __repr__ of pandas objects, to_string

Comments:
Nice fix @andrewchen1216!
ENH: infer Timestamp(iso8601string) resolution
State: closed

- [ ] closes #xxxx (Replace xxxx with the GitHub issue number)
- [ ] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


Labels:
name: Non-Nano
description: datetime64/timedelta64 with non-nanosecond resolution
name: Timestamp
description: pd.Timestamp and associated methods

Comments:
> Looks pretty good. Do we have any tests where the iso string has a UTC offset?

im pretty sure we have loads of these, unless we're thinking of different things.  you mean like "2016-01-01 04:05:06-01:00" right?
> > Looks pretty good. Do we have any tests where the iso string has a UTC offset?
> 
> im pretty sure we have loads of these, unless we're thinking of different things. you mean like "2016-01-01 04:05:06-01:00" right?

Yeah exactly. Should those test assert that the resolution is a certain value too?
looks good - merging then, thanks @jbrockmendel !
Revert "Add 'color' and 'size' to arguments (#44856)" 
State: closed

- [x] xref #49732 (Replace xxxx with the GitHub issue number)
- [ ] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


cc @MarcoGorelli would you be ok with reverting?

Labels:
name: Visualization
description: plotting

Comments:
yeah should be fine 👍 
Oops, something went wrong applying the patch ... Please have a look at my logs.
@meeseeksdev backport 1.5.x
Oops, something went wrong applying the patch ... Please have a look at my logs.
don't know what's up with meeseeksdev, but I've done this manually in https://github.com/pandas-dev/pandas/pull/49752
BUG GH49716 Improve type hint accuracy for pandas.read_sql_query
State: closed

- [ ] closes #49716
- [ ] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [x] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [x] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


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

Comments:
@phofl @WillAyd I have added description of what this PR tries to fix to `doc/source/whatsnew/v1.5.3.rst`, and I have modified the type hints to strict the keys to be strings for when a dictionary is passed into `params`.

On the other hand, I feel very confident that there are legitimate use case for parametrizing types such as `int`, `datetime`, `bool`, among other simple Pythonic data types, if not arbitrary types in general. The original issue #49716 states that the IDEs would complain that passing in `int` and `bool` violated the type hints, and I think that is a real bug that degrades developer experience.

I am not sure what test cases to write for a type hint change. It would be great if you can clarify. Thank you.
This pull request is stale because it has been open for thirty days with no activity. Please [update](https://pandas.pydata.org/pandas-docs/stable/development/contributing.html#updating-your-pull-request) and respond to this comment if you're still interested in working on this.
An optional parameter called check_series_type was created
State: closed

- [x ] closes #48287
- [x ] [Tests added and passed]
- [ x] All [code checks passed]


An optional parameter called check_series_type was created in the assert_frame_equal function which solves the problem passed by issue #48287.

By default the parameter is set to True, however it is now  its possible to set it to False and skip series_type_check.

Example:

import pandas as pd

class Series(pd.Series):
    @property
    def _constructor( self ):
        return Series

    @property
    def _constructor_expanddim( self ):
        return DataFrame

class DataFrame(pd.DataFrame):
    @property
    def _constructor_sliced( self ):
        return Series

s1 = pd.Series( [0] )
s2 = Series( s1 )

pd.testing.assert_series_equal(s1, s2, check_series_type=False)

df1 = s1.to_frame()
df2 = s2.to_frame()

pd.testing.assert_frame_equal(df1, df2, check_frame_type=False,check_series_type=False)



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

Comments:
> Hey, please always add tests

is there any documentation explaining the requested test patterns?
You can check the contributor guide, testing is explained there as well

https://pandas.pydata.org/docs/dev/development/contributing.html
Tests have been added @phofl 
Still relevant? @phofl @jreback 
This pull request is stale because it has been open for thirty days with no activity. Please [update](https://pandas.pydata.org/pandas-docs/stable/development/contributing.html#updating-your-pull-request) and respond to this comment if you're still interested in working on this.
Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen.
Suppress spurious warning
State: closed

- [ ] closes #xxxx (Replace xxxx with the GitHub issue number)
- [ ] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


Labels:
name: Warnings
description: Warnings that appear or should be added to pandas

Comments:
thx @jbrockmendel
ENH: DatetimeProperties results seem to be inconsistent since missing milliseconds #49073
State: closed

- [ X] closes #49073 (Replace xxxx with the GitHub issue number)
- [ X] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [ X] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).

I have added the millisecond feature to the Datetime function on Pandas. As it was discussed in the issue, it seemed inconsistent. However, I didn't change how the microseconds were being exhibited (with 6 digits instead of 3), not to break the code.


Labels:
name: Datetime
description: Datetime data dtype

Comments:
closing as per https://github.com/pandas-dev/pandas/issues/49073#issuecomment-1323967551 , but thanks for your PR!
REF: use sanitize_array in Index.__new__
State: closed

- [ ] closes #xxxx (Replace xxxx with the GitHub issue number)
- [ ] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.

i.e. share code paths with Series constructor.

This isn't Technically Correct until #49348

Labels:
name: Refactor
description: Internal refactoring of code
name: Index
description: Related to the Index class or subclasses

Comments:
> pandas/core/indexes/base.py:216:8: R1720: Unnecessary "elif" after "raise", remove the leading "el" from "elif" (no-else-raise)

@MarcoGorelli are you the right person to complain to about this?  i hereby complain.
yup, removing this one now
Thanks @jbrockmendel
API: dont do type inference on arithmetic results
State: closed

- [ ] closes #xxxx (Replace xxxx with the GitHub issue number)
- [ ] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


Labels:
name: API Design
name: Numeric Operations
description: Arithmetic, Comparison, and Logical operations

Comments:
more comments here?
Thanks @jbrockmendel
REF change to_datetime -> Timestamp for in odf reader
State: closed

Broken off from https://github.com/pandas-dev/pandas/pull/49024

Users wouldn't have the option to pass arguments to `to_datetime` here anyway, so might as well use `Timestamp` and avoid warnings related to `to_datetime` (like to pass `format` to ensure consistent parsing)

Labels:

Comments:
thanks @MarcoGorelli
ENH: dont guess %Y/%m
State: closed

Follow-up from https://github.com/pandas-dev/pandas/pull/49389

Guess "year month", but only if it's "%Y-%m" as that's ISO8601 compliant

Labels:
name: Datetime
description: Datetime data dtype

Comments:
The goal would still be to guess most date formats, especially non-ISO8601 ones

It's just for dates which don't have all three of "year, month, and day" that perhaps it's better to not guess (unless they're ISO8601), cc @WillAyd 
Yea I think adhering to ISO for inference is going to be the easiest to develop / communicate.
Thanks @MarcoGorelli
DOC: document read_orc columns order behaviour
State: closed

- [X] closes #47944
- [ ] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


Labels:
name: Docs
name: IO Data
description: IO issues that don't fit into a more specific label

Comments:
thx @markopacak
STYLE enable B005 check in flake8-bugbear
State: closed

From https://github.com/pandas-dev/pandas/pull/40570#issuecomment-811515884

> B005 would also be great

I agree, `strip` / `rstrip` / `lstrip` are common sources of confusion https://docs.python.org/3/library/stdtypes.html#str.lstrip , e.g.
```python
>>> 'Arthur: three!'.lstrip('Arthur: ')
'ee!'
```

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

Comments:
Thanks @twoertwein for reviewing!
Bug: Fix Inconsistent Behavior for Series.searchsorted
State: closed

- [x] closes #49620
- [x] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [x] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


Labels:
name: Error Reporting
description: Incorrect or improved errors from pandas
name: Series
description: Series data structure
name: Stale

Comments:
needs test
there's another subtle bug you've uncovered

```
>>> df = pd.DataFrame({"A": [1, 2], "B": [3, 4]})
>>> pd.array(df)
<StringArray>
[
['[1 3]', '[1 3]'],
['[2 4]', '[2 4]']
]
Shape: (2, 2), dtype: string
```

`pd.array(df)` should probably raise, _maybe_ return `pd.array(df._values)`.  Definitely not this StringArray.
> 

That's exactly the real problem. The reason why DataFrame should be forbidden here is that type infer in `pd.array` doesn't work on n-D DataFrame. But such a fix is far beyond my ability.
This pull request is stale because it has been open for thirty days with no activity. Please [update](https://pandas.pydata.org/pandas-docs/stable/development/contributing.html#updating-your-pull-request) and respond to this comment if you're still interested in working on this.
Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen.
@mroeschke i think this might be fine as-is; i can do a separate PR to fix pd.array
Thanks @yqyqyq-W
Backport PR #49676 on branch 1.5.x (REGR: Remove groupby's __getattribute__ for nth)
State: closed

Backport PR #49676: REGR: Remove groupby's __getattribute__ for nth

Labels:
name: Groupby
name: Performance
description: Memory or execution speed performance
name: Regression
description: Functionality that used to work in a prior pandas version

Comments:
@rhshadrach can you have a look at the CI please? The Mac error seems just a random crash, but the typing error seems like a genuine error.
thx @rhshadrach
BUG: SparseArray.astype(np.int64)
State: closed

- [ ] closes #xxxx (Replace xxxx with the GitHub issue number)
- [x] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [x] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


Labels:
name: Dtype Conversions
description: Unexpected or buggy dtype conversions
name: Sparse
description: Sparse Data Type
name: Astype

Comments:
Thanks @jbrockmendel
BUG: support ambiguous=infer with ZoneInfo
State: closed

- [x] closes #48442 (Replace xxxx with the GitHub issue number)
- [x] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [x] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [x] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.

Sits on top of #49684

Labels:
name: Timezones
description: Timezone data dtype

Comments:
Fixes https://github.com/pandas-dev/pandas/issues/48442? (and therefore this change is/should be considered for backporting)
> Fixes https://github.com/pandas-dev/pandas/issues/48442? (and therefore this change is/should be considered for backporting)

yes
> do we have testing tz_localize/convert with the nonexistent options?

you mean specific to ZoneInfo?  i dont think so.  would be straightforward to add ZoneInfo case to test_tz_localize_nonexistent since it is currently parametrized over pytz/dateutil
> > do we have testing tz_localize/convert with the nonexistent options?
> 
> you mean specific to ZoneInfo? i dont think so. would be straightforward to add ZoneInfo case to test_tz_localize_nonexistent since it is currently parametrized over pytz/dateutil

Correct, yes if these can be added in a follow up that would be good.
good call on checking this; ATM this segfaults
TST: Refactor test_subtracting_two_series_with_unordered_index_and_all_nan_index
State: closed

- [x] closes #49443 
- [ ] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


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

Comments:
Is my implementation correct?

https://github.com/pandas-dev/pandas/pull/49698/commits/d106b1708f2499322635c85a6c6ad05435c2adb2
This pull request is stale because it has been open for thirty days with no activity. Please [update](https://pandas.pydata.org/pandas-docs/stable/development/contributing.html#updating-your-pull-request) and respond to this comment if you're still interested in working on this.
Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen.
DOC: mention tz_convert(None) and tz_localize(None) for dataframe or series
State: closed

DOC: mention tz_convert(None) and tz_localize(None) for dataframe or series
---

I found the functionality to convert tz-aware axis to tz-naive axis is documented in DatatimeIndex but not documented in DataFrame or Series. Add more documentation to mention this feature.

[pandas.DatetimeIndex.tz_convert](https://pandas.pydata.org/docs/reference/api/pandas.DatetimeIndex.tz_convert.html)
[pandas.DatetimeIndex.tz_localize](https://pandas.pydata.org/docs/reference/api/pandas.DatetimeIndex.tz_localize.html)



Labels:
name: Docs
name: Timezones
description: Timezone data dtype

Comments:
Also add examples:
- tz_convert: normal usage and tz_convert(None)
- tz_localize: tz_localize(None)
I didn't generate the HTML doc and check the result. please double check.

feel free to modify this PR.
thx @georeth