0

I have a time series saved in an excel cell, which I want to load for future calculations. I have tried to load them using pandas, but get something like this

KE = '[ 0.  0.  0. ... nan nan nan]'

KE.type is giving this response -

'numpy.str_' object has no attribute 'type'

I want KE to be a time series as I saved the array to the cell, which should be like this

KE = [0,0,0,.......nan,nan,nan]

Could you guys please help me here, thank you.

1 Answer 1

1

if it is string, following should help you ...

KE = '[0. 0. 0. nan nan]'.replace('[','').replace(']','').split(' ')
print(np.array(list(map(float,KE))))

#op
array([ 0.,  0.,  0., nan, nan])
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.