Create an array of timestamps in pythonCalling an external command in PythonWhat are metaclasses in Python?Finding the index of an item given a list containing it in PythonHow do you get a timestamp in JavaScript?How can I safely create a nested directory?Does Python have a ternary conditional operator?Should I use the datetime or timestamp data type in MySQL?How to get the current time in PythonDoes Python have a string 'contains' substring method?single positional indexer is out-of-bounds index error
How do I iterate equal values with the standard library?
List comprehensions in Mathematica?
Why did moving the mouse cursor cause Windows 95 to run more quickly?
How to reclaim personal item I've lent to the office without burning bridges?
Has there ever been a cold war other than between the U.S. and the U.S.S.R.?
My players like to search everything. What do they find?
How frequently do Russian people still refer to others by their patronymic (отчество)?
Why no parachutes in the Orion AA2 abort test?
Why weren't Gemini capsules given names?
What is the highest level of accuracy in motion control a Victorian society could achieve?
Taking my Ph.D. advisor out for dinner after graduation
Why do Klingons use cloaking devices?
What is this arch-and-tower near a road?
What is the fundamental difference between catching whales and hunting other animals?
Should I cheat if the majority does it?
Question about targeting a Hexproof creature
What is exact meaning of “ich wäre gern”?
How to deal with a Murder Hobo Paladin?
Can a Time Lord survive with just one heart?
Should I increase my 401(k) contributions, or increase my mortgage payments
Is it possible that Curiosity measured its own methane or failed doing the spectrometry?
Why do Martians have to wear space helmets?
What's the difference between 反面 and 一方?
The Purpose of "Natu"
Create an array of timestamps in python
Calling an external command in PythonWhat are metaclasses in Python?Finding the index of an item given a list containing it in PythonHow do you get a timestamp in JavaScript?How can I safely create a nested directory?Does Python have a ternary conditional operator?Should I use the datetime or timestamp data type in MySQL?How to get the current time in PythonDoes Python have a string 'contains' substring method?single positional indexer is out-of-bounds index error
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have been trying to create a time vector in python 3.x to plot wind velocity against time.
Wind Velocity was sampled every 5 minutes, starting from 00:00 and finishing at 23:55 (i.e., 288 samples per day).
I use pandas to read the data. I store velocity variables in a numpy vector. I saved variables using numpy.array(met1.loc[ini:fin, 'm/s Wind']) and work perfect for wind speed. When I tried to do it for datetime variables, as numpy.array(met1.loc[ini:fin, 'Measurement Time']) showed me the next error:
'the label [Measurement Time] is not in the [columns]' (please see code behind for more detail)
met1.head() looks like this:
. m/s Wind m/s Gusts ° Direction RH °C Temp
Measurement Time
2018-11-13 11:20:00 6.77 9.5 268 0.068590 12.6
2018-11-13 11:25:00 6.90 10.4 284 0.067255 12.9
2018-11-13 11:30:00 6.59 11.3 279 0.066381 13.1
2018-11-13 11:35:00 7.10 10.1 279 0.073019 13.1
2018-11-13 11:40:00 6.01 9.8 273 0.073498 13.0
Code looks like this:
import numpy as np
import pandas as pd
met1 = pd.read_excel('database.xls', sheet_name=0, skiprows=2, index_col = 'Measurement Time', parse_dates=[0]) #reading data base
def variables (ini, fin):
# Variables for MET-1
wind1 = np.array(met1.loc[ini:fin, 'm/s Wind'])
dir1 = np.array(met1.loc[ini:fin, '° Direction'])
rh1 = np.array(met1.loc[ini:fin, 'RH']) # 0.123
temp1 = np.array(met1.loc[ini:fin, '°C Temp'])
p1 = np.array(met1.loc[ini:fin, 'kPa Pressure'])
tiempo = np.array(met1.loc[ini:fin, 'Measurement Time'])
print(wind1)
print(tiempo)
variables('2018-11-15','2018-11-15')
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
~/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py in _validate_key(self, key, axis)
1789 if not ax.contains(key):
-> 1790 error()
1791 except TypeError as e:
~/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py in error()
1784 .format(key=key,
-> 1785 axis=self.obj._get_axis_name(axis)))
1786
KeyError: 'the label [Measurement Time] is not in the [columns]'
During handling of the above exception, another exception occurred:
KeyError Traceback (most recent call last)
<ipython-input-182-130dc8c7095b> in <module>
1 # variables('2018-11-13','2018-11-13') # Mount day
2 # variables('2018-11-14','2018-11-14') # Mount day
----> 3 variables('2018-11-15','2018-11-15')
4 variables('2018-11-16','2018-11-16')
5 variables('2018-11-17','2018-11-17')
<ipython-input-181-2a7e1e919435> in variables(ini, fin)
17 temp1 = np.array(met1.loc[ini:fin, '°C Temp'])
18 p1 = np.array(met1.loc[ini:fin, 'kPa Pressure'])
---> 19 tiempo = np.array(met1.loc[ini:fin, 'Measurement Time'])
20 print(tiempo)
21
~/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py in __getitem__(self, key)
1470 except (KeyError, IndexError):
1471 pass
-> 1472 return self._getitem_tuple(key)
1473 else:
1474 # we by definition only have the 0th axis
~/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py in _getitem_tuple(self, tup)
868 def _getitem_tuple(self, tup):
869 try:
--> 870 return self._getitem_lowerdim(tup)
871 except IndexingError:
872 pass
~/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py in _getitem_lowerdim(self, tup)
996 for i, key in enumerate(tup):
997 if is_label_like(key) or isinstance(key, tuple):
--> 998 section = self._getitem_axis(key, axis=i)
999
1000 # we have yielded a scalar ?
~/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py in _getitem_axis(self, key, axis)
1909
1910 # fall thru to straight lookup
-> 1911 self._validate_key(key, axis)
1912 return self._get_label(key, axis=axis)
1913
~/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py in _validate_key(self, key, axis)
1796 raise
1797 except:
-> 1798 error()
1799
1800 def _is_scalar_access(self, key):
~/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py in error()
1783 raise KeyError(u"the label [key] is not in the [axis]"
1784 .format(key=key,
-> 1785 axis=self.obj._get_axis_name(axis)))
1786
1787 try:
KeyError: 'the label [Measurement Time] is not in the [columns]'
The time vector I need should look like this!!!: ['00:00' '00:05' ..... '23:50' '23:55'] for date '2018-11-15'
python python-3.x datetime time
|
show 3 more comments
I have been trying to create a time vector in python 3.x to plot wind velocity against time.
Wind Velocity was sampled every 5 minutes, starting from 00:00 and finishing at 23:55 (i.e., 288 samples per day).
I use pandas to read the data. I store velocity variables in a numpy vector. I saved variables using numpy.array(met1.loc[ini:fin, 'm/s Wind']) and work perfect for wind speed. When I tried to do it for datetime variables, as numpy.array(met1.loc[ini:fin, 'Measurement Time']) showed me the next error:
'the label [Measurement Time] is not in the [columns]' (please see code behind for more detail)
met1.head() looks like this:
. m/s Wind m/s Gusts ° Direction RH °C Temp
Measurement Time
2018-11-13 11:20:00 6.77 9.5 268 0.068590 12.6
2018-11-13 11:25:00 6.90 10.4 284 0.067255 12.9
2018-11-13 11:30:00 6.59 11.3 279 0.066381 13.1
2018-11-13 11:35:00 7.10 10.1 279 0.073019 13.1
2018-11-13 11:40:00 6.01 9.8 273 0.073498 13.0
Code looks like this:
import numpy as np
import pandas as pd
met1 = pd.read_excel('database.xls', sheet_name=0, skiprows=2, index_col = 'Measurement Time', parse_dates=[0]) #reading data base
def variables (ini, fin):
# Variables for MET-1
wind1 = np.array(met1.loc[ini:fin, 'm/s Wind'])
dir1 = np.array(met1.loc[ini:fin, '° Direction'])
rh1 = np.array(met1.loc[ini:fin, 'RH']) # 0.123
temp1 = np.array(met1.loc[ini:fin, '°C Temp'])
p1 = np.array(met1.loc[ini:fin, 'kPa Pressure'])
tiempo = np.array(met1.loc[ini:fin, 'Measurement Time'])
print(wind1)
print(tiempo)
variables('2018-11-15','2018-11-15')
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
~/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py in _validate_key(self, key, axis)
1789 if not ax.contains(key):
-> 1790 error()
1791 except TypeError as e:
~/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py in error()
1784 .format(key=key,
-> 1785 axis=self.obj._get_axis_name(axis)))
1786
KeyError: 'the label [Measurement Time] is not in the [columns]'
During handling of the above exception, another exception occurred:
KeyError Traceback (most recent call last)
<ipython-input-182-130dc8c7095b> in <module>
1 # variables('2018-11-13','2018-11-13') # Mount day
2 # variables('2018-11-14','2018-11-14') # Mount day
----> 3 variables('2018-11-15','2018-11-15')
4 variables('2018-11-16','2018-11-16')
5 variables('2018-11-17','2018-11-17')
<ipython-input-181-2a7e1e919435> in variables(ini, fin)
17 temp1 = np.array(met1.loc[ini:fin, '°C Temp'])
18 p1 = np.array(met1.loc[ini:fin, 'kPa Pressure'])
---> 19 tiempo = np.array(met1.loc[ini:fin, 'Measurement Time'])
20 print(tiempo)
21
~/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py in __getitem__(self, key)
1470 except (KeyError, IndexError):
1471 pass
-> 1472 return self._getitem_tuple(key)
1473 else:
1474 # we by definition only have the 0th axis
~/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py in _getitem_tuple(self, tup)
868 def _getitem_tuple(self, tup):
869 try:
--> 870 return self._getitem_lowerdim(tup)
871 except IndexingError:
872 pass
~/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py in _getitem_lowerdim(self, tup)
996 for i, key in enumerate(tup):
997 if is_label_like(key) or isinstance(key, tuple):
--> 998 section = self._getitem_axis(key, axis=i)
999
1000 # we have yielded a scalar ?
~/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py in _getitem_axis(self, key, axis)
1909
1910 # fall thru to straight lookup
-> 1911 self._validate_key(key, axis)
1912 return self._get_label(key, axis=axis)
1913
~/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py in _validate_key(self, key, axis)
1796 raise
1797 except:
-> 1798 error()
1799
1800 def _is_scalar_access(self, key):
~/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py in error()
1783 raise KeyError(u"the label [key] is not in the [axis]"
1784 .format(key=key,
-> 1785 axis=self.obj._get_axis_name(axis)))
1786
1787 try:
KeyError: 'the label [Measurement Time] is not in the [columns]'
The time vector I need should look like this!!!: ['00:00' '00:05' ..... '23:50' '23:55'] for date '2018-11-15'
python python-3.x datetime time
please provide the sample data for your question.
– Regressor
Mar 25 at 18:25
Thanks for your answer. I add the head of the database. I tried to save the variable astiempo = np.array(met1.loc[ini:fin, 'Measurement Time'])but when Iprint(tiempo)show me the next error:'the label [Measurement Time] is not in the [columns]'
– Matias SIGNORIO DUQUE
Mar 25 at 19:53
And what isn't working, exactly?
– juanpa.arrivillaga
Mar 25 at 19:53
If you store measurement time in Python strings, you can just crop them with slices:datetime = datetime[:-3]
– vurmux
Mar 25 at 20:01
1
Edit your question don't put this in the comments. Show us, exactly the output you are seeing and provide an example of the output you require.
– juanpa.arrivillaga
Mar 25 at 20:07
|
show 3 more comments
I have been trying to create a time vector in python 3.x to plot wind velocity against time.
Wind Velocity was sampled every 5 minutes, starting from 00:00 and finishing at 23:55 (i.e., 288 samples per day).
I use pandas to read the data. I store velocity variables in a numpy vector. I saved variables using numpy.array(met1.loc[ini:fin, 'm/s Wind']) and work perfect for wind speed. When I tried to do it for datetime variables, as numpy.array(met1.loc[ini:fin, 'Measurement Time']) showed me the next error:
'the label [Measurement Time] is not in the [columns]' (please see code behind for more detail)
met1.head() looks like this:
. m/s Wind m/s Gusts ° Direction RH °C Temp
Measurement Time
2018-11-13 11:20:00 6.77 9.5 268 0.068590 12.6
2018-11-13 11:25:00 6.90 10.4 284 0.067255 12.9
2018-11-13 11:30:00 6.59 11.3 279 0.066381 13.1
2018-11-13 11:35:00 7.10 10.1 279 0.073019 13.1
2018-11-13 11:40:00 6.01 9.8 273 0.073498 13.0
Code looks like this:
import numpy as np
import pandas as pd
met1 = pd.read_excel('database.xls', sheet_name=0, skiprows=2, index_col = 'Measurement Time', parse_dates=[0]) #reading data base
def variables (ini, fin):
# Variables for MET-1
wind1 = np.array(met1.loc[ini:fin, 'm/s Wind'])
dir1 = np.array(met1.loc[ini:fin, '° Direction'])
rh1 = np.array(met1.loc[ini:fin, 'RH']) # 0.123
temp1 = np.array(met1.loc[ini:fin, '°C Temp'])
p1 = np.array(met1.loc[ini:fin, 'kPa Pressure'])
tiempo = np.array(met1.loc[ini:fin, 'Measurement Time'])
print(wind1)
print(tiempo)
variables('2018-11-15','2018-11-15')
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
~/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py in _validate_key(self, key, axis)
1789 if not ax.contains(key):
-> 1790 error()
1791 except TypeError as e:
~/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py in error()
1784 .format(key=key,
-> 1785 axis=self.obj._get_axis_name(axis)))
1786
KeyError: 'the label [Measurement Time] is not in the [columns]'
During handling of the above exception, another exception occurred:
KeyError Traceback (most recent call last)
<ipython-input-182-130dc8c7095b> in <module>
1 # variables('2018-11-13','2018-11-13') # Mount day
2 # variables('2018-11-14','2018-11-14') # Mount day
----> 3 variables('2018-11-15','2018-11-15')
4 variables('2018-11-16','2018-11-16')
5 variables('2018-11-17','2018-11-17')
<ipython-input-181-2a7e1e919435> in variables(ini, fin)
17 temp1 = np.array(met1.loc[ini:fin, '°C Temp'])
18 p1 = np.array(met1.loc[ini:fin, 'kPa Pressure'])
---> 19 tiempo = np.array(met1.loc[ini:fin, 'Measurement Time'])
20 print(tiempo)
21
~/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py in __getitem__(self, key)
1470 except (KeyError, IndexError):
1471 pass
-> 1472 return self._getitem_tuple(key)
1473 else:
1474 # we by definition only have the 0th axis
~/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py in _getitem_tuple(self, tup)
868 def _getitem_tuple(self, tup):
869 try:
--> 870 return self._getitem_lowerdim(tup)
871 except IndexingError:
872 pass
~/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py in _getitem_lowerdim(self, tup)
996 for i, key in enumerate(tup):
997 if is_label_like(key) or isinstance(key, tuple):
--> 998 section = self._getitem_axis(key, axis=i)
999
1000 # we have yielded a scalar ?
~/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py in _getitem_axis(self, key, axis)
1909
1910 # fall thru to straight lookup
-> 1911 self._validate_key(key, axis)
1912 return self._get_label(key, axis=axis)
1913
~/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py in _validate_key(self, key, axis)
1796 raise
1797 except:
-> 1798 error()
1799
1800 def _is_scalar_access(self, key):
~/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py in error()
1783 raise KeyError(u"the label [key] is not in the [axis]"
1784 .format(key=key,
-> 1785 axis=self.obj._get_axis_name(axis)))
1786
1787 try:
KeyError: 'the label [Measurement Time] is not in the [columns]'
The time vector I need should look like this!!!: ['00:00' '00:05' ..... '23:50' '23:55'] for date '2018-11-15'
python python-3.x datetime time
I have been trying to create a time vector in python 3.x to plot wind velocity against time.
Wind Velocity was sampled every 5 minutes, starting from 00:00 and finishing at 23:55 (i.e., 288 samples per day).
I use pandas to read the data. I store velocity variables in a numpy vector. I saved variables using numpy.array(met1.loc[ini:fin, 'm/s Wind']) and work perfect for wind speed. When I tried to do it for datetime variables, as numpy.array(met1.loc[ini:fin, 'Measurement Time']) showed me the next error:
'the label [Measurement Time] is not in the [columns]' (please see code behind for more detail)
met1.head() looks like this:
. m/s Wind m/s Gusts ° Direction RH °C Temp
Measurement Time
2018-11-13 11:20:00 6.77 9.5 268 0.068590 12.6
2018-11-13 11:25:00 6.90 10.4 284 0.067255 12.9
2018-11-13 11:30:00 6.59 11.3 279 0.066381 13.1
2018-11-13 11:35:00 7.10 10.1 279 0.073019 13.1
2018-11-13 11:40:00 6.01 9.8 273 0.073498 13.0
Code looks like this:
import numpy as np
import pandas as pd
met1 = pd.read_excel('database.xls', sheet_name=0, skiprows=2, index_col = 'Measurement Time', parse_dates=[0]) #reading data base
def variables (ini, fin):
# Variables for MET-1
wind1 = np.array(met1.loc[ini:fin, 'm/s Wind'])
dir1 = np.array(met1.loc[ini:fin, '° Direction'])
rh1 = np.array(met1.loc[ini:fin, 'RH']) # 0.123
temp1 = np.array(met1.loc[ini:fin, '°C Temp'])
p1 = np.array(met1.loc[ini:fin, 'kPa Pressure'])
tiempo = np.array(met1.loc[ini:fin, 'Measurement Time'])
print(wind1)
print(tiempo)
variables('2018-11-15','2018-11-15')
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
~/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py in _validate_key(self, key, axis)
1789 if not ax.contains(key):
-> 1790 error()
1791 except TypeError as e:
~/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py in error()
1784 .format(key=key,
-> 1785 axis=self.obj._get_axis_name(axis)))
1786
KeyError: 'the label [Measurement Time] is not in the [columns]'
During handling of the above exception, another exception occurred:
KeyError Traceback (most recent call last)
<ipython-input-182-130dc8c7095b> in <module>
1 # variables('2018-11-13','2018-11-13') # Mount day
2 # variables('2018-11-14','2018-11-14') # Mount day
----> 3 variables('2018-11-15','2018-11-15')
4 variables('2018-11-16','2018-11-16')
5 variables('2018-11-17','2018-11-17')
<ipython-input-181-2a7e1e919435> in variables(ini, fin)
17 temp1 = np.array(met1.loc[ini:fin, '°C Temp'])
18 p1 = np.array(met1.loc[ini:fin, 'kPa Pressure'])
---> 19 tiempo = np.array(met1.loc[ini:fin, 'Measurement Time'])
20 print(tiempo)
21
~/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py in __getitem__(self, key)
1470 except (KeyError, IndexError):
1471 pass
-> 1472 return self._getitem_tuple(key)
1473 else:
1474 # we by definition only have the 0th axis
~/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py in _getitem_tuple(self, tup)
868 def _getitem_tuple(self, tup):
869 try:
--> 870 return self._getitem_lowerdim(tup)
871 except IndexingError:
872 pass
~/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py in _getitem_lowerdim(self, tup)
996 for i, key in enumerate(tup):
997 if is_label_like(key) or isinstance(key, tuple):
--> 998 section = self._getitem_axis(key, axis=i)
999
1000 # we have yielded a scalar ?
~/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py in _getitem_axis(self, key, axis)
1909
1910 # fall thru to straight lookup
-> 1911 self._validate_key(key, axis)
1912 return self._get_label(key, axis=axis)
1913
~/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py in _validate_key(self, key, axis)
1796 raise
1797 except:
-> 1798 error()
1799
1800 def _is_scalar_access(self, key):
~/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py in error()
1783 raise KeyError(u"the label [key] is not in the [axis]"
1784 .format(key=key,
-> 1785 axis=self.obj._get_axis_name(axis)))
1786
1787 try:
KeyError: 'the label [Measurement Time] is not in the [columns]'
The time vector I need should look like this!!!: ['00:00' '00:05' ..... '23:50' '23:55'] for date '2018-11-15'
python python-3.x datetime time
python python-3.x datetime time
edited Mar 25 at 20:39
Matias SIGNORIO DUQUE
asked Mar 25 at 18:05
Matias SIGNORIO DUQUEMatias SIGNORIO DUQUE
114 bronze badges
114 bronze badges
please provide the sample data for your question.
– Regressor
Mar 25 at 18:25
Thanks for your answer. I add the head of the database. I tried to save the variable astiempo = np.array(met1.loc[ini:fin, 'Measurement Time'])but when Iprint(tiempo)show me the next error:'the label [Measurement Time] is not in the [columns]'
– Matias SIGNORIO DUQUE
Mar 25 at 19:53
And what isn't working, exactly?
– juanpa.arrivillaga
Mar 25 at 19:53
If you store measurement time in Python strings, you can just crop them with slices:datetime = datetime[:-3]
– vurmux
Mar 25 at 20:01
1
Edit your question don't put this in the comments. Show us, exactly the output you are seeing and provide an example of the output you require.
– juanpa.arrivillaga
Mar 25 at 20:07
|
show 3 more comments
please provide the sample data for your question.
– Regressor
Mar 25 at 18:25
Thanks for your answer. I add the head of the database. I tried to save the variable astiempo = np.array(met1.loc[ini:fin, 'Measurement Time'])but when Iprint(tiempo)show me the next error:'the label [Measurement Time] is not in the [columns]'
– Matias SIGNORIO DUQUE
Mar 25 at 19:53
And what isn't working, exactly?
– juanpa.arrivillaga
Mar 25 at 19:53
If you store measurement time in Python strings, you can just crop them with slices:datetime = datetime[:-3]
– vurmux
Mar 25 at 20:01
1
Edit your question don't put this in the comments. Show us, exactly the output you are seeing and provide an example of the output you require.
– juanpa.arrivillaga
Mar 25 at 20:07
please provide the sample data for your question.
– Regressor
Mar 25 at 18:25
please provide the sample data for your question.
– Regressor
Mar 25 at 18:25
Thanks for your answer. I add the head of the database. I tried to save the variable as
tiempo = np.array(met1.loc[ini:fin, 'Measurement Time']) but when I print(tiempo) show me the next error: 'the label [Measurement Time] is not in the [columns]'– Matias SIGNORIO DUQUE
Mar 25 at 19:53
Thanks for your answer. I add the head of the database. I tried to save the variable as
tiempo = np.array(met1.loc[ini:fin, 'Measurement Time']) but when I print(tiempo) show me the next error: 'the label [Measurement Time] is not in the [columns]'– Matias SIGNORIO DUQUE
Mar 25 at 19:53
And what isn't working, exactly?
– juanpa.arrivillaga
Mar 25 at 19:53
And what isn't working, exactly?
– juanpa.arrivillaga
Mar 25 at 19:53
If you store measurement time in Python strings, you can just crop them with slices:
datetime = datetime[:-3]– vurmux
Mar 25 at 20:01
If you store measurement time in Python strings, you can just crop them with slices:
datetime = datetime[:-3]– vurmux
Mar 25 at 20:01
1
1
Edit your question don't put this in the comments. Show us, exactly the output you are seeing and provide an example of the output you require.
– juanpa.arrivillaga
Mar 25 at 20:07
Edit your question don't put this in the comments. Show us, exactly the output you are seeing and provide an example of the output you require.
– juanpa.arrivillaga
Mar 25 at 20:07
|
show 3 more comments
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55344000%2fcreate-an-array-of-timestamps-in-python%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55344000%2fcreate-an-array-of-timestamps-in-python%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
please provide the sample data for your question.
– Regressor
Mar 25 at 18:25
Thanks for your answer. I add the head of the database. I tried to save the variable as
tiempo = np.array(met1.loc[ini:fin, 'Measurement Time'])but when Iprint(tiempo)show me the next error:'the label [Measurement Time] is not in the [columns]'– Matias SIGNORIO DUQUE
Mar 25 at 19:53
And what isn't working, exactly?
– juanpa.arrivillaga
Mar 25 at 19:53
If you store measurement time in Python strings, you can just crop them with slices:
datetime = datetime[:-3]– vurmux
Mar 25 at 20:01
1
Edit your question don't put this in the comments. Show us, exactly the output you are seeing and provide an example of the output you require.
– juanpa.arrivillaga
Mar 25 at 20:07