Can anyone explain this

Why first code is not converting into float?
First Code :

import pandas as pd
import numpy as np
X = pd.Series([1,2,3],index=['First','Second','Third'])
pd.Series(X, dtype=np.float)
X

Second Code:
X = pd.Series([1,2,3,4,5],
              index=['first','second','third','forth','fifth'])
pd.Series(X, dtype=np.float)

Please post your code instead of a picture. Thanks.

I added the code, pls check

This line creates a new series. It doesn’t change X.

Ok. Now I understood , Thanks

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.