En Pandas, la función Panel.truediv()
se usa para obtener una división flotante de series y marcos de datos / Panel.
Sintaxis: Panel.truediv (otro, eje = 0)
Parámetros:
otro: DataFrame o Panel
eje: Eje sobre el que transmitirDevoluciones: Panel
Código n.º 1:
df1
=
pd.DataFrame ({
`a`
: [
`Gee ks`
=
pd.DataFrame ({
`a`
: [
` I`
,
`am`
data
=
{
: df2 }
# crear un panel
< código clase = "funciones "> imprimir `b`
])
print
(
"Panel divisorio flotante [`b`] con df2 [`b`] usando truediv() método -"
)
print
(< /código>
` b`
], axis
=
Salida:
panel [`b`] is - item1 item2 0 111 100 1 123 100 2 425 100 3 1333 100 Panel divisorio flotante [` b`] con df2 [`b`] usando el método t ruediv () - item1 item2 0 1.11 1 1 1.23 1 2 4.25 1 3 13.33 1
Código # 2:
importar
numpy as np
< clase de código ="simple "> df1 `a`
: [
` Geeks`
,
` for`
,
`real`
datos
=
{
` item1`
: df1,
`item2`
: df1}
# crear un panel
`menor`
)
imprimir
`b`
],
` `< /código>
Salir: 5
,
2
, df2)
print
(
" Panel divisorio flotante [`b`] con df2 usando el método truediv () -"
)
print
(panel [
panel [`b`] es - Item1 Item2 0 11.000 11.000 1 1.025 1.025 2 333.000 333.000 3 114.480 114.480 4 1333.000 1333.000 Recientemente cree datos de datos con valores aleatorios, Äíamos - Item1 Item2 0 0.154734 0.270466 0,793149 0.594710 2 0.203894 0.133580 3 0.986028 0.826181 4 0.814395 0.072388 Panel de división flotante [` B`. Item1 Item 2 0 71.089512 40.670489 1 1.292318 1.723528 2 1633.203306 2492.883184 3 116.102223 138.798165 18414.
|
Salir:
panel [`b`] is - item1 item2 0 11.000 10 1 1.025 10 2 333.000 10 3 114.480 110 4 1333.000 110 Panel divisorio flotante [`b`] [` item1`] con df2 [`b`] o panel [` b`] [`item2` ] usando el método truediv () - 0 1.100000 1 0.102500 2 33.300000 3 1.040727 4 12.118182 dtype: float64