ENH: Detect mixed bytes/text inputs during array conversion
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 45/100
Línea de trabajo
The issue mentions _array_converter and shared C conversion machinery. Start by reading the linked PR #32757 and the related issues #15327, #19078, #19101 to understand the context. Look at the numpy source code for dtype discovery and array conversion logic, particularly around string/bytes handling. The goal is to add an opt-in detection mode for mixed bytes/text inputs before coercion to Unicode.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Proposed new feature or change:
Follow-up to Sebastian’s review comment on #32757.
NumPy currently infers Unicode for mixed bytes/text inputs:
>>> import numpy as np
>>> np.asarray([b"a", "b"])
array(['a', 'b'], dtype='<U1')
>>> np.concatenate(([b"a", "b"], ["c"]))
array(['a', 'b', 'c'], dtype='<U1')
We should add an opt-in mode (exposed to NumPy Python internals via _array_converter) that detects these mixtures during dtype discovery, before coercion happens and we lose track of the input dtypes. Shared C conversion machinery would let concatenate detect mixtures within its inputs as well as between them.
The same detection could support deprecating implicit Unicode inference for mixed bytes/text inputs. These should eventually produce object arrays that preserve the original values. Explicit conversions such as dtype="U" would remain supported.
This has come up in the past, in particular:
- #15327 proposed deprecating implicit string/non-string promotion, including in
concatenate. - #19078 described downstream difficulties with promotion warnings: callers wanted numeric inference for numeric inputs and object arrays for mixed inputs.
- #19101 explored an opt-in object-fallback mode during dtype discovery; it was not merged.
- Lenguaje dominante
- Python
- Estrellas
- 33.5k
- Forks
- 13.1k
- Merge medio
- 1 d 19 h
- PR fusionados (30 d)
- 143
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de numpy/numpy
-
00 - Bug component: numpy.linalg
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
00 - Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
00 - Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
numpy/numpy#33422 · 6 comentarios ·
Los mantenedores suelen responder en 1 día
-
BUG: f2py treats a backslash as an escape inside character literalsPosiblemente ocupada @HaoZeke la tomó hace 17 días. Abierto00 - Bug component: numpy.f2py
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
numpy/numpy#33220 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
DOC: use CITATION.cff file format for citation informationPosiblemente ocupada @JaroCamphuijsen la tomó hace 58 días. Abierto04 - Documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
numpy/numpy#32817 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de numpy/numpy
Issues similares
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
521xueweihan/HelloGitHub#4543 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
emeryberger/CSrankings#15700 ·
Los mantenedores suelen responder en 2 días
-
Bug | 工作不正常 Triage | 待检查
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
OneDragon-Anything/ZenlessZoneZero-OneDragon#3084 ·
Los mantenedores suelen responder en 1 día
-
Task select patterns with uppercase letters never matchPosiblemente ocupada @manobhisriram la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día