TimedeltaIndex.astype()
Pandas TimedeltaIndex.astype()
crea un indice con valori espressi to dtypes ... La classe del nuovo indice è determinata dal dtype. Quando la conversione non è possibile, viene generato un ValueError.
Sintassi: TimedeltaIndex.astype (dtype, copy = True)
Parametri:
dtype: numpy dtype o pandas type
copy: bool, default True
Per impostazione predefinita, astype restituisce sempre un oggetto appena allocato. Se copy è impostato su False e i requisiti interni su dtype sono soddisfatti, i dati originali vengono utilizzati per creare un nuovo Indice o viene restituito l’Indice originale.Ritorno: Oggetto indice
Esempio n. 1: Usa TimedeltaIndex.astype ()
per eseguire il cast dei valori degli oggetti TimedeltaIndex su & # 39; str & # 39;.
|
Output:
Ora useremo TimedeltaIndex.astype ()
per trasmettere il valore a una stringa.
|
Output:
Come possiamo vedere nell’output, TimedeltaIndex.astype ()
valorizza l’oggetto tidx nel formato desiderato.
Esempio n. 2 : usa TimedeltaIndex.astype ()
per trasmettere i valori degli oggetti TimedeltaIndex a & # 39; bollo & # 39 ;.
|
Output: < /p>
Come possiamo vedere nell’output, TimedeltaIndex.astype ()
valorizza l’oggetto tidx nel formato desiderato.
Ci auguriamo che questo articolo ti abbia aiutato a risolvere il problema. Oltre a Python | Pandas TimedeltaIndex.astype (), controlla altri argomenti relativi a Python functions.
Vuoi eccellere in Python? Consulta la nostra recensione dei migliori corsi online Python 2023. Se sei interessato alla scienza dei dati, controlla anche come imparare a programmare in R.
A proposito, questo materiale è disponibile anche in altre lingue:
- Python | Pandas TimedeltaIndex.astype ()
- Italiano Python | Pandas TimedeltaIndex.astype ()
- Deutsch Python | Pandas TimedeltaIndex.astype ()
- Français Python | Pandas TimedeltaIndex.astype ()
- Español Python | Pandas TimedeltaIndex.astype ()
- Türk Python | Pandas TimedeltaIndex.astype ()
- Русский Python | Pandas TimedeltaIndex.astype ()
- Português Python | Pandas TimedeltaIndex.astype ()
- Polski Python | Pandas TimedeltaIndex.astype ()
- Nederlandse Python | Pandas TimedeltaIndex.astype ()
- 中文 Python | Pandas TimedeltaIndex.astype ()
- 한국어 Python | Pandas TimedeltaIndex.astype ()
- 日本語 Python | Pandas TimedeltaIndex.astype ()
- हिन्दी Python | Pandas TimedeltaIndex.astype ()
Vigrinia | 2023-01-31
Python functions è tutto un po' confuso 😭 Python | Pandas TimedeltaIndex.astype () non è l'unico problema che ho riscontrato. Spero solo che non emerga più
Prague | 2023-01-31
Forse ci sono altre risposte? Cosa significa esattamente Python | Pandas TimedeltaIndex.astype () significa esattamente?. Controllato ieri, funziona!
Munchen | 2023-01-31
Mi stavo preparando per il mio colloquio di codifica, grazie per aver chiarito questo punto - Python | Pandas TimedeltaIndex.astype () in Python non è il più semplice. Non sono proprio sicuro che sia il metodo migliore
Shop
Latest questions