Skip to content

Commit 8a644c1

Browse files
authored
Merge branch 'main' into issue2
2 parents 04a1643 + de40565 commit 8a644c1

File tree

5 files changed

+44
-43
lines changed

5 files changed

+44
-43
lines changed

pandas/core/arrays/string_.py

+11-10
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,11 @@ class StringDtype(StorageExtensionDtype):
9090

9191
name = "string"
9292

93-
#: StringDtype.na_value uses pandas.NA
94-
na_value = libmissing.NA
93+
#: StringDtype().na_value uses pandas.NA
94+
@property
95+
def na_value(self) -> libmissing.NAType:
96+
return libmissing.NA
97+
9598
_metadata = ("storage",)
9699

97100
def __init__(self, storage=None) -> None:
@@ -335,13 +338,11 @@ def _from_sequence(cls, scalars, *, dtype: Dtype | None = None, copy=False):
335338
na_values = scalars._mask
336339
result = scalars._data
337340
result = lib.ensure_string_array(result, copy=copy, convert_na_value=False)
338-
result[na_values] = StringDtype.na_value
341+
result[na_values] = libmissing.NA
339342

340343
else:
341-
# convert non-na-likes to str, and nan-likes to StringDtype.na_value
342-
result = lib.ensure_string_array(
343-
scalars, na_value=StringDtype.na_value, copy=copy
344-
)
344+
# convert non-na-likes to str, and nan-likes to StringDtype().na_value
345+
result = lib.ensure_string_array(scalars, na_value=libmissing.NA, copy=copy)
345346

346347
# Manually creating new array avoids the validation step in the __init__, so is
347348
# faster. Refactor need for validation?
@@ -396,7 +397,7 @@ def __setitem__(self, key, value):
396397
# validate new items
397398
if scalar_value:
398399
if isna(value):
399-
value = StringDtype.na_value
400+
value = libmissing.NA
400401
elif not isinstance(value, str):
401402
raise ValueError(
402403
f"Cannot set non-string value '{value}' into a StringArray."
@@ -497,7 +498,7 @@ def _cmp_method(self, other, op):
497498

498499
if op.__name__ in ops.ARITHMETIC_BINOPS:
499500
result = np.empty_like(self._ndarray, dtype="object")
500-
result[mask] = StringDtype.na_value
501+
result[mask] = libmissing.NA
501502
result[valid] = op(self._ndarray[valid], other)
502503
return StringArray(result)
503504
else:
@@ -512,7 +513,7 @@ def _cmp_method(self, other, op):
512513
# String methods interface
513514
# error: Incompatible types in assignment (expression has type "NAType",
514515
# base class "PandasArray" defined the type as "float")
515-
_str_na_value = StringDtype.na_value # type: ignore[assignment]
516+
_str_na_value = libmissing.NA # type: ignore[assignment]
516517

517518
def _str_map(
518519
self, f, na_value=None, dtype: Dtype | None = None, convert: bool = True

pandas/core/arrays/string_arrow.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,9 @@ def astype(self, dtype, copy: bool = True):
242242
# ------------------------------------------------------------------------
243243
# String methods interface
244244

245-
# error: Cannot determine type of 'na_value'
246-
_str_na_value = StringDtype.na_value # type: ignore[has-type]
245+
# error: Incompatible types in assignment (expression has type "NAType",
246+
# base class "ObjectStringArrayMixin" defined the type as "float")
247+
_str_na_value = libmissing.NA # type: ignore[assignment]
247248

248249
def _str_map(
249250
self, f, na_value=None, dtype: Dtype | None = None, convert: bool = True

pandas/core/dtypes/dtypes.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -676,11 +676,14 @@ class DatetimeTZDtype(PandasExtensionDtype):
676676
kind: str_type = "M"
677677
num = 101
678678
base = np.dtype("M8[ns]") # TODO: depend on reso?
679-
na_value = NaT
680679
_metadata = ("unit", "tz")
681680
_match = re.compile(r"(datetime64|M8)\[(?P<unit>.+), (?P<tz>.+)\]")
682681
_cache_dtypes: dict[str_type, PandasExtensionDtype] = {}
683682

683+
@property
684+
def na_value(self) -> NaTType:
685+
return NaT
686+
684687
@cache_readonly
685688
def str(self):
686689
return f"|M8[{self._unit}]"
@@ -1450,7 +1453,9 @@ class BaseMaskedDtype(ExtensionDtype):
14501453
base = None
14511454
type: type
14521455

1453-
na_value = libmissing.NA
1456+
@property
1457+
def na_value(self) -> libmissing.NAType:
1458+
return libmissing.NA
14541459

14551460
@cache_readonly
14561461
def numpy_dtype(self) -> np.dtype:

pandas/core/indexes/numeric.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,10 @@ class Float64Index(NumericIndex):
409409
__doc__ = _num_index_shared_docs["class_descr"] % _index_descr_args
410410

411411
_typ = "float64index"
412-
_engine_type = libindex.Float64Engine
413412
_default_dtype = np.dtype(np.float64)
414413
_dtype_validation_metadata = (is_float_dtype, "float")
415414
_is_backward_compat_public_numeric_index: bool = False
415+
416+
@property
417+
def _engine_type(self) -> type[libindex.Float64Engine]:
418+
return libindex.Float64Engine

web/pandas/about/governance.md

+19-28
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
1-
# Main Governance Document
1+
# Project governance
22

33
The official version of this document, along with a list of
44
individuals and institutions in the roles defined in the governance
5-
section below, is contained in The Project Governance Repository at:
5+
section below, is contained in the
6+
[Project governance](https://pandas.pydata.org/about/governance.html)
7+
page of the pandas website.
68

7-
[https://github.com/pydata/pandas-governance](https://github.com/pydata/pandas-governance)
8-
9-
The Project
10-
===========
9+
## The Project
1110

1211
The pandas Project (The Project) is an open source software project affiliated
1312
with the 501(c)3 NumFOCUS Foundation. The goal of The Project is to develop open
1413
source software for data ingest, data preparation, data analysis, and data
1514
visualization for the Python programming language. The Software developed by
1615
The Project is released under the BSD (or similar) open source license,
17-
developed openly and hosted in public GitHub repositories under the [PyData
18-
GitHub organization](https://github.com/pydata). Examples of Project Software
19-
include the main pandas code repository, pandas-website, and the
20-
pandas-datareader add-on library.
16+
developed openly and hosted in public GitHub repositories under the [pandas
17+
GitHub organization](https://github.com/pandas-dev). Examples of Project Software
18+
include the main pandas code repository and the pandas-stubs library.
2119

2220
Through its affiliation with NumFOCUS, The Project has the right to receive
2321
tax-deductible donations in the United States of America.
@@ -34,7 +32,7 @@ transparency.
3432

3533
Here is a list of the current Contributors to the main pandas repository:
3634

37-
[https://github.com/pydata/pandas/graphs/contributors](https://github.com/pydata/pandas/graphs/contributors)
35+
[https://github.com/pandas-dev/pandas/graphs/contributors](https://github.com/pandas-dev/pandas/graphs/contributors)
3836

3937
There are also many other Contributors listed in the logs of other repositories of
4038
the pandas project.
@@ -45,14 +43,13 @@ Community and we strive to keep the barrier between Contributors and Users as
4543
low as possible.
4644

4745
The Project is formally affiliated with the 501(c)3 NumFOCUS Foundation
48-
([http://numfocus.org](http://numfocus.org)), which serves as its fiscal
46+
([https://numfocus.org](https://numfocus.org)), which serves as its fiscal
4947
sponsor, may hold project trademarks and other intellectual property, helps
5048
manage project donations and acts as a parent legal entity. NumFOCUS is the
5149
only legal entity that has a formal relationship with the project (see
5250
Institutional Partners section below).
5351

54-
Governance
55-
==========
52+
## Governance
5653

5754
This section describes the governance and leadership model of The Project.
5855

@@ -76,8 +73,7 @@ need for a more formal governance model. Moving forward The Project leadership
7673
will consist of a BDFL and Core Team. We view this governance model as the
7774
formalization of what we are already doing, rather than a change in direction.
7875

79-
BDFL
80-
----
76+
### BDFL
8177

8278
The Project will have a BDFL (Benevolent Dictator for Life), who is currently
8379
Wes McKinney. As Dictator, the BDFL has the authority to make all final
@@ -103,8 +99,7 @@ vote. If no BDFL candidate receives 2/3 of the votes of the Core Team, the Core
10399
Team members shall propose the BDFL candidates to the Main NumFOCUS board, who
104100
will then make the final decision.
105101

106-
Core Team
107-
---------
102+
### Core Team
108103

109104
The Project's Core Team will consist of Project Contributors who have produced
110105
contributions that are substantial in quality and quantity, and sustained over
@@ -238,8 +233,7 @@ interactions with NumFOCUS.
238233
employment or contracting work (including the reportee, i.e. the reportee + 1
239234
is the max). This avoids effective majorities resting on one person.
240235

241-
Institutional Partners and Funding
242-
==================================
236+
## Institutional Partners and Funding
243237

244238
The BDFL and Core Team are the primary leadership for the project. No outside
245239
institution, individual or legal entity has the ability to own, control, usurp
@@ -300,23 +294,20 @@ Institutional Partners, with associated benefits:
300294

301295
**Tier 2** = an institution with at least one Institutional Contributor
302296

303-
Breach
304-
======
297+
## Breach
305298

306299
Non-compliance with the terms of the governance documents shall be reported to
307300
the Core Team either through public or private channels as deemed appropriate.
308301

309-
Changing the Governance Documents
310-
=================================
302+
## Changing the Governance
311303

312-
Changes to the governance documents are submitted via a GitHub pull request to
313-
The Project's governance documents GitHub repository at
314-
[https://github.com/pydata/pandas-governance](https://github.com/pydata/pandas-governance).
304+
Changes to the governance are submitted via a GitHub pull request to The Project's
305+
[governance page](https://github.com/pandas-dev/pandas/blob/main/web/pandas/about/governance.md).
315306
The pull request is then refined in response to public comment and review, with
316307
the goal being consensus in the community. After this open period, a Core Team
317308
Member proposes to the Core Team that the changes be ratified and the pull
318309
request merged (accepting the proposed changes) or proposes that the pull
319-
request be closed without merging (rejecting the proposed changes). The Member
310+
request be closed without merging (rejecting the proposed changes). The Member
320311
should state the final commit hash in the pull request being proposed for
321312
acceptance or rejection and briefly summarize the pull request. A minimum of
322313
80% of the Core Team must vote and at least 2/3 of the votes must be positive

0 commit comments

Comments
 (0)