Python 'AttributeError: 'function' object has no attribute 'min''

后端 未结 6 2206
予麋鹿
予麋鹿 2021-02-07 15:12

Firstly, apologies for how obvious these two questions seem to be; I\'m very very new to this and don\'t have a clue what I\'m doing.

I\'m trying to write something to a

6条回答
  •  青春惊慌失措
    2021-02-07 15:25

    Second question: how do I input more than one line of code at once? At the moment, if I try to copy the whole thing and then paste it into PyLab, it only inputs the top line of my code, so I have to paste the whole thing in one line at a time. How do I get round this?

    Assuming you're in ipython called as ipython --pylab or something similar, then you can simply use the paste magic command. Call it as %paste or simply paste if you haven't defined paste as another variable:

    In [8]: paste
    import numpy as np
    import scipy as sp
    from scipy.interpolate import interp1d
    
    x=var
    x1 = ([0.1,0.3,0.4])
    y1 = [0.2,0.5,0.6]
    
    new_length = 25
    new_x = np.linspace(x.min(), x.max(), new_length)
    new_y = sp.interpolate.interp1d(x, y, kind='cubic')(new_x)
    
    ## -- End pasted text --
    ---------------------------------------------------------------------------
    NameError                                 Traceback (most recent call last)
     in ()
          3 from scipy.interpolate import interp1d
          4 
    ----> 5 x=var
          6 x1 = ([0.1,0.3,0.4])
          7 y1 = [0.2,0.5,0.6]
    
    NameError: name 'var' is not defined
    
    In [9]: 
    

提交回复
热议问题