[Tutor] TypeError: can't multiply sequence by non-int of type 'float'

Sayan Chatterjee sayanchatterjee at gmail.com
Fri Apr 5 21:06:55 CEST 2013


Thanks all...I realized my mistake!!...:)


On 4 April 2013 20:12, Andreas Perstinger <andipersti at gmail.com> wrote:

> Sayan Chatterjee <sayanchatterjee at gmail.com> wrote:
>
> >I know this error occurs when one tries to multiply a string with a
> >fraction i.e float. In my case , I can't figure out how can a numpy
> >floating point array be a string.
>
> The problem is not that the numpy array is a string but that you append
> the array to a python list:
>
> >  pv_za=[]
> >  pv_za.append(-K*np.sin(K*pv_za_temp))
> >  pv_za_temp = []
> >  pv_za_temp.append(np.array(pv_za))
>
> Both "pv_za" and "pv_za_temp" are python lists to which you append a
> numpy array. But since you delete both lists in each iteration I assume
> you want to just assign a new numpy array to both names:
>
> pv_za = -K * np.sin(K * pv_za_temp)
> pv_za_temp = pv_za # "pv_za" is already a numpy array
>
> Bye, Andreas
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>



-- 


--------------------------------------------------------------------------
*Sayan  Chatterjee*
Dept. of Physics and Meteorology
IIT Kharagpur
Lal Bahadur Shastry Hall of Residence
Room AB 205
Mob: +91 9874513565
blog: www.blissprofound.blogspot.com

Volunteer , Padakshep
www.padakshep.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130406/b9cc1d3f/attachment.html>


More information about the Tutor mailing list