python - Pandas DataFrame including three numpy arrays -


i make pandas dataframe contents of 3 diferents numpy arrays.

  1. valor_norte;value of variable numpy.ndarray
  2. valor_este;value of variable numpy.ndarray
  3. dtime numpy.ndarray

    valor_norte

    array([-0.14300001, -0.10600001, -0.075 , -0.054 , -0.041 , -0.035 , -0.03 , -0.017 , 0.007 , 0.038 , 0.07 , 0.09100001, 0.098 , 0.09 , 0.07300001, 0.05 , 0.023 , -0.004 , -0.023 , -0.03 , -0.025 , -0.014 , -0.003 , 0.004 ], dtype=float32)

    valor_este

    array([-0.07600001, -0.078 , -0.071 , -0.06500001, -0.062 , -0.063 , -0.07 , -0.089 , -0.108 , -0.12400001, -0.134 , -0.123 , -0.093 , -0.05 , -0.009 , 0.016 , 0.023 , 0.009 , -0.022 , -0.059 , -0.09200001, -0.11300001, -0.12100001, -0.11400001], dtype=float32)

    dtime

    array([datetime.datetime(2015, 4, 1, 0, 30), datetime.datetime(2015, 4, 1, 1, 30), datetime.datetime(2015, 4, 1, 2, 30), datetime.datetime(2015, 4, 1, 3, 30), datetime.datetime(2015, 4, 1, 4, 30), datetime.datetime(2015, 4, 1, 5, 30), datetime.datetime(2015, 4, 1, 6, 30), datetime.datetime(2015, 4, 1, 7, 30), datetime.datetime(2015, 4, 1, 8, 30), datetime.datetime(2015, 4, 1, 9, 30), datetime.datetime(2015, 4, 1, 10, 30), datetime.datetime(2015, 4, 1, 11, 30), datetime.datetime(2015, 4, 1, 12, 30), datetime.datetime(2015, 4, 1, 13, 30), datetime.datetime(2015, 4, 1, 14, 30), datetime.datetime(2015, 4, 1, 15, 30), datetime.datetime(2015, 4, 1, 16, 30), datetime.datetime(2015, 4, 1, 17, 30), datetime.datetime(2015, 4, 1, 18, 30), datetime.datetime(2015, 4, 1, 19, 30), datetime.datetime(2015, 4, 1, 20, 30), datetime.datetime(2015, 4, 1, 21, 30), datetime.datetime(2015, 4, 1, 22, 30), datetime.datetime(2015, 4, 1, 23, 30)], dtype=object)

code

tabla_datos = pd.dataframe(valor_norte,valor_este,dtime) valueerror: shape of passed values (1, 24), indices imply (24, 24)  tabla_datos = pd.dataframe(valor_norte,valor_este) 

but dataframe uses valor_norte index

indice = dtime.tolist() tabla_datos = pd.dataframe(valor_norte,valor_este, index=indice) 

returns

keyerror: datetime.datetime(2015, 4, 1, 0, 30) 

how make df using index = dtime , columns; valor_este, valor_norte ?

try following. i'm using dict format data

pd.dataframe({'norte' : valor_norte, 'este' : valor_este},index=dtime) 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -