Skip to content
Advertisement

Reading numbers from file and normalizing

Hello Everyone, I want to load the data I have in a file, which looks like:

JavaScript

Now, I want to load this from the file and compute the normalization. I do:

JavaScript

But, I am getting the error:

JavaScript

Although, I do the process directly into python 2.7 console in linux like,

JavaScript

This works fine. I don’t know what I am doing wrong. Please help me and I am new to programming. Thanks in advance!

Advertisement

Answer

You need to convert the strings in the file to floats first.

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement