@ -620,7 +620,7 @@ from dateutil.tz import tzlocal, gettz
<DTa> = <DT>.astimezone([<tzinfo>]) # Converts DT to the passed or local fixed zone.
<Ta/DTa> = <T/DT>.replace(tzinfo=<tzinfo>) # Changes object's timezone without conversion.
```
* **Timezones returned by gettz(), tzlocal(), and implicit local timezone of naive objects have offsets that vary through time due to DST and historical changes of the zone's base offset.**
* **Timezones returned by tzlocal(), gettz(), and implicit local timezone of naive objects have offsets that vary through time due to DST and historical changes of the zone's base offset.**
* **Standard library's zoneinfo.ZoneInfo() can be used instead of gettz() on Python 3.9 and later. It requires 'tzdata' package on Windows. It doesn't return local tz if arg. is omitted.**
### Encode
@ -2158,7 +2158,7 @@ with <lock>: # Enters the block by calling acq
```
* **Map() and as\_completed() also accept 'timeout'. It causes futures.TimeoutError when next() is called/blocking. Map() times from original call and as_completed() from first call to next(). As\_completed() fails if next() is called too late, even if thread finished on time.**
* **Exceptions that happen inside threads are raised when next() is called on map's iterator or when result() is called on a Future. Its exception() method returns exception or None.**
* **ProcessPoolExecutor provides true parallelism but: everything sent to/from workers must be [pickable](#pickle), queues must be sent using executor's 'initargs' and 'initializer' parameters, and all executors should only be reachable via `'if __name__ == "__main__": ...'`.**
* **ProcessPoolExecutor provides true parallelism but: everything sent to/from workers must be [pickable](#pickle), queues must be sent using executor's 'initargs' and 'initializer' parameters, and executor should only be reachable via `'if __name__ == "__main__": ...'`.**
* **Most operators call the object's special method that is named after them (second object is passed as an argument), while logical operators call their own code that relies on bool().**
* **Comparisons can be chained: `'x < y < z'`is the same as`'(x < y) and (y < z)`'.**
* **Comparisons can be chained: `'x < y < z'`gets converted to`'(x < y) and (y < z)`'.**
<li><strong>Timezones returned by gettz(), tzlocal(), and implicit local timezone of naive objects have offsets that vary through time due to DST and historical changes of the zone's base offset.</strong></li>
<li><strong>Timezones returned by tzlocal(), gettz(), and implicit local timezone of naive objects have offsets that vary through time due to DST and historical changes of the zone's base offset.</strong></li>
<li><strong>Standard library's zoneinfo.ZoneInfo() can be used instead of gettz() on Python 3.9 and later. It requires 'tzdata' package on Windows. It doesn't return local tz if arg. is omitted.</strong></li>
</ul>
<div><h3id="encode">Encode</h3><pre><codeclass="python language-python apache hljs"><D/T/DT> = D/T/DT.fromisoformat(<str>) <spanclass="hljs-comment"># Object from ISO string. Raises ValueError.</span>
<li><strong>Map() and as_completed() also accept 'timeout'. It causes futures.TimeoutError when next() is called/blocking. Map() times from original call and as_completed() from first call to next(). As_completed() fails if next() is called too late, even if thread finished on time.</strong></li>
<li><strong>Exceptions that happen inside threads are raised when next() is called on map's iterator or when result() is called on a Future. Its exception() method returns exception or None.</strong></li>
<li><strong>ProcessPoolExecutor provides true parallelism but: everything sent to/from workers must be <ahref="#pickle">pickable</a>, queues must be sent using executor's 'initargs' and 'initializer' parameters, and all executors should only be reachable via <codeclass="python hljs"><spanclass="hljs-string">'if __name__ == "__main__": ...'</span></code>.</strong></li>
<li><strong>ProcessPoolExecutor provides true parallelism but: everything sent to/from workers must be <ahref="#pickle">pickable</a>, queues must be sent using executor's 'initargs' and 'initializer' parameters, and executor should only be reachable via <codeclass="python hljs"><spanclass="hljs-string">'if __name__ == "__main__": ...'</span></code>.</strong></li>
</ul>
<div><h2id="operator"><ahref="#operator"name="operator">#</a>Operator</h2><p><strong>Module of functions that provide the functionality of operators. Functions are ordered by operator precedence, starting with least binding.</strong></p><pre><codeclass="python language-python hljs"><spanclass="hljs-keyword">import</span> operator <spanclass="hljs-keyword">as</span> op
<bool> = op.not_(<obj>) <spanclass="hljs-comment"># or, and, not (or/and missing)</span>
<li><strong>Most operators call the object's special method that is named after them (second object is passed as an argument), while logical operators call their own code that relies on bool().</strong></li>
<li><strong>Comparisons can be chained: <codeclass="python hljs"><spanclass="hljs-string">'x < y < z'</span></code>is the same as<codeclass="python hljs"><spanclass="hljs-string">'(x < y) and (y < z)</span></code>'.</strong></li>
<li><strong>Comparisons can be chained: <codeclass="python hljs"><spanclass="hljs-string">'x < y < z'</span></code>gets converted to<codeclass="python hljs"><spanclass="hljs-string">'(x < y) and (y < z)</span></code>'.</strong></li>
</ul>
<div><h2id="matchstatement"><ahref="#matchstatement"name="matchstatement">#</a>Match Statement</h2><p><strong>Executes the first block with matching pattern. Added in Python 3.10.</strong></p><pre><codeclass="python language-python hljs"><spanclass="hljs-keyword">match</span><object/expression>:
<DF> = pd.read_pickle/excel(<spanclass="hljs-string">'<path/url>'</span>) <spanclass="hljs-comment"># Use `sheet_name=None` to get all Excel sheets.</span>
<DF> = pd.read_sql(<spanclass="hljs-string">'<table/query>'</span>, <conn.>) <spanclass="hljs-comment"># SQLite3/SQLAlchemy connection (see #SQLite).</span>
'<strong>Objects can be made <a href="#sortable">sortable</a> with <code class="python hljs"><span class="hljs-string">\'order=True\'</span></code> and immutable with <code class="python hljs"><span class="hljs-string">\'frozen=True\'</span></code>.</strong>':'<strong>Objects can be made sortable with <code class="python hljs"><span class="hljs-string">\'order=True\'</span></code> and immutable with <code class="python hljs"><span class="hljs-string">\'frozen=True\'</span></code>.</strong>',
'<strong>For object to be <a href="#hashable">hashable</a>, all attributes must be hashable and \'frozen\' must be True.</strong>':'<strong>For object to be hashable, all attributes must be hashable and \'frozen\' must be True.</strong>',
'<strong>Function field() is needed because <code class="python hljs"><span class="hljs-string">\'<attr_name>: list = []\'</span></code> would make a list that is shared among all instances. Its \'default_factory\' argument can be any <a href="#callable">callable</a>.</strong>':'<strong>Function field() is needed because <code class="python hljs"><span class="hljs-string">\'<attr_name>: list = []\'</span></code> would make a list that is shared among all instances. Its \'default_factory\' argument can be any callable (p. 17).</strong>',
'<strong>Sequence iterators returned by the <a href="#iterator">iter()</a> function, such as list_iterator and set_iterator.</strong>':'<strong>Sequence iterators returned by the iter() function, such as list_iterator and set_iterator (p. 3).</strong>',
'<strong>Sequence iterators returned by the <a href="#iterator">iter()</a> function, such as list_iterator and set_iterator.</strong>':'<strong>Sequence iterators returned by the iter() function, such as list_iterator and set_iterator.</strong>',
'<strong>Objects returned by the <a href="#itertools">itertools</a> module, such as count, repeat and cycle.</strong>':'<strong>Objects returned by the itertools module, such as count, repeat and cycle (p. 3).</strong>',
'<strong>Generators returned by the <a href="#generator">generator functions</a> and <a href="#comprehensions">generator expressions</a>.</strong>':'<strong>Generators returned by the generator functions (p. 4) and generator expressions (p. 11).</strong>',
'<strong>File objects returned by the <a href="#open">open()</a> function, etc.</strong>':'<strong>File objects returned by the open() function (p. 22), etc.</strong>',
xxxxxxxxxx