hi, I am new to Python at beginner level and following Mr Mosh tutorials.
while I am following Mr Mosh coding a simple project that involves automation that process thousands of spreadsheets in under a second, and do act in accordance with him step by step. Although the codes mine and his are the same but when I run the code I am getting something like:
corrected_price = cell.value * 0.9
TypeError: unsupported operand type(s) for *: ‘NoneType’ and ‘float’
The error indicates that you try to multiply a None type with a float which makes no sense mathematically. perhaps you should check the cell to see if it’s empty.
I assume that the value should be presumed to be 0 if not present, but I do not own the Python course so I am not certain what the behavior should be for an empty cell.
yeah I had same problem and the fix was this:
Since I created the excel sheet in google sheets, the max rows were 1000.
So to fix the error, I simply added 0 (zero) to all the rows below the 4 rows ( all 1000 of them ) with 0 data and then re-imported back into Python.
Or you could simply delete the rows 5-1000 in google sheet, download and re-upload into Python.
This resolved it.