![]() ![]() ![]() Self._foreColor = Color(value, lorSpace)įile “C:\Program Files\PsychoP圓\lib\site-packages\psychopy\colors.py”, line 245, in initįile “C:\Program Files\PsychoP圓\lib\site-packages\psychopy\colors.py”, line 334, in setĬolor, space = self.validate(color, space)įile “C:\Program Files\PsychoP圓\lib\site-packages\psychopy\colors.py”, line 291, in validateįile “C:\Program Files\PsychoP圓\lib\site-packages\psychopy\colors. The Python ValueError: could not convert string to float occurs when you pass a string that can’t be converted into a float to the float() function. tForeColor(color, colorSpace=colorSpace, operation=operation, log=log)įile “C:\Program Files\PsychoP圓\lib\site-packages\psychopy\visual\basevisual.py”, line 503, in setForeColorįile “C:\Program Files\PsychoP圓\lib\site-packages\psychopy\visual\basevisual.py”, line 353, in foreColor tColor(WordColour, colorSpace=‘rgb’)įile “C:\Program Files\PsychoP圓\lib\site-packages\psychopy\visual\basevisual.py”, line 514, in setColor What specifically went wrong when you tried that?:įile “C:\Users\Cooco\Desktop\CO_productioneffects_test_lastrun.py”, line 1806, in In this case, you should use a try/except block. implies that the Python interpreter was unable to convert a string to float. In the first Stackoverflow question, the error was caused by attempting to convert a non-numeric value to float. **What did you try to make it work?: I tried a lot – $WordColour, $WordColour($cur_colour), I tried putting WordColour = because I’m only using blue and red ValueError: could not convert string to float. The result of calling input() always has type str it doesn’t change based on what you enter. 1 Answer Sorted by: 2 To cast that column of your data-frame as type float try: ktrain train colstouse.astype (float) target train finalstatus. Lets try to use pandas dataframe and convert strings into numeric classes from sklearn import preprocessing def convert (data): number preprocessing. **What are you trying to achieve?: All I’m trying to do is get the code to randomize text colour for each randomized word You might be confused about what type means (or maybe specifically how types work in Python). ![]()
0 Comments
Leave a Reply. |