Type Error in Python - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Type Error in Python (/thread-33118.html) |
Type Error in Python - MarcusB - Mar-30-2021 Why do I get "TypeError: can't multiply sequence by non-int of type 'float'" with the code below? #add ranges to list of tuple pairs ranges = [] a_values = [] b_values = [] for x in params: a = min(df[params][x]) a = a - (a*.25) b = max(df[params][x]) b = b + (b*.25) ranges.append((a,b)) for x in range(len(df['Player'])): if df['Player'][x] == 'Bruno Fernandes': a_values = df.iloc[x].values.tolist() if df['Player'][x] == 'K. De Bruyne': b_values = df.iloc[x].values.tolist() a_values = a_values[1:] b_values = b_values[1:] values = [a_values,b_values] RE: Type Error in Python - buran - Mar-30-2021 what is df ? what is params ? Also post full traceback in error tags.
RE: Type Error in Python - MarcusB - Mar-30-2021 (Mar-30-2021, 06:19 PM)buran Wrote: what is Sorry, I'm very new to this whole coding thing. Df = Data frame. Params = Parameters Full traceback: --------------------------------------------------------------------------- TypeError: can't multiply sequence by non-int of type 'float'
RE: Type Error in Python - buran - Mar-30-2021 (Mar-30-2021, 06:23 PM)MarcusB Wrote: Df = Data frame. Params = ParametersWe can guess that. The question is what are their values. |