<pre><codeclass="python language-python hljs">os.chdir(<path>) <spanclass="hljs-comment"># Changes the current working directory.</span>
<pre><codeclass="python language-python hljs">os.chdir(<path>) <spanclass="hljs-comment"># Changes the current working directory.</span>
os.mkdir(<path>, mode=<spanclass="hljs-number">0o777</span>) <spanclass="hljs-comment"># Creates a directory. Permissions are in octal.</span>
os.mkdir(<path>, mode=<spanclass="hljs-number">0o777</span>) <spanclass="hljs-comment"># Creates a directory. Permissions are in octal.</span>
os.makedirs(<path>, mode=<spanclass="hljs-number">0o777</span>) <spanclass="hljs-comment"># Creates all path's dirs. Also: `exist_ok=False`.</span>
os.makedirs(<path>, mode=<spanclass="hljs-number">0o777</span>) <spanclass="hljs-comment"># Creates all path's dirs. Also `exist_ok=False`.</span>
</code></pre>
</code></pre>
<pre><codeclass="python language-python hljs">shutil.copy(from, to) <spanclass="hljs-comment"># Copies the file. 'to' can exist or be a dir.</span>
<pre><codeclass="python language-python hljs">shutil.copy(from, to) <spanclass="hljs-comment"># Copies the file. 'to' can exist or be a dir.</span>
shutil.copytree(from, to) <spanclass="hljs-comment"># Copies the directory. 'to' must not exist.</span>
shutil.copytree(from, to) <spanclass="hljs-comment"># Copies the directory. 'to' must not exist.</span>
2023-02-07 23:21:01,430 CRITICAL:my_module:Running out of disk space.
2023-02-07 23:21:01,430 CRITICAL:my_module:Running out of disk space.
</code></pre></div>
</code></pre></div>
@ -2463,13 +2463,13 @@ rect = pg.Rect(<span class="hljs-number">240</span>, <span class="hljs-number">2
<div><h3id="surface">Surface</h3><p><strong>Object for representing images.</strong></p><pre><codeclass="python language-python hljs"><Surf> = pg.display.set_mode((width, height)) <spanclass="hljs-comment"># Opens new window and returns its surface.</span>
<div><h3id="surface">Surface</h3><p><strong>Object for representing images.</strong></p><pre><codeclass="python language-python hljs"><Surf> = pg.display.set_mode((width, height)) <spanclass="hljs-comment"># Opens new window and returns its surface.</span>
<Surf> = pg.Surface((width, height)) <spanclass="hljs-comment"># New RGB surface. RGBA if `flags=pg.SRCALPHA`.</span>
<Surf> = pg.Surface((width, height)) <spanclass="hljs-comment"># New RGB surface. RGBA if `flags=pg.SRCALPHA`.</span>
<Surf> = pg.image.load(<path/file>) <spanclass="hljs-comment"># Loads the image. Format depends on source.</span>
<Surf> = pg.image.load(<path/file>) <spanclass="hljs-comment"># Loads the image. Format depends on source.</span>
<Surf> = pg.surfarray.make_surface(<np_array>) <spanclass="hljs-comment"># Also `<array> = surfarray.pixels3d(<Surf>)`.</span>
<Surf> = pg.surfarray.make_surface(<np_array>) <spanclass="hljs-comment"># Also `<np_arr> = surfarray.pixels3d(<Surf>)`.</span>
<Surf> = <Surf>.subsurface(<Rect>) <spanclass="hljs-comment"># Returns a subsurface.</span>
<Surf> = <Surf>.subsurface(<Rect>) <spanclass="hljs-comment"># Returns a subsurface.</span>
</code></pre></div>
</code></pre></div>
<pre><codeclass="python language-python hljs"><Surf>.fill(color) <spanclass="hljs-comment"># Tuple, Color('#rrggbb[aa]') or Color(<name>).</span>
<pre><codeclass="python language-python hljs"><Surf>.fill(color) <spanclass="hljs-comment"># Tuple, Color('#rrggbb[aa]') or Color(<name>).</span>
<pre><codeclass="python language-python hljs"><dict> = <DF>.to_dict([<spanclass="hljs-string">'d/l/s/…'</span>]) <spanclass="hljs-comment"># Returns columns as dicts, lists or series.</span>
<pre><codeclass="python language-python hljs"><dict> = <DF>.to_dict([<spanclass="hljs-string">'d/l/s/…'</span>]) <spanclass="hljs-comment"># Returns columns as dicts, lists or series.</span>
<str> = <DF>.to_json/html/csv([<path>]) <spanclass="hljs-comment"># Also to_markdown/latex([<path>]).</span>
<str> = <DF>.to_json/html/csv([<path>]) <spanclass="hljs-comment"># Also to_markdown/latex([<path>]).</span>
<DF>.to_pickle/excel(<path>) <spanclass="hljs-comment"># Run `$ pip3 install openpyxl` for xlsx files.</span>
<DF>.to_pickle/excel(<path>) <spanclass="hljs-comment"># Run `$ pip3 install "pandas[excel]" odfpy`.</span>
<DF>.to_sql(<spanclass="hljs-string">'<table_name>'</span>, <connection>) <spanclass="hljs-comment"># Accepts SQLite3 or SQLAlchemy connection.</span>
<DF>.to_sql(<spanclass="hljs-string">'<table_name>'</span>, <connection>) <spanclass="hljs-comment"># Accepts SQLite3 or SQLAlchemy connection.</span>
</code></pre>
</code></pre>
<div><h3id="groupby">GroupBy</h3><p><strong>Object that groups together rows of a dataframe based on the value of the passed column.</strong></p><pre><codeclass="python language-python hljs"><spanclass="hljs-meta">>>></span>df = pd.DataFrame([[<spanclass="hljs-number">1</span>, <spanclass="hljs-number">2</span>, <spanclass="hljs-number">3</span>], [<spanclass="hljs-number">4</span>, <spanclass="hljs-number">5</span>, <spanclass="hljs-number">6</span>], [<spanclass="hljs-number">7</span>, <spanclass="hljs-number">8</span>, <spanclass="hljs-number">6</span>]], list(<spanclass="hljs-string">'abc'</span>), list(<spanclass="hljs-string">'xyz'</span>))
<div><h3id="groupby">GroupBy</h3><p><strong>Object that groups together rows of a dataframe based on the value of the passed column.</strong></p><pre><codeclass="python language-python hljs"><spanclass="hljs-meta">>>></span>df = pd.DataFrame([[<spanclass="hljs-number">1</span>, <spanclass="hljs-number">2</span>, <spanclass="hljs-number">3</span>], [<spanclass="hljs-number">4</span>, <spanclass="hljs-number">5</span>, <spanclass="hljs-number">6</span>], [<spanclass="hljs-number">7</span>, <spanclass="hljs-number">8</span>, <spanclass="hljs-number">6</span>]], list(<spanclass="hljs-string">'abc'</span>), list(<spanclass="hljs-string">'xyz'</span>))