1
# Convert string column to float
def str_column_to_float(dataset, column):
    for row in dataset:
        row[column] = float(row[column].strip())
        print(row[column])

Am trying to create a above function in python using jupyter notebook. But am getting error like below:

File "<ipython-input-5-b591f37367db>", line 5
    print(row[column])
                      ^
TabError: inconsistent use of tabs and spaces in indentation

Can anyone help me to fix this?

Carlos Cordoba
  • 33,273
  • 10
  • 95
  • 124
Yogesh
  • 21
  • 2
  • Welcome to SO! There are whitespace characters on the line with `print(...` while tabs were used to indent the other lines, replace all whitespace characters with tabs. – Vasil Velichkov Feb 21 '20 at 01:48
  • 1
    Does this answer your question? ["inconsistent use of tabs and spaces in indentation"](https://stackoverflow.com/questions/5685406/inconsistent-use-of-tabs-and-spaces-in-indentation) – kaya3 Feb 21 '20 at 02:23

1 Answers1

0

Make sure the spaces and indentations are proper. The code you have entered should look something like this: enter image description here