pandas calling an element from imported data -
i have csv file dates.
import pandas pd spam=pd.read_csv('data.csv', parse_dates=[0], usecols=[0], header=none) spam.shape is (n,1)
how can call element in numpy (ex. have array a.shape => (n,1), if call a[5,1] element on 5th row in 1st column) ?
numpy arrays index @ zero, you'll need a[4,0] element on 5th row of 1st column.
but how you'd same numpy arrays.
>>> import pandas pd >>> import numpy np >>> df = pd.dataframe(np.random.randn(2,2)) # create 2 2 dataframe object >>> df.ix[1,1] -1.206712609725652 >>> df 0 1 0 -0.281467 1.124922 1 0.580617 -1.206713 iloc integers only, whereas ix work both integers , labels, , available in older versions of pandas.
>>> df.iloc[1,1] -1.206712609725652
Comments
Post a Comment