Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

534
Views
No se puede importar el nombre '_centered' desde 'scipy.signal.signaltools'

No se pueden importar funciones desde el módulo scipy.

Da error:

 from scipy.signal.signaltools import _centered Cannot import name '_centered' from 'scipy.signal.signaltools' scipy.__version__ 1.8.0
over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Encontré el mismo problema al usar statsmodels~=0.12.x . Al aumentar el paquete statsmodels a la versión 0.13.2 , se resuelve este problema de importación.

ACTUALIZAR con más notas:

  • antes de:
    • instalación de la versión fija de statsmodels==0.12.2 que depende de scipy
    • se lanzó recientemente scipy==1.8.0 - 2022-02-05
      • al instalarlo, tengo este problema:
 from statsmodels.tsa.seasonal import seasonal_decompose File "/usr/local/lib/python3.8/site-packages/statsmodels/tsa/seasonal.py", line 12, in <module> from statsmodels.tsa.filters.filtertools import convolution_filter File "/usr/local/lib/python3.8/site-packages/statsmodels/tsa/filters/filtertools.py", line 18, in <module> from scipy.signal.signaltools import _centered as trim_centered ImportError: cannot import name '_centered' from 'scipy.signal.signaltools' (/usr/local/lib/python3.8/site-packages/scipy/signal/signaltools.py)
  • después:

    • al subir statsmodels a la última versión disponible 0.13.2 versión 2022-02-08, funciona
  • Si no está utilizando statsmodels sino otro paquete que depende de scipy , observe si hay una versión más nueva disponible (después del lanzamiento de scipy a v. 1.8.0 )

over 4 years ago · Santiago Trujillo Report

0

Si necesita usar esa versión específica de statsmodels 0.12.x con scipy 1.8.0, tengo el siguiente truco . Básicamente, solo vuelve a publicar la función _centered existente (pero privada) como un atributo público del módulo ya importado en RAM.

Es una solución, y si puede simplemente actualizar sus dependencias a las últimas versiones. Solo use esto si se ve obligado a usar esas versiones específicas.

 import scipy.signal.signaltools def _centered(arr, newsize): # Return the center newsize portion of the array. newsize = np.asarray(newsize) currsize = np.array(arr.shape) startind = (currsize - newsize) // 2 endind = startind + newsize myslice = [slice(startind[k], endind[k]) for k in range(len(endind))] return arr[tuple(myslice)] scipy.signal.signaltools._centered = _centered
over 4 years ago · Santiago Trujillo Report

0

Con scipy 1.8.0, la forma obsoleta

from scipy.signal.signaltools import _centered

debe convertirse

from scipy.signal._signaltools import _centered

Tenga en cuenta el guión bajo delante de las herramientas de señal

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!