@@ -303,25 +303,32 @@ def _loadFile(self, filename, max_num_lines=-1, cols=[], final_lines=-1):
303
303
data = self .data [- final_lines :]
304
304
305
305
# Convert from pandas to numpy
306
- dtype = np .dtype (
307
- [
308
- (data .dtypes .index [idx ].values , data .dtypes [idx ].name )
309
- for idx , i in enumerate (data .dtypes )
310
- ]
311
- )
312
- self .data = np .zeros (np .size (data [dtype .names [0 ]]), dtype = dtype )
313
- for i in data :
314
- self .data [i ] = data [i ].to_numpy ()
315
-
316
- dtype = np .dtype (
317
- [
318
- (head .dtypes .index [idx ], head .dtypes [idx ].name )
319
- for idx , i in enumerate (head .dtypes )
320
- ]
321
- )
322
- self .head = np .zeros (1 , dtype = dtype )
323
- for i in head :
324
- self .head [i ] = head [i ].to_numpy ()
306
+ # dtype = np.dtype(
307
+ # [
308
+ # (data.dtypes.index[idx].values, data.dtypes[idx].name)
309
+ # for idx, i in enumerate(data.dtypes)
310
+ # ]
311
+ # )
312
+ # self.data = np.zeros(np.size(data[dtype.names[0]]), dtype=dtype)
313
+ # for i in data:
314
+ # self.data[i] = data[i].to_numpy()
315
+
316
+ records = data .to_records (index = False )
317
+ self .data = np .array (records , dtype = records .dtype .descr )
318
+
319
+ # dtype = np.dtype(
320
+ # [
321
+ # (head.dtypes.index[idx], head.dtypes[idx].name)
322
+ # for idx, i in enumerate(head.dtypes)
323
+ # ]
324
+ # )
325
+ # self.head = np.zeros(1, dtype=dtype)
326
+ # for i in head:
327
+ # self.head[i] = head[i].to_numpy()
328
+
329
+ records = data .to_records (index = False )
330
+ self .head = np .array (records , dtype = records .dtype .descr )
331
+
325
332
326
333
self ._loaded = True
327
334
self ._saveFile (filename )
0 commit comments