噜噜哒
尝试:from datetime import datetimedata2012 = np.loadtxt("try.txt", converters={0:lambda t: datetime.strptime(t.decode(), '%m-%d-%Y %H:%M')}, delimiter=',' , dtype={ 'names': ('time', 'col1', 'col2', 'col3',), 'formats': ('datetime64[m]', 'float', 'float', 'float') } )data2012array([('2012-01-01T00:00', 0.36, -3.42, 0.76), ('2012-01-01T00:30', 0.35, -3.45, 0.75), ('2012-01-01T01:00', 0.35, -3.42, 0.76), ('2012-01-01T01:30', 0.36, -3.43, 0.76), ('2012-01-01T02:00', 0.36, -3.44, 0.75)], dtype=[('time', '<M8[m]'), ('col1', '<f8'), ('col2', '<f8'), ('col3', '<f8')])或者:df = pd.read_csv("try.txt", header=None, date_parser=[0])df 0 1 2 30 01-01-2012 00:00 0.36 -3.42 0.761 01-01-2012 00:30 0.35 -3.45 0.752 01-01-2012 01:00 0.35 -3.42 0.763 01-01-2012 01:30 0.36 -3.43 0.764 01-01-2012 02:00 0.36 -3.44 0.75