python / python/typeshed

geopandas: index type should be Any

Aperta
#15,111 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

stubs: false positive
Lingua principale
Python
Stelle
5.1k
Fork
2.1k
Merge medio
1g 19h
PR unite (30g)
82

Descrizione

My repo currently satisfies pandas-stubs type hints. However, when I add types-geopandas, I see hundreds of new issues:

error: "Index[Any]" has no attribute "overlaps" [attr-defined]
error: "Index[Any]" has no attribute "left" [attr-defined]
error: "Index[Any]" has no attribute "right" [attr-defined]

I'm using pd.IntervalIndex, which has these attributes. However, pandas currently has no way of typing DataFrame indices (https://github.com/pandas-dev/pandas/issues/36708), so there is no way of knowing which kind of index is returned.

I think it would be more correct to use typing.Any here since it is unknown and dynamic.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Non sono indicati file o test specifici. Inizia individuando le annotazioni di types-geopandas per gli indici di DataFrame e confrontale con l’attuale impossibilità di pandas di tipizzare i tipi di indice; il lavoro è completato quando gli errori di attributo IntervalIndex segnalati non vengono più prodotti usando entrambi i pacchetti di stub.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
pandas, python
Ambito
developer-experience
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.