1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
U
P±d§†ã@s2ddlZddlZddlZddlZddlZddlZddlZddlZddlmZm    Z
m Z ddl m Z ddlZddlmZddlmZddlmZddlmZmZdd    lmZdd
lmZmZdd lmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)dd l*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0d ddddddddddddg Z1ej2ej3ddZ3Gdd„dƒZ4dd„Z5Gd d!„d!e ƒZ6edƒd\ej7d%œd&d„ƒZ8d]d'd(„Z9e3e9ƒd^d)d„ƒZ:d*d+„Z;e3e;ƒd,d„ƒZ<d-d.„Z=e3e=ƒd/d„ƒZ>d_d0d1„Z?d2d3„Z@eAd4œd5d6„ZBd7ZCd`dd8œd9d:„ZDdad<d=„ZEd>d?„ZFd7ZCd@dAdBdCdddddd"ejGdDdEœ dFdG„ZHeedƒeIdAddddd"ddDdf
dddHœdId„ƒƒZJe3eDd#dJeJƒZKdbdKdL„ZLe3eLƒdcdRd „ƒZMedƒdddSd„ƒZNdedddTœdUdV„ZOeedƒeIdAddddddddddP PeQe jRƒ¡dWd"d#dXdd"d#d#ddDfdddTœdYd„ƒƒZSe3eOd#dJeSƒZTdZd„ZUd[d„ZVdS)féN)Ú
itemgetterÚindexÚ methodcaller)ÚMappingé)Úformat)Ú
DataSource)Ú    overrides)ÚpackbitsÚ
unpackbits)Ú_load_from_filelike)Úset_array_function_like_docÚ
set_module) Ú LineSplitterÚ NameValidatorÚStringConverterÚConverterErrorÚConverterLockErrorÚConversionWarningÚ_is_string_likeÚhas_nested_fieldsÚ flatten_dtypeÚ
easy_dtypeÚ _decode_line)ÚasbytesÚasstrÚ    asunicodeÚ    os_fspathÚ os_PathLikeÚpickleÚsavetxtÚloadtxtÚ
genfromtxtÚ
recfromtxtÚ
recfromcsvÚloadÚsaveÚsavezÚsavez_compressedr
r Ú    fromregexrÚnumpy)Úmodulec@s(eZdZdZdd„Zdd„Zdd„ZdS)    ÚBagObjam
    BagObj(obj)
 
    Convert attribute look-ups to getitems on the object passed in.
 
    Parameters
    ----------
    obj : class instance
        Object on which attribute look-up is performed.
 
    Examples
    --------
    >>> from numpy.lib.npyio import BagObj as BO
    >>> class BagDemo:
    ...     def __getitem__(self, key): # An instance of BagObj(BagDemo)
    ...                                 # will call this method when any
    ...                                 # attribute look-up is required
    ...         result = "Doesn't matter what you want, "
    ...         return result + "you're gonna get this"
    ...
    >>> demo_obj = BagDemo()
    >>> bagobj = BO(demo_obj)
    >>> bagobj.hello_there
    "Doesn't matter what you want, you're gonna get this"
    >>> bagobj.I_can_be_anything
    "Doesn't matter what you want, you're gonna get this"
 
    cCst |¡|_dS©N)ÚweakrefÚproxyÚ_obj)ÚselfÚobj©r3úFd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\numpy/lib/npyio.pyÚ__init__HszBagObj.__init__cCs6zt |d¡|WStk
r0t|ƒd‚YnXdS)Nr0)ÚobjectÚ__getattribute__ÚKeyErrorÚAttributeError)r1Úkeyr3r3r4r7LszBagObj.__getattribute__cCstt |d¡ ¡ƒS)zŽ
        Enables dir(bagobj) to list the files in an NpzFile.
 
        This also enables tab-completion in an interpreter or IPython.
        r0)Úlistr6r7Úkeys©r1r3r3r4Ú__dir__RszBagObj.__dir__N)Ú__name__Ú
__module__Ú __qualname__Ú__doc__r5r7r>r3r3r3r4r,*sr,cOs4t|dƒst|ƒ}ddl}d|d<|j|f|ž|ŽS)zÄ
    Create a ZipFile.
 
    Allows for Zip64, and the `file` argument can accept file, str, or
    pathlib.Path objects. `args` and `kwargs` are passed to the zipfile.ZipFile
    constructor.
    ÚreadrNTÚ
allowZip64)ÚhasattrrÚzipfileÚZipFile)ÚfileÚargsÚkwargsrFr3r3r4Úzipfile_factory[s
 
rKc@sbeZdZdZdZdZdejdœdd„Zdd„Z    d    d
„Z
d d „Z d d„Z dd„Z dd„Zdd„ZdS)ÚNpzFileaü    
    NpzFile(fid)
 
    A dictionary-like object with lazy-loading of files in the zipped
    archive provided on construction.
 
    `NpzFile` is used to load files in the NumPy ``.npz`` data archive
    format. It assumes that files in the archive have a ``.npy`` extension,
    other files are ignored.
 
    The arrays and file strings are lazily loaded on either
    getitem access using ``obj['key']`` or attribute lookup using
    ``obj.f.key``. A list of all files (without ``.npy`` extensions) can
    be obtained with ``obj.files`` and the ZipFile object itself using
    ``obj.zip``.
 
    Attributes
    ----------
    files : list of str
        List of all files in the archive with a ``.npy`` extension.
    zip : ZipFile instance
        The ZipFile object initialized with the zipped archive.
    f : BagObj instance
        An object on which attribute can be performed as an alternative
        to getitem access on the `NpzFile` instance itself.
    allow_pickle : bool, optional
        Allow loading pickled data. Default: False
 
        .. versionchanged:: 1.16.3
            Made default False in response to CVE-2019-6446.
 
    pickle_kwargs : dict, optional
        Additional keyword arguments to pass on to pickle.load.
        These are only useful when loading object arrays saved on
        Python 2 when using Python 3.
    max_header_size : int, optional
        Maximum allowed size of the header.  Large headers may not be safe
        to load securely and thus require explicitly passing a larger value.
        See :py:meth:`ast.literal_eval()` for details.
        This option is ignored when `allow_pickle` is passed.  In that case
        the file is by definition trusted and the limit is unnecessary.
 
    Parameters
    ----------
    fid : file or str
        The zipped archive to open. This is either a file-like object
        or a string containing the path to the archive.
    own_fid : bool, optional
        Whether NpzFile should close the file handle.
        Requires that `fid` is a file-like object.
 
    Examples
    --------
    >>> from tempfile import TemporaryFile
    >>> outfile = TemporaryFile()
    >>> x = np.arange(10)
    >>> y = np.sin(x)
    >>> np.savez(outfile, x=x, y=y)
    >>> _ = outfile.seek(0)
 
    >>> npz = np.load(outfile)
    >>> isinstance(npz, np.lib.npyio.NpzFile)
    True
    >>> sorted(npz.files)
    ['x', 'y']
    >>> npz['x']  # getitem access
    array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
    >>> npz.f.x  # attribute lookup
    array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
 
    NF©Úmax_header_sizecCs€t|ƒ}| ¡|_g|_||_||_||_|jD]0}| d¡rT|j |dd…¡q0|j |¡q0||_    t
|ƒ|_ |r|||_ dS)Nú.npyéüÿÿÿ) rKÚnamelistÚ_filesÚfilesÚ allow_picklerNÚ pickle_kwargsÚendswithÚappendÚzipr,ÚfÚfid)r1rZÚown_fidrTrUrNÚ_zipÚxr3r3r4r5¶s
 
 
 
zNpzFile.__init__cCs|Sr-r3r=r3r3r4Ú    __enter__ËszNpzFile.__enter__cCs | ¡dSr-©Úclose)r1Úexc_typeÚ    exc_valueÚ    tracebackr3r3r4Ú__exit__ÎszNpzFile.__exit__cCs>|jdk    r|j ¡d|_|jdk    r4|j ¡d|_d|_dS)z"
        Close the file.
 
        N)rXr`rZrYr=r3r3r4r`Ñs
 
 
 
z NpzFile.closecCs | ¡dSr-r_r=r3r3r4Ú__del__ÞszNpzFile.__del__cCs
t|jƒSr-)ÚiterrSr=r3r3r4Ú__iter__âszNpzFile.__iter__cCs
t|jƒSr-)ÚlenrSr=r3r3r4Ú__len__åszNpzFile.__len__cCsžd}||jkrd}n||jkr*d}|d7}|rŽ|j |¡}| ttjƒ¡}| ¡|tjkr€|j |¡}tj    ||j
|j |j dS|j |¡Sn t d|ƒ‚dS)NFTrO©rTrUrNz%s is not a file in the archive)rRrSrXÚopenrCrhrÚ MAGIC_PREFIXr`Ú
read_arrayrTrUrNr8)r1r:ÚmemberÚbytesÚmagicr3r3r4Ú __getitem__ès&    
 
 
 ýzNpzFile.__getitem__)FFN)r?r@rArBrXrZrÚ_MAX_HEADER_SIZEr5r^rdr`rergrirqr3r3r3r4rLjsHÿþ  rLFTÚASCIIrMc CsŒ|dkrtdƒ‚t||d}t ¡\}t|dƒr<|}d}    n| tt|ƒdƒ¡}d}    d}
d    } tt    j
ƒ} |  | ¡} |  t | t| ƒƒ d
¡|  |
¡sœ|  | ¡rÆ| ¡t||    |||d }|W5QR£S| t    j
kr|rú|rÞd }t    j|||d W5QR£St    j||||dW5QR£Snd|s(tdƒ‚ztj|f|ŽWW5QR£Stk
r|}zt d|›d¡|‚W5d}~XYnXW5QRXdS)a°
    Load arrays or pickled objects from ``.npy``, ``.npz`` or pickled files.
 
    .. warning:: Loading files that contain object arrays uses the ``pickle``
                 module, which is not secure against erroneous or maliciously
                 constructed data. Consider passing ``allow_pickle=False`` to
                 load data that is known not to contain object arrays for the
                 safer handling of untrusted sources.
 
    Parameters
    ----------
    file : file-like object, string, or pathlib.Path
        The file to read. File-like objects must support the
        ``seek()`` and ``read()`` methods and must always
        be opened in binary mode.  Pickled files require that the
        file-like object support the ``readline()`` method as well.
    mmap_mode : {None, 'r+', 'r', 'w+', 'c'}, optional
        If not None, then memory-map the file, using the given mode (see
        `numpy.memmap` for a detailed description of the modes).  A
        memory-mapped array is kept on disk. However, it can be accessed
        and sliced like any ndarray.  Memory mapping is especially useful
        for accessing small fragments of large files without reading the
        entire file into memory.
    allow_pickle : bool, optional
        Allow loading pickled object arrays stored in npy files. Reasons for
        disallowing pickles include security, as loading pickled data can
        execute arbitrary code. If pickles are disallowed, loading object
        arrays will fail. Default: False
 
        .. versionchanged:: 1.16.3
            Made default False in response to CVE-2019-6446.
 
    fix_imports : bool, optional
        Only useful when loading Python 2 generated pickled files on Python 3,
        which includes npy/npz files containing object arrays. If `fix_imports`
        is True, pickle will try to map the old Python 2 names to the new names
        used in Python 3.
    encoding : str, optional
        What encoding to use when reading Python 2 strings. Only useful when
        loading Python 2 generated pickled files in Python 3, which includes
        npy/npz files containing object arrays. Values other than 'latin1',
        'ASCII', and 'bytes' are not allowed, as they can corrupt numerical
        data. Default: 'ASCII'
    max_header_size : int, optional
        Maximum allowed size of the header.  Large headers may not be safe
        to load securely and thus require explicitly passing a larger value.
        See :py:meth:`ast.literal_eval()` for details.
        This option is ignored when `allow_pickle` is passed.  In that case
        the file is by definition trusted and the limit is unnecessary.
 
    Returns
    -------
    result : array, tuple, dict, etc.
        Data stored in the file. For ``.npz`` files, the returned instance
        of NpzFile class must be closed to avoid leaking file descriptors.
 
    Raises
    ------
    OSError
        If the input file does not exist or cannot be read.
    UnpicklingError
        If ``allow_pickle=True``, but the file cannot be loaded as a pickle.
    ValueError
        The file contains an object array, but ``allow_pickle=False`` given.
 
    See Also
    --------
    save, savez, savez_compressed, loadtxt
    memmap : Create a memory-map to an array stored in a file on disk.
    lib.format.open_memmap : Create or load a memory-mapped ``.npy`` file.
 
    Notes
    -----
    - If the file contains pickle data, then whatever object is stored
      in the pickle is returned.
    - If the file is a ``.npy`` file, then a single array is returned.
    - If the file is a ``.npz`` file, then a dictionary-like object is
      returned, containing ``{filename: array}`` key-value pairs, one for
      each file in the archive.
    - If the file is a ``.npz`` file, the returned value supports the
      context manager protocol in a similar fashion to the open function::
 
        with load('foo.npz') as data:
            a = data['a']
 
      The underlying file descriptor is closed when exiting the 'with'
      block.
 
    Examples
    --------
    Store data to disk, and load it again:
 
    >>> np.save('/tmp/123', np.array([[1, 2, 3], [4, 5, 6]]))
    >>> np.load('/tmp/123.npy')
    array([[1, 2, 3],
           [4, 5, 6]])
 
    Store compressed data to disk, and load it again:
 
    >>> a=np.array([[1, 2, 3], [4, 5, 6]])
    >>> b=np.array([1, 2])
    >>> np.savez('/tmp/123.npz', a=a, b=b)
    >>> data = np.load('/tmp/123.npz')
    >>> data['a']
    array([[1, 2, 3],
           [4, 5, 6]])
    >>> data['b']
    array([1, 2])
    >>> data.close()
 
    Mem-map the stored array, and then access the second row
    directly from disk:
 
    >>> X = np.load('/tmp/123.npy', mmap_mode='r')
    >>> X[1, :]
    memmap([4, 5, 6])
 
    )rsÚlatin1roz.encoding must be 'ASCII', 'latin1', or 'bytes')ÚencodingÚ fix_importsrCFÚrbTsPKsPKr)r[rTrUrNl)ÚmoderNrjz@Cannot load file containing pickled data when allow_pickle=FalsezFailed to interpret file z  as a pickleN)Ú
ValueErrorÚdictÚ
contextlibÚ    ExitStackrEÚ enter_contextrkrrhrrlrCÚseekÚminÚ
startswithÚpop_allrLZ open_memmaprmrr%Ú    ExceptionÚUnpicklingError)rHZ    mmap_moderTrvrurNrUÚstackrZr[Z _ZIP_PREFIXZ _ZIP_SUFFIXÚNrpÚretÚer3r3r4r%sTy   
 
 
þ ÿþ
ÿÿcCs|fSr-r3)rHÚarrrTrvr3r3r4Ú_save_dispatcher¿sr‰c    Cspt|dƒrt |¡}n$t|ƒ}| d¡s0|d}t|dƒ}|(}t |¡}tj    |||t
|ddW5QRXdS)a<
    Save an array to a binary file in NumPy ``.npy`` format.
 
    Parameters
    ----------
    file : file, str, or pathlib.Path
        File or filename to which the data is saved.  If file is a file-object,
        then the filename is unchanged.  If file is a string or Path, a ``.npy``
        extension will be appended to the filename if it does not already
        have one.
    arr : array_like
        Array data to be saved.
    allow_pickle : bool, optional
        Allow saving object arrays using Python pickles. Reasons for disallowing
        pickles include security (loading pickled data can execute arbitrary
        code) and portability (pickled objects may not be loadable on different
        Python installations, for example if the stored objects require libraries
        that are not available, and not all pickled data is compatible between
        Python 2 and Python 3).
        Default: True
    fix_imports : bool, optional
        Only useful in forcing objects in object arrays on Python 3 to be
        pickled in a Python 2 compatible way. If `fix_imports` is True, pickle
        will try to map the new Python 3 names to the old module names used in
        Python 2, so that the pickle data stream is readable with Python 2.
 
    See Also
    --------
    savez : Save several arrays into a ``.npz`` archive
    savetxt, load
 
    Notes
    -----
    For a description of the ``.npy`` format, see :py:mod:`numpy.lib.format`.
 
    Any data saved to the file is appended to the end of the file.
 
    Examples
    --------
    >>> from tempfile import TemporaryFile
    >>> outfile = TemporaryFile()
 
    >>> x = np.arange(10)
    >>> np.save(outfile, x)
 
    >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file
    >>> np.load(outfile)
    array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
 
 
    >>> with open('test.npy', 'wb') as f:
    ...     np.save(f, np.array([1, 2]))
    ...     np.save(f, np.array([1, 3]))
    >>> with open('test.npy', 'rb') as f:
    ...     a = np.load(f)
    ...     b = np.load(f)
    >>> print(a, b)
    # [1 2] [1 3]
    ÚwriterOÚwb)rv©rTrUN) rEr{Ú nullcontextrrVrkÚnpÚ
asanyarrayrÚ write_arrayrz)rHrˆrTrvZfile_ctxrZr3r3r4r&Ãs=
 
 
 
 
ÿcos|EdH| ¡EdHdSr-©Úvalues©rHrIÚkwdsr3r3r4Ú_savez_dispatchers
r•cOst|||dƒdS)aÄ Save several arrays into a single file in uncompressed ``.npz`` format.
 
    Provide arrays as keyword arguments to store them under the
    corresponding name in the output file: ``savez(fn, x=x, y=y)``.
 
    If arrays are specified as positional arguments, i.e., ``savez(fn,
    x, y)``, their names will be `arr_0`, `arr_1`, etc.
 
    Parameters
    ----------
    file : str or file
        Either the filename (string) or an open file (file-like object)
        where the data will be saved. If file is a string or a Path, the
        ``.npz`` extension will be appended to the filename if it is not
        already there.
    args : Arguments, optional
        Arrays to save to the file. Please use keyword arguments (see
        `kwds` below) to assign names to arrays.  Arrays specified as
        args will be named "arr_0", "arr_1", and so on.
    kwds : Keyword arguments, optional
        Arrays to save to the file. Each array will be saved to the
        output file with its corresponding keyword name.
 
    Returns
    -------
    None
 
    See Also
    --------
    save : Save a single array to a binary file in NumPy format.
    savetxt : Save an array to a file as plain text.
    savez_compressed : Save several arrays into a compressed ``.npz`` archive
 
    Notes
    -----
    The ``.npz`` file format is a zipped archive of files named after the
    variables they contain.  The archive is not compressed and each file
    in the archive contains one variable in ``.npy`` format. For a
    description of the ``.npy`` format, see :py:mod:`numpy.lib.format`.
 
    When opening the saved ``.npz`` file with `load` a `NpzFile` object is
    returned. This is a dictionary-like object which can be queried for
    its list of arrays (with the ``.files`` attribute), and for the arrays
    themselves.
 
    Keys passed in `kwds` are used as filenames inside the ZIP archive.
    Therefore, keys should be valid filenames; e.g., avoid keys that begin with
    ``/`` or contain ``.``.
 
    When naming variables with keyword arguments, it is not possible to name a
    variable ``file``, as this would cause the ``file`` argument to be defined
    twice in the call to ``savez``.
 
    Examples
    --------
    >>> from tempfile import TemporaryFile
    >>> outfile = TemporaryFile()
    >>> x = np.arange(10)
    >>> y = np.sin(x)
 
    Using `savez` with \*args, the arrays are saved with default names.
 
    >>> np.savez(outfile, x, y)
    >>> _ = outfile.seek(0) # Only needed here to simulate closing & reopening file
    >>> npzfile = np.load(outfile)
    >>> npzfile.files
    ['arr_0', 'arr_1']
    >>> npzfile['arr_0']
    array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
 
    Using `savez` with \**kwds, the arrays are saved with the keyword names.
 
    >>> outfile = TemporaryFile()
    >>> np.savez(outfile, x=x, y=y)
    >>> _ = outfile.seek(0)
    >>> npzfile = np.load(outfile)
    >>> sorted(npzfile.files)
    ['x', 'y']
    >>> npzfile['x']
    array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
 
    FN©Ú_savezr“r3r3r4r'sTcos|EdH| ¡EdHdSr-r‘r“r3r3r4Ú_savez_compressed_dispatcherjs
r˜cOst|||dƒdS)aì
    Save several arrays into a single file in compressed ``.npz`` format.
 
    Provide arrays as keyword arguments to store them under the
    corresponding name in the output file: ``savez(fn, x=x, y=y)``.
 
    If arrays are specified as positional arguments, i.e., ``savez(fn,
    x, y)``, their names will be `arr_0`, `arr_1`, etc.
 
    Parameters
    ----------
    file : str or file
        Either the filename (string) or an open file (file-like object)
        where the data will be saved. If file is a string or a Path, the
        ``.npz`` extension will be appended to the filename if it is not
        already there.
    args : Arguments, optional
        Arrays to save to the file. Please use keyword arguments (see
        `kwds` below) to assign names to arrays.  Arrays specified as
        args will be named "arr_0", "arr_1", and so on.
    kwds : Keyword arguments, optional
        Arrays to save to the file. Each array will be saved to the
        output file with its corresponding keyword name.
 
    Returns
    -------
    None
 
    See Also
    --------
    numpy.save : Save a single array to a binary file in NumPy format.
    numpy.savetxt : Save an array to a file as plain text.
    numpy.savez : Save several arrays into an uncompressed ``.npz`` file format
    numpy.load : Load the files created by savez_compressed.
 
    Notes
    -----
    The ``.npz`` file format is a zipped archive of files named after the
    variables they contain.  The archive is compressed with
    ``zipfile.ZIP_DEFLATED`` and each file in the archive contains one variable
    in ``.npy`` format. For a description of the ``.npy`` format, see
    :py:mod:`numpy.lib.format`.
 
 
    When opening the saved ``.npz`` file with `load` a `NpzFile` object is
    returned. This is a dictionary-like object which can be queried for
    its list of arrays (with the ``.files`` attribute), and for the arrays
    themselves.
 
    Examples
    --------
    >>> test_array = np.random.rand(3, 2)
    >>> test_vector = np.random.rand(4)
    >>> np.savez_compressed('/tmp/123', a=test_array, b=test_vector)
    >>> loaded = np.load('/tmp/123.npz')
    >>> print(np.array_equal(test_array, loaded['a']))
    True
    >>> print(np.array_equal(test_vector, loaded['b']))
    True
 
    TNr–r“r3r3r4r(os?c
Csèddl}t|dƒs,t|ƒ}| d¡s,|d}|}t|ƒD]0\}}    d|}
|
| ¡kr`td|
ƒ‚|    ||
<q8|rv|j} n|j} t    |d| d} | 
¡D]H\}
}    |
d} t   |    ¡}    | j | dd    d
}tj||    ||d W5QRXq’|  ¡dS) NrrŠz.npzzarr_%dz,Cannot use un-named variables and keyword %sÚw)rxÚ compressionrOT)Ú force_zip64rŒ)rFrErrVÚ    enumerater<ryÚ ZIP_DEFLATEDÚ
ZIP_STOREDrKÚitemsrŽrrkrrr`)rHrIr”ÚcompressrTrUrFZnamedictÚiÚvalr:ršZzipfÚfnamerZr3r3r4r—±s4
 
 ÿ
 
þr—cCs|dkrtd|›ƒ‚dS)zÈJust checks if the param ndmin is supported on
        _ensure_ndmin_ndarray. It is intended to be used as
        verification before running anything expensive.
        e.g. loadtxt, genfromtxt
    )rréz Illegal value of ndmin keyword: N)ry©Úndminr3r3r4Ú!_ensure_ndmin_ndarray_check_paramÖsr§r¥cCsJ|j|krt |¡}|j|krF|dkr2t |¡}n|dkrFt |¡j}|S)aThis is a helper function of loadtxt and genfromtxt to ensure
        proper minimum dimension as requested
 
        ndim : int. Supported values 1, 2, 3
                    ^^ whenever this changes, keep in sync with
                       _ensure_ndmin_ndarray_check_param
    rr¤)ÚndimrŽZsqueezeZ
atleast_1dÚ
atleast_2dÚT)Úar¦r3r3r4Ú_ensure_ndmin_ndarrayàs
 
 
 
  r¬iPÃ)Úlikec  Cs| fSr-r3) r£ÚdtypeÚcommentsÚ    delimiterÚ
convertersÚskiprowsÚusecolsÚunpackr¦ruÚmax_rowsr­r3r3r4Ú_loadtxt_dispatcherûsr¶ÚargumentcCsNzt |¡Wn$tk
r2t|›dƒd‚YnX|dkrJt|›dƒ‚dS)Nz must be an integerrz must be nonnegative)ÚoperatorrÚ    TypeErrorry)ÚvalueÚnamer3r3r4Ú_check_nonneg_ints r¼ccsB|D]8}t|tƒr| |¡}|D]}| |d¡d}q |VqdS)a
    Generator that consumes a line iterated iterable and strips out the
    multiple (or multi-character) comments from lines.
    This is a pre-processing step to achieve feature parity with loadtxt
    (we assume that this feature is a nieche feature).
    rrN)Ú
isinstanceroÚdecodeÚsplit)Úiterabler¯ruÚlineÚcr3r3r4Ú_preprocess_comments s 
 
rÃú,ú#ú"Újro) r°ÚcommentÚquoteÚimaginary_unitr³Ú    skiplinesrµr±r¦r´r®ruc s.d} | dkrd} d} | dkr$tdƒ‚t | ¡} d}| jdkrj| dks\| dks\| d    ks\| d
krj| }t t¡} |dk    ršz t|ƒ}Wntk
r˜|g}YnXt|    ƒ|dkr°d}nŒd |krÀtd ƒ‚t|ƒ}d}t    |ƒd krÞd}n^t    |ƒdkrt
|d t ƒr<t    |d ƒdkr<|d }d}n ||kr<td|›d|›dƒ‚|dk    rX|dk    rXtdƒ‚t    |ƒdkrntdƒ‚t |ƒ|dk    rŠt |ƒnd}t  ¡}d}z„t
|tjƒr´t |¡}t
|t ƒrþtjjj|d| d}| dkrêt|ddƒ} t  |¡}|}d}n| dkrt|ddƒ} t|ƒ}Wn:tk
rX}ztdt|ƒ›dƒ|‚W5d}~XYnX|P|dk    rŠ|r~t|ƒ}d}t||| ƒ}|dkr¸t|||||||||| | || d ‰nô|rÆt|ƒ}d}|dkrØd}g}|d kr`|d kröt}n
tt|ƒ}t|||||||||| | || |d}| | |¡¡d }|d krJ||8}t    |ƒ|krܐq`qÜt    |ƒdkr†t    |dƒd kr†|d=t    |ƒdkrž|d ‰ntj|d d‰W5QRXt ˆ|    d‰ˆj!ròˆj!d d kròt"j#d |›d!t$d"d#|
r&ˆj}|j%dk    r‡fd$d%„|j%DƒSˆj&SnˆSdS)&a¬
    Read a NumPy array from a text file.
 
    Parameters
    ----------
    fname : str or file object
        The filename or the file to be read.
    delimiter : str, optional
        Field delimiter of the fields in line of the file.
        Default is a comma, ','.  If None any sequence of whitespace is
        considered a delimiter.
    comment : str or sequence of str or None, optional
        Character that begins a comment.  All text from the comment
        character to the end of the line is ignored.
        Multiple comments or multiple-character comment strings are supported,
        but may be slower and `quote` must be empty if used.
        Use None to disable all use of comments.
    quote : str or None, optional
        Character that is used to quote string fields. Default is '"'
        (a double quote). Use None to disable quote support.
    imaginary_unit : str, optional
        Character that represent the imaginay unit `sqrt(-1)`.
        Default is 'j'.
    usecols : array_like, optional
        A one-dimensional array of integer column numbers.  These are the
        columns from the file to be included in the array.  If this value
        is not given, all the columns are used.
    skiplines : int, optional
        Number of lines to skip before interpreting the data in the file.
    max_rows : int, optional
        Maximum number of rows of data to read.  Default is to read the
        entire file.
    converters : dict or callable, optional
        A function to parse all columns strings into the desired value, or
        a dictionary mapping column number to a parser function.
        E.g. if column 0 is a date string: ``converters = {0: datestr2num}``.
        Converters can also be used to provide a default value for missing
        data, e.g. ``converters = lambda s: float(s.strip() or 0)`` will
        convert empty fields to 0.
        Default: None
    ndmin : int, optional
        Minimum dimension of the array returned.
        Allowed values are 0, 1 or 2.  Default is 0.
    unpack : bool, optional
        If True, the returned array is transposed, so that arguments may be
        unpacked using ``x, y, z = read(...)``.  When used with a structured
        data-type, arrays are returned for each field.  Default is False.
    dtype : numpy data type
        A NumPy dtype instance, can be a structured dtype to map to the
        columns of the file.
    encoding : str, optional
        Encoding used to decode the inputfile. The special value 'bytes'
        (the default) enables backwards-compatible behavior for `converters`,
        ensuring that inputs to the converter functions are encoded
        bytes objects. The special value 'bytes' has no additional effect if
        ``converters=None``. If encoding is ``'bytes'`` or ``None``, the
        default system encoding is used.
 
    Returns
    -------
    ndarray
        NumPy array.
 
    Examples
    --------
    First we create a file for the example.
 
    >>> s1 = '1.0,2.0,3.0\n4.0,5.0,6.0\n'
    >>> with open('example1.csv', 'w') as f:
    ...     f.write(s1)
    >>> a1 = read_from_filename('example1.csv')
    >>> a1
    array([[1., 2., 3.],
           [4., 5., 6.]])
 
    The second example has columns with different data types, so a
    one-dimensional array with a structured data type is returned.
    The tab character is used as the field delimiter.
 
    >>> s2 = '1.0\t10\talpha\n2.3\t25\tbeta\n4.5\t16\tgamma\n'
    >>> with open('example2.tsv', 'w') as f:
    ...     f.write(s2)
    >>> a2 = read_from_filename('example2.tsv', delimiter='\t')
    >>> a2
    array([(1. , 10, b'alpha'), (2.3, 25, b'beta'), (4.5, 16, b'gamma')],
          dtype=[('f0', '<f8'), ('f1', 'u1'), ('f2', 'S5')])
    FroNTza dtype must be provided.ZSUMZS0ZU0ZM8Zm8ÚzJcomments cannot be an empty string. Use comments=None to disable comments.rrzComment characters 'z ' cannot include the delimiter 'ú'z„when multiple comments or a multi-character comment is given, quotes are not supported.  In this case quotechar must be set to None.zlen(imaginary_unit) must be 1.éÿÿÿÿÚrt©rururtzGfname must be a string, filehandle, list of strings,
or generator. Got ú     instead.) r°rÈrÉrÊr³rËrµr±r®ruÚfilelikeÚbyte_convertersÚS) r°rÈrÉrÊr³rËrµr±r®rurÒrÓÚc_byte_converters)Zaxisr¥z#loadtxt: input contained no data: "rÆé)ÚcategoryÚ
stacklevelcsg|] }ˆ|‘qSr3r3©Ú.0Úfield©rˆr3r4Ú
<listcomp>2sz_read.<locals>.<listcomp>)'r¹rŽr®Úkindr6r;r§ryÚtuplerhr½Ústrr¼r{rÚosÚPathLikeÚfspathÚlibÚ _datasourcerkÚgetattrÚclosingrfÚtyperÃr Ú_loadtxt_chunksizerrWZastypeZ concatenater¬ÚshapeÚwarningsÚwarnÚ UserWarningÚnamesrª)r£r°rÈrÉrÊr³rËrµr±r¦r´r®rurÓZread_dtype_via_object_chunksr¯Zfh_closing_ctxrÒÚfhÚdatar‡rÕÚchunksÚ
chunk_sizeZnext_arrr²Údtr3rÜr4Ú_read!s(\
 
ÿÿÿÿ
  ÿ "
ÿ
 
ÿ
 
 
 
 
 
  ÿþ
 
ú 
 
 
 
ù 
 
 
ý rô)Ú    quotecharr­c Cs°| dk    r(t||||||||||    |
| d St|tƒr<| d¡|dkrJtj}|} | dk    rxt| ttfƒrj| g} dd„| Dƒ} t|tƒrŒ| d¡}t||| |||||||    |
| d }|S)a '
    Load data from a text file.
 
    Parameters
    ----------
    fname : file, str, pathlib.Path, list of str, generator
        File, filename, list, or generator to read.  If the filename
        extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note
        that generators must return bytes or strings. The strings
        in a list or produced by a generator are treated as lines.
    dtype : data-type, optional
        Data-type of the resulting array; default: float.  If this is a
        structured data-type, the resulting array will be 1-dimensional, and
        each row will be interpreted as an element of the array.  In this
        case, the number of columns used must match the number of fields in
        the data-type.
    comments : str or sequence of str or None, optional
        The characters or list of characters used to indicate the start of a
        comment. None implies no comments. For backwards compatibility, byte
        strings will be decoded as 'latin1'. The default is '#'.
    delimiter : str, optional
        The character used to separate the values. For backwards compatibility,
        byte strings will be decoded as 'latin1'. The default is whitespace.
 
        .. versionchanged:: 1.23.0
           Only single character delimiters are supported. Newline characters
           cannot be used as the delimiter.
 
    converters : dict or callable, optional
        Converter functions to customize value parsing. If `converters` is
        callable, the function is applied to all columns, else it must be a
        dict that maps column number to a parser function.
        See examples for further details.
        Default: None.
 
        .. versionchanged:: 1.23.0
           The ability to pass a single callable to be applied to all columns
           was added.
 
    skiprows : int, optional
        Skip the first `skiprows` lines, including comments; default: 0.
    usecols : int or sequence, optional
        Which columns to read, with 0 being the first. For example,
        ``usecols = (1,4,5)`` will extract the 2nd, 5th and 6th columns.
        The default, None, results in all columns being read.
 
        .. versionchanged:: 1.11.0
            When a single column has to be read it is possible to use
            an integer instead of a tuple. E.g ``usecols = 3`` reads the
            fourth column the same way as ``usecols = (3,)`` would.
    unpack : bool, optional
        If True, the returned array is transposed, so that arguments may be
        unpacked using ``x, y, z = loadtxt(...)``.  When used with a
        structured data-type, arrays are returned for each field.
        Default is False.
    ndmin : int, optional
        The returned array will have at least `ndmin` dimensions.
        Otherwise mono-dimensional axes will be squeezed.
        Legal values: 0 (default), 1 or 2.
 
        .. versionadded:: 1.6.0
    encoding : str, optional
        Encoding used to decode the inputfile. Does not apply to input streams.
        The special value 'bytes' enables backward compatibility workarounds
        that ensures you receive byte arrays as results if possible and passes
        'latin1' encoded strings to converters. Override this value to receive
        unicode arrays and pass strings as input to converters.  If set to None
        the system default is used. The default value is 'bytes'.
 
        .. versionadded:: 1.14.0
    max_rows : int, optional
        Read `max_rows` rows of content after `skiprows` lines. The default is
        to read all the rows. Note that empty rows containing no data such as
        empty lines and comment lines are not counted towards `max_rows`,
        while such lines are counted in `skiprows`.
 
        .. versionadded:: 1.16.0
        
        .. versionchanged:: 1.23.0
            Lines containing no data, including comment lines (e.g., lines 
            starting with '#' or as specified via `comments`) are not counted 
            towards `max_rows`.
    quotechar : unicode character or None, optional
        The character used to denote the start and end of a quoted item.
        Occurrences of the delimiter or comment characters are ignored within
        a quoted item. The default value is ``quotechar=None``, which means
        quoting support is disabled.
 
        If two consecutive instances of `quotechar` are found within a quoted
        field, the first is treated as an escape character. See examples.
 
        .. versionadded:: 1.23.0
    ${ARRAY_FUNCTION_LIKE}
 
        .. versionadded:: 1.20.0
 
    Returns
    -------
    out : ndarray
        Data read from the text file.
 
    See Also
    --------
    load, fromstring, fromregex
    genfromtxt : Load data with missing values handled as specified.
    scipy.io.loadmat : reads MATLAB data files
 
    Notes
    -----
    This function aims to be a fast reader for simply formatted files.  The
    `genfromtxt` function provides more sophisticated handling of, e.g.,
    lines with missing values.
 
    Each row in the input text file must have the same number of values to be
    able to read all values. If all rows do not have same number of values, a
    subset of up to n columns (where n is the least number of values present
    in all rows) can be read by specifying the columns via `usecols`.
 
    .. versionadded:: 1.10.0
 
    The strings produced by the Python float.hex method can be used as
    input for floats.
 
    Examples
    --------
    >>> from io import StringIO   # StringIO behaves like a file object
    >>> c = StringIO("0 1\n2 3")
    >>> np.loadtxt(c)
    array([[0., 1.],
           [2., 3.]])
 
    >>> d = StringIO("M 21 72\nF 35 58")
    >>> np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'),
    ...                      'formats': ('S1', 'i4', 'f4')})
    array([(b'M', 21, 72.), (b'F', 35, 58.)],
          dtype=[('gender', 'S1'), ('age', '<i4'), ('weight', '<f4')])
 
    >>> c = StringIO("1,0,2\n3,0,4")
    >>> x, y = np.loadtxt(c, delimiter=',', usecols=(0, 2), unpack=True)
    >>> x
    array([1., 3.])
    >>> y
    array([2., 4.])
 
    The `converters` argument is used to specify functions to preprocess the
    text prior to parsing. `converters` can be a dictionary that maps
    preprocessing functions to each column:
 
    >>> s = StringIO("1.618, 2.296\n3.141, 4.669\n")
    >>> conv = {
    ...     0: lambda x: np.floor(float(x)),  # conversion fn for column 0
    ...     1: lambda x: np.ceil(float(x)),  # conversion fn for column 1
    ... }
    >>> np.loadtxt(s, delimiter=",", converters=conv)
    array([[1., 3.],
           [3., 5.]])
 
    `converters` can be a callable instead of a dictionary, in which case it
    is applied to all columns:
 
    >>> s = StringIO("0xDE 0xAD\n0xC0 0xDE")
    >>> import functools
    >>> conv = functools.partial(int, base=16)
    >>> np.loadtxt(s, converters=conv)
    array([[222., 173.],
           [192., 222.]])
 
    This example shows how `converters` can be used to convert a field
    with a trailing minus sign into a negative number.
 
    >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94')
    >>> def conv(fld):
    ...     return -float(fld[:-1]) if fld.endswith(b'-') else float(fld)
    ...
    >>> np.loadtxt(s, converters=conv)
    array([[ 10.01, -31.25],
           [ 19.22,  64.31],
           [-17.57,  63.94]])
 
    Using a callable as the converter can be particularly useful for handling
    values with different formatting, e.g. floats with underscores:
 
    >>> s = StringIO("1 2.7 100_000")
    >>> np.loadtxt(s, converters=float)
    array([1.e+00, 2.7e+00, 1.e+05])
 
    This idea can be extended to automatically handle values specified in
    many different formats:
 
    >>> def conv(val):
    ...     try:
    ...         return float(val)
    ...     except ValueError:
    ...         return float.fromhex(val)
    >>> s = StringIO("1, 2.5, 3_000, 0b4, 0x1.4000000000000p+2")
    >>> np.loadtxt(s, delimiter=",", converters=conv, encoding=None)
    array([1.0e+00, 2.5e+00, 3.0e+03, 1.8e+02, 5.0e+00])
 
    Note that with the default ``encoding="bytes"``, the inputs to the
    converter function are latin-1 encoded byte strings. To deactivate the
    implicit encoding prior to conversion, use ``encoding=None``
 
    >>> s = StringIO('10.01 31.25-\n19.22 64.31\n17.57- 63.94')
    >>> conv = lambda x: -float(x[:-1]) if x.endswith('-') else float(x)
    >>> np.loadtxt(s, converters=conv, encoding=None)
    array([[ 10.01, -31.25],
           [ 19.22,  64.31],
           [-17.57,  63.94]])
 
    Support for quoted fields is enabled with the `quotechar` parameter.
    Comment and delimiter characters are ignored when they appear within a
    quoted item delineated by `quotechar`:
 
    >>> s = StringIO('"alpha, #42", 10.0\n"beta, #64", 2.0\n')
    >>> dtype = np.dtype([("label", "U12"), ("value", float)])
    >>> np.loadtxt(s, dtype=dtype, delimiter=",", quotechar='"')
    array([('alpha, #42', 10.), ('beta, #64',  2.)],
          dtype=[('label', '<U12'), ('value', '<f8')])
 
    Quoted fields can be separated by multiple whitespace characters:
 
    >>> s = StringIO('"alpha, #42"       10.0\n"beta, #64" 2.0\n')
    >>> dtype = np.dtype([("label", "U12"), ("value", float)])
    >>> np.loadtxt(s, dtype=dtype, delimiter=None, quotechar='"')
    array([('alpha, #42', 10.), ('beta, #64',  2.)],
          dtype=[('label', '<U12'), ('value', '<f8')])
 
    Two consecutive quote characters within a quoted field are treated as a
    single escaped character:
 
    >>> s = StringIO('"Hello, my name is ""Monty""!"')
    >>> np.loadtxt(s, dtype="U", delimiter=",", quotechar='"')
    array('Hello, my name is "Monty"!', dtype='<U26')
 
    Read subset of columns when all rows do not contain equal number of values:
 
    >>> d = StringIO("1 2\n2 4\n3 9 12\n4 16 20")
    >>> np.loadtxt(d, usecols=(0, 1))
    array([[ 1.,  2.],
           [ 2.,  4.],
           [ 3.,  9.],
           [ 4., 16.]])
 
    N) r®r¯r°r±r²r³r´r¦rurµr­rtcSs$g|]}t|tƒr| d¡n|‘qS)rt)r½ror¾)rÚr]r3r3r4rÝGszloadtxt.<locals>.<listcomp>) r®rÈr°r±rËr³r´r¦rurµrÉ)Ú_loadtxt_with_liker½ror¾rŽÚfloat64ràrô)r£r®r¯r°r±r²r³r´r¦rurµrõr­rÈrˆr3r3r4r!9sP|ü
 
ÿ
 
 
ý)Zuse_likec        Cs|fSr-r3)    r£ÚXÚfmtr°ÚnewlineÚheaderÚfooterr¯rur3r3r4Ú_savetxt_dispatcherYsrýú%.18eú Ú
rÌú# c     Cs0t|tƒrt|ƒ}t|ƒ}Gdd„dƒ}    d}
t|tƒr>t|ƒ}t|ƒrnt|dƒ ¡tj    j
j|d|d} d}
n"t |dƒrˆ|    ||p‚dƒ} nt d    ƒ‚zˆt  |¡}|jd
ks²|jd krÂt d |jƒ‚n@|jd krø|jjdkrêt |¡j}d } n t|jjƒ} n
|jd } t |¡} t|ƒttfkrRt|ƒ| kr<tdt|ƒƒ‚t|ƒ tt|ƒ¡}n t|tƒrä| d¡}t d|ƒ}|d kr®| r˜d||fg| }n
|g| }| |¡}n4| rÈ|d | krÈ|‚n| sÞ|| krÞ|‚n|}nt d|fƒ‚t|ƒd
kr"| dd|¡}|  |||¡| r€|D]P}g}|D]}|  |j!¡|  |j"¡q8|t|ƒ|}|  | dd¡¡q,nh|D]b}z|t|ƒ|}Wn<t#k
rØ}zt#dt|jƒ|fƒ|‚W5d}~XYnX|  |¡q„t|ƒd
kr| dd|¡}|  |||¡W5|
r*|  ¡XdS)aÛ
    Save an array to a text file.
 
    Parameters
    ----------
    fname : filename or file handle
        If the filename ends in ``.gz``, the file is automatically saved in
        compressed gzip format.  `loadtxt` understands gzipped files
        transparently.
    X : 1D or 2D array_like
        Data to be saved to a text file.
    fmt : str or sequence of strs, optional
        A single format (%10.5f), a sequence of formats, or a
        multi-format string, e.g. 'Iteration %d -- %10.5f', in which
        case `delimiter` is ignored. For complex `X`, the legal options
        for `fmt` are:
 
        * a single specifier, `fmt='%.4e'`, resulting in numbers formatted
          like `' (%s+%sj)' % (fmt, fmt)`
        * a full string specifying every real and imaginary part, e.g.
          `' %.4e %+.4ej %.4e %+.4ej %.4e %+.4ej'` for 3 columns
        * a list of specifiers, one per column - in this case, the real
          and imaginary part must have separate specifiers,
          e.g. `['%.3e + %.3ej', '(%.15e%+.15ej)']` for 2 columns
    delimiter : str, optional
        String or character separating columns.
    newline : str, optional
        String or character separating lines.
 
        .. versionadded:: 1.5.0
    header : str, optional
        String that will be written at the beginning of the file.
 
        .. versionadded:: 1.7.0
    footer : str, optional
        String that will be written at the end of the file.
 
        .. versionadded:: 1.7.0
    comments : str, optional
        String that will be prepended to the ``header`` and ``footer`` strings,
        to mark them as comments. Default: '# ',  as expected by e.g.
        ``numpy.loadtxt``.
 
        .. versionadded:: 1.7.0
    encoding : {None, str}, optional
        Encoding used to encode the outputfile. Does not apply to output
        streams. If the encoding is something other than 'bytes' or 'latin1'
        you will not be able to load the file in NumPy versions < 1.14. Default
        is 'latin1'.
 
        .. versionadded:: 1.14.0
 
 
    See Also
    --------
    save : Save an array to a binary file in NumPy ``.npy`` format
    savez : Save several arrays into an uncompressed ``.npz`` archive
    savez_compressed : Save several arrays into a compressed ``.npz`` archive
 
    Notes
    -----
    Further explanation of the `fmt` parameter
    (``%[flag]width[.precision]specifier``):
 
    flags:
        ``-`` : left justify
 
        ``+`` : Forces to precede result with + or -.
 
        ``0`` : Left pad the number with zeros instead of space (see width).
 
    width:
        Minimum number of characters to be printed. The value is not truncated
        if it has more characters.
 
    precision:
        - For integer specifiers (eg. ``d,i,o,x``), the minimum number of
          digits.
        - For ``e, E`` and ``f`` specifiers, the number of digits to print
          after the decimal point.
        - For ``g`` and ``G``, the maximum number of significant digits.
        - For ``s``, the maximum number of characters.
 
    specifiers:
        ``c`` : character
 
        ``d`` or ``i`` : signed decimal integer
 
        ``e`` or ``E`` : scientific notation with ``e`` or ``E``.
 
        ``f`` : decimal floating point
 
        ``g,G`` : use the shorter of ``e,E`` or ``f``
 
        ``o`` : signed octal
 
        ``s`` : string of characters
 
        ``u`` : unsigned decimal integer
 
        ``x,X`` : unsigned hexadecimal integer
 
    This explanation of ``fmt`` is not complete, for an exhaustive
    specification see [1]_.
 
    References
    ----------
    .. [1] `Format Specification Mini-Language
           <https://docs.python.org/library/string.html#format-specification-mini-language>`_,
           Python Documentation.
 
    Examples
    --------
    >>> x = y = z = np.arange(0.0,5.0,1.0)
    >>> np.savetxt('test.out', x, delimiter=',')   # X is an array
    >>> np.savetxt('test.out', (x,y,z))   # x,y,z equal sized 1D arrays
    >>> np.savetxt('test.out', x, fmt='%1.4e')   # use exponential notation
 
    c@s@eZdZdZdd„Zdd„Zdd„Zdd    „Zd
d „Zd d „Z    dS)zsavetxt.<locals>.WriteWrapz0Convert to bytes on bytestream inputs.
 
        cSs||_||_|j|_dSr-)rïruÚ first_writeÚdo_write)r1rïrur3r3r4r5ãsz#savetxt.<locals>.WriteWrap.__init__cSs|j ¡dSr-)rïr`r=r3r3r4r`èsz savetxt.<locals>.WriteWrap.closecSs| |¡dSr-)r©r1Úvr3r3r4rŠësz savetxt.<locals>.WriteWrap.writecSs0t|tƒr|j |¡n|j | |j¡¡dSr-)r½rorïrŠÚencoderurr3r3r4Ú write_bytesîs
z&savetxt.<locals>.WriteWrap.write_bytescSs|j t|ƒ¡dSr-)rïrŠrrr3r3r4Ú write_normalôsz'savetxt.<locals>.WriteWrap.write_normalcSsBz| |¡|j|_Wn&tk
r<| |¡|j|_YnXdSr-)rrŠr¹rrr3r3r4r÷s 
 
z&savetxt.<locals>.WriteWrap.first_writeN)
r?r@rArBr5r`rŠrrrr3r3r3r4Ú    WriteWrapßsr    FÚwtrÐTrŠrtz%fname must be a string or file handlerr¤z.Expected 1D or 2D array, got %dD array insteadrNzfmt has wrong shape.  %sú%z'fmt has wrong number of %% formats:  %sz     (%s+%sj)zinvalid fmt: %rrz+-ú-z?Mismatch between array dtype ('%s') and format specifier ('%s'))$r½rorrrrrkr`rŽrärårEryZasarrayr¨r®rîr©rªrhrêZ iscomplexobjrèr;rßr9ràÚjoinÚmapÚcountÚreplacerŠrWÚrealÚimagr¹)r£rørùr°rúrûrür¯rur    Úown_fhrïZncolZ iscomplex_XrZ n_fmt_charsÚerrorÚrowZrow2ÚnumberÚsrr‡r3r3r4r _sŽ|
!
 
 
ÿ
 
 
 
 
 
   þþc    Cs d}t|dƒs0t |¡}tjjj|d|d}d}zÚt|tj    ƒsHt     |¡}|j
dkrZt dƒ‚|  ¡}t|t ƒr€t|tƒr€t|ƒ}nt|tƒrœt|t ƒrœt|ƒ}t|dƒs°t |¡}| |¡}|röt|d    tƒsöt     ||j
d    ¡}tj||d
}||_    ntj||d
}|W¢S|r| ¡XdS) aq
    Construct an array from a text file, using regular expression parsing.
 
    The returned array is always a structured array, and is constructed from
    all matches of the regular expression in the file. Groups in the regular
    expression are converted to fields of the structured array.
 
    Parameters
    ----------
    file : path or file
        Filename or file object to read.
 
        .. versionchanged:: 1.22.0
            Now accepts `os.PathLike` implementations.
    regexp : str or regexp
        Regular expression used to parse the file.
        Groups in the regular expression correspond to fields in the dtype.
    dtype : dtype or list of dtypes
        Dtype for the structured array; must be a structured datatype.
    encoding : str, optional
        Encoding used to decode the inputfile. Does not apply to input streams.
 
        .. versionadded:: 1.14.0
 
    Returns
    -------
    output : ndarray
        The output array, containing the part of the content of `file` that
        was matched by `regexp`. `output` is always a structured array.
 
    Raises
    ------
    TypeError
        When `dtype` is not a valid dtype for a structured array.
 
    See Also
    --------
    fromstring, loadtxt
 
    Notes
    -----
    Dtypes for structured arrays can be specified in several forms, but all
    forms specify at least the data type and field name. For details see
    `basics.rec`.
 
    Examples
    --------
    >>> from io import StringIO
    >>> text = StringIO("1312 foo\n1534  bar\n444   qux")
 
    >>> regexp = r"(\d+)\s+(...)"  # match [digits, whitespace, anything]
    >>> output = np.fromregex(text, regexp,
    ...                       [('num', np.int64), ('key', 'S3')])
    >>> output
    array([(1312, b'foo'), (1534, b'bar'), ( 444, b'qux')],
          dtype=[('num', '<i8'), ('key', 'S3')])
    >>> output['num']
    array([1312, 1534,  444])
 
    FrCrÏrÐTNz$dtype must be a structured datatype.Úmatchr©r®)rErárãrŽrärårkr`r½r®rîr¹rCroràrrÚreÚcompileÚfindallrßÚarray)    rHÚregexpr®rurÚcontentÚseqZnewdtypeÚoutputr3r3r4r)Ws4>
 
 
 
 
 
 
 
)r¦r­cCs|fSr-r3)r£r®r¯r°Ú skip_headerÚ skip_footerr±Úmissing_valuesÚfilling_valuesr³rîÚ excludelistÚ deletecharsÚ replace_spaceÚ    autostripÚcase_sensitiveÚ
defaultfmtr´ÚusemaskÚlooseÚ invalid_raiserµrur¦r­r3r3r4Ú_genfromtxt_dispatcher¿sr/Ú_zf%icSsd|dk    rBt|ˆ||ˆ
|||||    ˆ| | | ||ˆ||||||||dSt|ƒ|dk    rn|r^tdƒ‚|dkrntdƒ‚|r‚ddlm}m}|pˆi}t|tƒs¤tdt    |ƒƒ‚|d    kr¶d}d
}nd }t|t
ƒrÌt |ƒ}t|t ƒröt jjj|d |d }t |¡}n|}t |¡}z t|ƒ}Wn:tk
rJ} ztdt    |ƒ›dƒ| ‚W5d} ~ XYnX|òt||||d}!t| | || d}"zvtˆ
ƒD]‰t|ƒq~d}#|#sètt|ƒ|ƒ}$ˆd
krÜ|dk    rÜ||$krÜd |$ |¡dd…¡}$|!|$ƒ}#q’Wn0tk
rd}$g}#tjd|ddYnXˆd
krL|#d ¡}%|dk    rL|%|krL|#d=|    dk    r°zdd„|     d¡Dƒ}    Wn@t k
r®z t!|    ƒ}    Wntk
r¨|    g}    YnXYnXt"|    pº|#ƒ}&ˆd
krà|"dd„|#Dƒƒ‰d}$n2t#ˆƒr|"dd„ˆ d¡Dƒƒ‰nˆr|"ˆƒ‰ˆdk    r2t$ˆˆˆ| | || d‰ˆdk    rDt!ˆƒ‰|    rt%|    ƒD]>\‰}'t#|'ƒrtˆ &|'¡|    ˆ<n|'dkrR|'t"|#ƒ|    ˆ<qRˆdk    rÔt"ˆƒ|&krԈj'‰t  (‡fdd„|    Dƒ¡‰t!ˆj)ƒ‰n*ˆdk    rt"ˆƒ|&kr‡fdd„|    Dƒ‰nˆdk    rˆdk    rt!ˆj)ƒ‰|p&d}(t|(t*ƒr>|( +d¡}(d d„t|&ƒDƒ}t|(tƒr.|( ,¡D]Æ\})}*t#|)ƒr¢zˆ &|)¡})Wntk
r YqdYnX|    rÎz|     &|)¡})Wntk
rÌYnXt|*t!t-fƒrîd!d„|*Dƒ}*n
t |*ƒg}*|)dkr|D]}+|+ .|*¡qn||) .|*¡qdnŽt|(t!t-fƒrrt/|(|ƒD]&\},}-t |,ƒ},|,|-krH|- 0|,¡qHnJt|(t ƒr |( d¡}.|D]}-|- .|.¡qŒn|D]}-|- .t |(ƒg¡q¤|}/|/dkrÎg}/dg|&}t|/tƒrd|/ ,¡D]t\})}*t#|)ƒr*zˆ &|)¡})Wntk
r(YqìYnX|    rVz|     &|)¡})Wntk
rTYnX|*||)<qìnHt|/t!t-fƒr¢t"|/ƒ}0|0|&kr”|/|d|0…<n |/d|&…}n
|/g|&}ˆdkrÌd"d„t/||ƒDƒ}nRt1ˆd
d#}1t"|1ƒdkrt/|1||ƒ}2d$d„|2Dƒ}nt/||ƒ}2‡fd%d„|2Dƒ}g}3| ,¡D]ö\}4‰t#|4ƒrnzˆ &|4¡}4|4‰Wntk
rjYq*YnXn8|    r¢z|     &|4¡‰Wntk
ržYq*YnXn|4‰t"|$ƒrº|#|4}5nd}5ˆt*krÎt2}6n"|rìd&d'„}7t3j4|7ˆd(}6nˆ}6|ˆj5|6d
|5|ˆ|ˆd)|3 0ˆ|6f¡q*| 5|3¡g‰    ˆ    j0}8|rFg}9|9j0}:g};|;j0}<t%t6 7|$g|¡ƒD]Ü\‰}=|!|=ƒ‰ t"ˆ ƒ}>|>dkrˆqb|    rØz‡ fd*d„|    Dƒ‰ Wn0t8k
rÔ|<ˆˆ
d|>fƒYqbYnXn"|>|&krú|<ˆˆ
d|>fƒqb|8t-ˆ ƒƒ|    r(|:t-d+d„t/ˆ |ƒDƒƒƒt"ˆ    ƒ|krb    q@qbW5QRXˆdk
rt%|ƒD]º\‰}?‡fd,d„ˆ    Dƒ}@z|? 9|@¡WnŽt:k

rd-ˆ}At;t<ˆƒˆ    ƒ}@t%|@ƒD]X\}4},z|? =|,¡Wn>t>tfk

r|Ad.7}A|A|4dˆ
|,f;}At>|Aƒ‚YnX    q´YnX    q\t"|;ƒ}B|Bdk
rÎt"ˆ    ƒ|B|‰d/|&‰ |dk
r|t"‡‡
fd0d„|;Dƒƒ}C|;d|B|C…};||C8}‡ fd1d„|;Dƒ}At"|Aƒ
rÎ|A ?dd2¡d3 |A¡}A|
r¾t|Aƒ‚ntj|At@dd|dk
rúˆ    d| …‰    |
rú|9d| …}9| r t!t/‡    fd4d„t%|ƒDƒŽƒ‰    nt!t/‡    fd5d„t%|ƒDƒŽƒ‰    ˆ    }Dˆdk rêd6d„|Dƒ}Ed7d„t%|EƒDƒ‰ | rڈ  rÚtjd8t jAdd‡ fd9d:„‰z‡fd;d„|DDƒ}DWntBk
 rÂYnXˆ D]‰t jC|Eˆ< qÈ|Edd…}Ft%|EƒD]<\‰}Gt  D|Gt jE¡ rîtF‡fd<d=„|DDƒƒ}H|G|Hf|Fˆ< qîˆdk ržd>d?„t/||EƒDƒ}It"|Iƒdk rj|I\}J|JtG}K}Ln2‡fd@d„t%|FƒDƒ}K| rćfdAd„t%|FƒDƒ}Ln&t!t/ˆ|Fƒƒ}Kt!t/ˆtGgt"|Fƒƒƒ}Lt jH|D|KdB‰|ršt jH|9|LdB}Mn°ˆ rˆj)dk     rˆˆ_)t"|1ƒdk r¢dCdDd=„|1Dƒk rHtIˆƒ r8tJdEƒ‚nt jH|DˆdB‰n"t jH|DdFd„|1DƒdB‰    ˆ     Kˆ¡‰|ršt jH|9t  (dGd„|1Dƒ¡dB}N|ˆƒ}L|N K|L¡}Mnø|rXd
}Og‰t%dHd„|DƒƒD]j\‰}Pˆ|kr|O|Pˆj    kM}Ot  D|Pt jE¡r |PtF‡fdId=„|DDƒƒf}Pˆ 0d|Pf¡nˆ 0dˆf¡ qÂ|OsXt"ˆƒdkrNt  (ˆ¡‰n
t  (|P¡‰t  H|Dˆ¡‰|ršˆj)dk    rˆdJd„ˆj)Dƒ}LntG}Lt jH|9|LdB}Mˆj(j)‰|rüˆrüt/ˆ|ƒD]B\}Q‰‡fdKd„ˆjLDƒ}|D]}R|M|Qˆ|Q|RkO<qؐq¸|rˆ K|¡‰|Mˆ_MtNˆ|dL‰|r`ˆdkr4ˆjOSt"ˆƒdkrNˆˆdS‡fdMd„ˆDƒSˆS)Na…
    Load data from a text file, with missing values handled as specified.
 
    Each line past the first `skip_header` lines is split at the `delimiter`
    character, and characters following the `comments` character are discarded.
 
    Parameters
    ----------
    fname : file, str, pathlib.Path, list of str, generator
        File, filename, list, or generator to read.  If the filename
        extension is ``.gz`` or ``.bz2``, the file is first decompressed. Note
        that generators must return bytes or strings. The strings
        in a list or produced by a generator are treated as lines.
    dtype : dtype, optional
        Data type of the resulting array.
        If None, the dtypes will be determined by the contents of each
        column, individually.
    comments : str, optional
        The character used to indicate the start of a comment.
        All the characters occurring on a line after a comment are discarded.
    delimiter : str, int, or sequence, optional
        The string used to separate values.  By default, any consecutive
        whitespaces act as delimiter.  An integer or sequence of integers
        can also be provided as width(s) of each field.
    skiprows : int, optional
        `skiprows` was removed in numpy 1.10. Please use `skip_header` instead.
    skip_header : int, optional
        The number of lines to skip at the beginning of the file.
    skip_footer : int, optional
        The number of lines to skip at the end of the file.
    converters : variable, optional
        The set of functions that convert the data of a column to a value.
        The converters can also be used to provide a default value
        for missing data: ``converters = {3: lambda s: float(s or 0)}``.
    missing : variable, optional
        `missing` was removed in numpy 1.10. Please use `missing_values`
        instead.
    missing_values : variable, optional
        The set of strings corresponding to missing data.
    filling_values : variable, optional
        The set of values to be used as default when the data are missing.
    usecols : sequence, optional
        Which columns to read, with 0 being the first.  For example,
        ``usecols = (1, 4, 5)`` will extract the 2nd, 5th and 6th columns.
    names : {None, True, str, sequence}, optional
        If `names` is True, the field names are read from the first line after
        the first `skip_header` lines. This line can optionally be preceded
        by a comment delimiter. If `names` is a sequence or a single-string of
        comma-separated names, the names will be used to define the field names
        in a structured dtype. If `names` is None, the names of the dtype
        fields will be used, if any.
    excludelist : sequence, optional
        A list of names to exclude. This list is appended to the default list
        ['return','file','print']. Excluded names are appended with an
        underscore: for example, `file` would become `file_`.
    deletechars : str, optional
        A string combining invalid characters that must be deleted from the
        names.
    defaultfmt : str, optional
        A format used to define default field names, such as "f%i" or "f_%02i".
    autostrip : bool, optional
        Whether to automatically strip white spaces from the variables.
    replace_space : char, optional
        Character(s) used in replacement of white spaces in the variable
        names. By default, use a '_'.
    case_sensitive : {True, False, 'upper', 'lower'}, optional
        If True, field names are case sensitive.
        If False or 'upper', field names are converted to upper case.
        If 'lower', field names are converted to lower case.
    unpack : bool, optional
        If True, the returned array is transposed, so that arguments may be
        unpacked using ``x, y, z = genfromtxt(...)``.  When used with a
        structured data-type, arrays are returned for each field.
        Default is False.
    usemask : bool, optional
        If True, return a masked array.
        If False, return a regular array.
    loose : bool, optional
        If True, do not raise errors for invalid values.
    invalid_raise : bool, optional
        If True, an exception is raised if an inconsistency is detected in the
        number of columns.
        If False, a warning is emitted and the offending lines are skipped.
    max_rows : int,  optional
        The maximum number of rows to read. Must not be used with skip_footer
        at the same time.  If given, the value must be at least 1. Default is
        to read the entire file.
 
        .. versionadded:: 1.10.0
    encoding : str, optional
        Encoding used to decode the inputfile. Does not apply when `fname` is
        a file object.  The special value 'bytes' enables backward compatibility
        workarounds that ensure that you receive byte arrays when possible
        and passes latin1 encoded strings to converters. Override this value to
        receive unicode arrays and pass strings as input to converters.  If set
        to None the system default is used. The default value is 'bytes'.
 
        .. versionadded:: 1.14.0
    ndmin : int, optional
        Same parameter as `loadtxt`
 
        .. versionadded:: 1.23.0
    ${ARRAY_FUNCTION_LIKE}
 
        .. versionadded:: 1.20.0
 
    Returns
    -------
    out : ndarray
        Data read from the text file. If `usemask` is True, this is a
        masked array.
 
    See Also
    --------
    numpy.loadtxt : equivalent function when no data is missing.
 
    Notes
    -----
    * When spaces are used as delimiters, or when no delimiter has been given
      as input, there should not be any missing data between two fields.
    * When the variables are named (either by a flexible dtype or with `names`),
      there must not be any header in the file (else a ValueError
      exception is raised).
    * Individual values are not stripped of spaces by default.
      When using a custom converter, make sure the function does remove spaces.
 
    References
    ----------
    .. [1] NumPy User Guide, section `I/O with NumPy
           <https://docs.scipy.org/doc/numpy/user/basics.io.genfromtxt.html>`_.
 
    Examples
    --------
    >>> from io import StringIO
    >>> import numpy as np
 
    Comma delimited file with mixed dtype
 
    >>> s = StringIO(u"1,1.3,abcde")
    >>> data = np.genfromtxt(s, dtype=[('myint','i8'),('myfloat','f8'),
    ... ('mystring','S5')], delimiter=",")
    >>> data
    array((1, 1.3, b'abcde'),
          dtype=[('myint', '<i8'), ('myfloat', '<f8'), ('mystring', 'S5')])
 
    Using dtype = None
 
    >>> _ = s.seek(0) # needed for StringIO example only
    >>> data = np.genfromtxt(s, dtype=None,
    ... names = ['myint','myfloat','mystring'], delimiter=",")
    >>> data
    array((1, 1.3, b'abcde'),
          dtype=[('myint', '<i8'), ('myfloat', '<f8'), ('mystring', 'S5')])
 
    Specifying dtype and names
 
    >>> _ = s.seek(0)
    >>> data = np.genfromtxt(s, dtype="i8,f8,S5",
    ... names=['myint','myfloat','mystring'], delimiter=",")
    >>> data
    array((1, 1.3, b'abcde'),
          dtype=[('myint', '<i8'), ('myfloat', '<f8'), ('mystring', 'S5')])
 
    An example with fixed-width columns
 
    >>> s = StringIO(u"11.3abcde")
    >>> data = np.genfromtxt(s, dtype=None, names=['intvar','fltvar','strvar'],
    ...     delimiter=[1,3,5])
    >>> data
    array((1, 1.3, b'abcde'),
          dtype=[('intvar', '<i8'), ('fltvar', '<f8'), ('strvar', 'S5')])
 
    An example to show comments
 
    >>> f = StringIO('''
    ... text,# of chars
    ... hello world,11
    ... numpy,5''')
    >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',')
    array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')],
      dtype=[('f0', 'S12'), ('f1', 'S12')])
 
    N)r®r¯r°r"r#r±r$r%r³rîr&r'r(r)r*r+r´r,r-r.rµrur¦r­zPThe keywords 'skip_footer' and 'max_rows' can not be specified at the same time.rz'max_rows' must be at least 1.r)Ú MaskedArrayÚmake_mask_descrzNThe input argument 'converter' should be a valid dictionary (got '%s' instead)roTFrÏrÐz\fname must be a string, a filehandle, a sequence of strings,
or an iterator of strings. Got rÑ)r°r¯r)ru)r&r'r*r(rÌz"genfromtxt: Empty input file: "%s"r¤)rØcSsg|] }| ¡‘qSr3©Ústrip©rÚr0r3r3r4rÝìszgenfromtxt.<locals>.<listcomp>rÄcSsg|]}t| ¡ƒ‘qSr3)ràr4r5r3r3r4rÝöscSsg|] }| ¡‘qSr3r3r5r3r3r4rÝùs)r+rîr&r'r*r(csg|] }ˆ|‘qSr3r3r5)Údescrr3r4rÝscsg|] }ˆ|‘qSr3r3r5)rîr3r4rÝsr3rtcSsg|]}tdgƒ‘qS©rÌ)r;r5r3r3r4rÝ scSsg|] }t|ƒ‘qSr3)ràr5r3r3r4rÝ6scSsg|]\}}td||d‘qS)N)r$Údefault©r©rÚÚmissÚfillr3r3r4rÝxsÿ)Z flatten_basecSs"g|]\}}}t|d||d‘qS©T)Úlockedr$r8r9)rÚrór;r<r3r3r4r݀s
þÿcs g|]\}}tˆd||d‘qSr=r9r:rr3r4r݆s
þÿcSs"t|ƒtkr||ƒS|| d¡ƒS©Nrt)rèror)r]Úconvr3r3r4Ú tobytes_first¥s z!genfromtxt.<locals>.tobytes_first©r@)r>Ú testing_valuer8r$csg|] }ˆ|‘qSr3r3r5r‘r3r4rÝÍscSsg|]\}}| ¡|k‘qSr3r3)rÚrÚmr3r3r4rÝ×sÿcsg|]}tˆƒ|ƒ‘qSr3)r)rÚÚ_m©r¡r3r4rÝàsz0Converter #%i is locked and cannot be upgraded: z"(occurred line #%i for value '%s')z-    Line #%%i (got %%i columns instead of %i)cs g|]}|dˆˆkr|‘qS)rr3r5)Únbrowsr"r3r4rÝõsÿcsg|]\}}ˆ||f‘qSr3r3)rÚr¡Únb)Útemplater3r4rÝþsÿzSome errors were detected !rcs,g|]$\}‰‡fdd„tt|ƒˆƒDƒ‘qS)csg|]}ˆ |¡‘qSr3)Z _loose_call©rÚÚ_rrBr3r4rÝ    sú)genfromtxt.<locals>.<listcomp>.<listcomp>©rr©rÚr¡©ÚrowsrBr4rÝ    sÿcs,g|]$\}‰‡fdd„tt|ƒˆƒDƒ‘qS)csg|]}ˆ |¡‘qSr3)Z _strict_callrJrBr3r4rÝ    srLrMrNrOrBr4rÝ    sÿcSsg|]
}|j‘qSr3©rè©rÚr@r3r3r4rÝ    scSsg|]\}}|tjkr|‘qSr3)rŽZunicode_)rÚr¡rr3r3r4rÝ!    s
ÿz‚Reading unicode strings without specifying the encoding argument is deprecated. Set the encoding, use None for the system default.cs,t|ƒ}ˆD]}|| d¡||<q t|ƒSr?)r;rrß)Zrow_tuprr¡)Ú    strcolidxr3r4Úencode_unicode_cols+    sz'genfromtxt.<locals>.encode_unicode_colscsg|] }ˆ|ƒ‘qSr3r3)rÚÚr)rTr3r4rÝ2    sc3s|]}t|ˆƒVqdSr-©rh©rÚrrFr3r4Ú    <genexpr>=    szgenfromtxt.<locals>.<genexpr>cSsh|]\}}|jr|’qSr3)Z_checked)rÚrÂZc_typer3r3r4Ú    <setcomp>B    sþzgenfromtxt.<locals>.<setcomp>csg|]\}}ˆ||f‘qSr3r3©rÚr¡ró©r+r3r4rÝJ    sÿcsg|]\}}ˆ|tf‘qSr3©ÚboolrZr[r3r4rÝM    sÿrÚOcss|] }|jVqdSr-)Úcharr5r3r3r4rX_    sz4Nested fields involving objects are not supported...cSsg|] }d|f‘qSr7r3r5r3r3r4rÝf    scSsg|] }dtf‘qSr7r\)rÚÚtr3r3r4rÝk    scSsg|]
}|j‘qSr3rQrRr3r3r4rÝu    sc3s|]}t|ˆƒVqdSr-rVrWrFr3r4rXz    scSsg|] }|tf‘qSr3r\r5r3r3r4r݊    scsg|]}|dkrˆ|ƒ‘qSr7r3r5rBr3r4rݒ    sÿr¥csg|] }ˆ|‘qSr3r3rÙ)r!r3r4rݦ    s)PÚ_genfromtxt_with_liker§ryZnumpy.mar1r2r½rzr¹rèrrràrŽrärårkr{rçrrfrrÚrangeÚnextrr r¿Ú StopIterationrërìr4r9r;rhrrrœrr6r®rîror¾rŸrßÚextendrXrWrrÚ    functoolsÚpartialÚupdateÚ    itertoolsÚchainÚ
IndexErrorZ iterupgraderrrÚupgraderÚinsertrZVisibleDeprecationWarningÚUnicodeEncodeErrorÚbytes_Z
issubdtypeÚ    characterÚmaxr]rrÚNotImplementedErrorÚviewr$Z_maskr¬rª)Sr£r®r¯r°r"r#r±r$r%r³rîr&r'r(r)r*r+r´r,r-r.rµrur¦r­r1r2Zuser_convertersrÓrZZfid_ctxZfhdr‡Z
split_lineZvalidate_namesZ first_valuesÚ
first_lineZfvalZnbcolsÚcurrentZuser_missing_valuesr:r¢r;rºÚentryZ
user_valueZuser_filling_valuesÚnZ
dtype_flatZzipitZ    uc_updaterÇrCZ    user_convrAZappend_to_rowsÚmasksZappend_to_masksÚinvalidZappend_to_invalidrÁZnbvaluesÚ    converterZcurrent_columnÚerrmsgZ    nbinvalidZnbinvalid_skippedrðZ column_typesZsized_column_typesZcol_typeZn_charsÚbaseZ uniform_typeZddtypeZmdtypeZ
outputmaskZrowmasksZ ishomogeneousÚttyper»Zmvalr3)r@r+r6r®rTr¡rîrGr!rPr"rSrIr’r4r"Ês0Dõÿ
ÿÿ
 
 
 ÿýÿý  
ÿ
 
 
 
 
 
 
ü
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ÿ  þ
 
þ
 
 
 
 
 ý
 
 
 
ÿÿ
 
 
 
 
ÿ
 
 
 
 ÿÿ ÿÿ
 ü  
þ 
ÿ
ÿ
ÿ
ÿ 
 
    
 
 cKsP| dd¡| dd¡}t|f|Ž}|r@ddlm}| |¡}n | tj¡}|S)aý
    Load ASCII data from a file and return it in a record array.
 
    If ``usemask=False`` a standard `recarray` is returned,
    if ``usemask=True`` a MaskedRecords array is returned.
 
    Parameters
    ----------
    fname, kwargs : For a description of input parameters, see `genfromtxt`.
 
    See Also
    --------
    numpy.genfromtxt : generic function
 
    Notes
    -----
    By default, `dtype` is None, which means that the data-type of the output
    array will be determined from the data.
 
    r®Nr,Fr©Ú MaskedRecords)Ú
setdefaultÚgetr"Únumpy.ma.mrecordsrrsrŽÚrecarray)r£rJr,r!rr3r3r4r#¯    s      cKst| dd¡| dd¡| dd¡| dd¡t|f|Ž}| d    d
¡}|rdd d lm}| |¡}n | tj¡}|S) a8
    Load ASCII data stored in a comma-separated file.
 
    The returned array is a record array (if ``usemask=False``, see
    `recarray`) or a masked record array (if ``usemask=True``,
    see `ma.mrecords.MaskedRecords`).
 
    Parameters
    ----------
    fname, kwargs : For a description of input parameters, see `genfromtxt`.
 
    See Also
    --------
    numpy.genfromtxt : generic function to load ASCII data.
 
    Notes
    -----
    By default, `dtype` is None, which means that the data-type of the output
    array will be determined from the data.
 
    r*ÚlowerrîTr°rÄr®Nr,Frr~)r€r"rr‚rrsrŽrƒ)r£rJr!r,rr3r3r4r$Ï    s         )NFTrs)NN)TT)TN)
NNNNNNNNNN)r·)NNNNNNN)rþrÿrrÌrÌrN)N)NNNNNNNNNNNNNNNNNNNNNN)Wrárrfrirër.r{r¸rrZopindexrÚcollections.abcrr*rŽrÌrrårZ
numpy.corer    Znumpy.core.multiarrayr
r Znumpy.core._multiarray_umathr Znumpy.core.overridesr rZ_iotoolsrrrrrrrrrrrZ numpy.compatrrrrrrÚ__all__rgZarray_function_dispatchr,rKrLrrr%r‰r&r•r'r˜r(r—r§Úintr¬rér¶r¼rÃr÷rôÚfloatr!rörýr r)r/r ÚsortedZdefaultdeletecharsr"rar#r$r3r3r3r4Ú<module>sz     4 ýÿ1ÿÿ8
 J
V
A
%
ýý 
    ý þýÿþþ
ÿ x gúù ùøcÿþ