es.davy.ai

Preguntas y respuestas de programación confiables

¿Tienes una pregunta?

Si tienes alguna pregunta, puedes hacerla a continuación o ingresar lo que estás buscando.

Tag: NUMPY-NDARRAY

El objeto ‘numpy.ndarray’ no tiene el atributo ‘rolling’, después de convertir el array en dataframe.

Convertí mi matriz de numpy en un dataframe, sin embargo, el error aún persiste. deseanolized_df = pd.DataFrame(deseanolized) df_ma = deseanolized_df.values.rolling(3, center=True, closed=’both’).mean() df_ma.plot() Salida: “` AttributeError Traceback (most recent call last) /tmp/ipykernel_40/956302484.py in 1 deseanolized_df = pd.DataFrame(deseanolized) —-> 2 df_ma = deseanolized_df.values.rolling(3, center=True, closed=’both’).mean() 3 df_ma.plot() AttributeError: El objeto ‘numpy.ndarray’ . . . Read more

Inicialice una matriz ndarray de numpy en pydantic

¿Cómo puedo inicializar un ndarray al usar pydantic? Este código genera un ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all(). from pydantic.dataclasses import dataclass import numpy as np @dataclass class TestNumpyArray: numpyArray: np.ndarray = np.zeros(10) testNumpyArray = TestNumpyArray()