@@ -635,6 +635,20 @@ class Employee(Person):
635
635
self .staff_num = staff_num
636
636
```
637
637
638
+ ### Sequence
639
+ ``` python
640
+ class < name> :
641
+ def __init__ (self , seq ):
642
+ self .seq = seq
643
+ def __len__ (self ):
644
+ return len (self .seq)
645
+ def __getitem__ (self , i ):
646
+ return self .seq[i]
647
+ def __iter__ (self ):
648
+ for el in self .seq:
649
+ yield el
650
+ ```
651
+
638
652
### Copy
639
653
``` python
640
654
from copy import copy, deepcopy
@@ -1321,7 +1335,7 @@ Table
1321
1335
# $ pip3 install tabulate
1322
1336
from csv import reader
1323
1337
from tabulate import tabulate
1324
- with open (< filename> , newline = ' ' ) as csv_file:
1338
+ with open (< filename> , encoding = ' utf-8 ' , newline = ' ' ) as csv_file:
1325
1339
reader = reader(csv_file, delimiter = ' ;' )
1326
1340
headers = [a.title() for a in next (reader)]
1327
1341
print (tabulate(reader, headers))
@@ -1544,14 +1558,16 @@ import numpy as np
1544
1558
```
1545
1559
1546
1560
``` python
1547
- value = < array> .min([axis])
1548
- index = < array> .argmin([axis])
1561
+ first_column = < array> [:, 0 ] # Or: <array>[..., 0]
1562
+ value = < array> .min([axis])
1563
+ index = < array> .argmin([axis])
1549
1564
```
1550
1565
1551
1566
``` python
1552
- < view> = < array> .reshape(< shape> )
1553
- < view> = np.broadcast_to(< array> , < shape> )
1554
- < array> = < array> [filter_expression]
1567
+ < array> .shape = < shape>
1568
+ < view> = < array> .reshape(< shape> )
1569
+ < view> = np.broadcast_to(< array> , < shape> )
1570
+ < el_or_array> = < array> [filter_expression]
1555
1571
```
1556
1572
1557
1573
### Broadcasting
0 commit comments