Reputation: 307
I have CSV file which has 2 columns. Time, Value. I want to read value, say corresponding to 104 nanoseconds but problem is Time is in exponential format and power of exponent keep on changing to ensure that there is just one digit before the decimal. Example.
One way is I read entire column then read last 2 digit and see how many nanoseconds it is. Is there a 'Pythonian' way to do this more quickly?
Upvotes: 0
Views: 59
Reputation: 940
Assuming your exponential values are numbers and not strings, exponential values are valid floats, so you could just multiply the values in the column by 10^9 for nano seconds
for example:
6.e-07 * 1000000000
would give you 600
if it is a string, then you can just cast it to a float:
float("6.e-07") * 1000000000
Upvotes: 1