{"id":394205,"date":"2024-06-29T11:28:14","date_gmt":"2024-06-29T11:28:14","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=394205"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=394205","title":{"rendered":"<span>\u0422\u0440\u044e\u043a\u0438 Pandas \u043e\u0442 RealPython<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/795\/634\/3e1\/7956343e167ec76b01b5b78bf77642ea.jpg\" width=\"780\" height=\"440\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/795\/634\/3e1\/7956343e167ec76b01b5b78bf77642ea.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041a \u0441\u0442\u0430\u0440\u0442\u0443 \u0444\u043b\u0430\u0433\u043c\u0430\u043d\u0441\u043a\u043e\u0433\u043e <a href=\"https:\/\/skillfactory.ru\/dstpro?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_dspr_160821&amp;utm_term=lead\">\u043a\u0443\u0440\u0441\u0430 \u043f\u043e Data Science<\/a> \u0434\u0435\u043b\u0438\u043c\u0441\u044f \u0441\u043e\u043a\u0440\u0430\u0449\u0451\u043d\u043d\u044b\u043c \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c \u0438\u0437 \u0431\u043b\u043e\u0433\u0430 RealPython \u043e \u0442\u0440\u044e\u043a\u0430\u0445 \u0441 Pandas, \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0438 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430\u043c\u0438 \u0438 \u0438\u0445 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u043e\u043c. \u0417\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u0435\u043c\u0430 \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0438 \u043f\u0430\u043c\u044f\u0442\u0438, \u0441\u0436\u0430\u0442\u0438\u0435 \u0444\u0440\u0435\u0439\u043c\u043e\u0432, \u0438\u043d\u0442\u0440\u043e\u0441\u043f\u0435\u043a\u0446\u0438\u044f GroupBy \u0447\u0435\u0440\u0435\u0437 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044e \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0442\u0435\u043c\u044b. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438, \u043a\u0430\u043a \u0432\u0441\u0435\u0433\u0434\u0430, \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c.<\/p>\n<hr\/>\n<h2>1. \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u00a0\u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430<\/h2>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u044b\u00a0\u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0438\u0441\u044c \u0441\u00a0\u0431\u043e\u0433\u0430\u0442\u044b\u043c\u0438 <a href=\"https:\/\/pandas.pydata.org\/pandas-docs\/stable\/options.html\">\u043e\u043f\u0446\u0438\u044f\u043c\u0438 \u0438\u00a0\u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438<\/a> \u0441\u0438\u0441\u0442\u0435\u043c\u044b Pandas. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 Pandas \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043d\u0438\u0436\u0430\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u00a0\u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435\u00a0\u0432\u00a0\u0441\u0440\u0435\u0434\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432. \u041c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f\u00a0<code>pd.set_option()<\/code> \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u043e\u00a0\u0441\u0432\u043e\u0435\u043c\u0443 \u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044e \u0441\u00a0\u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/skillfactory.ru\/python-fullstack-web-developer?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_fpw_160821&amp;utm_term=main\">Python<\/a> \u0438\u043b\u0438 \u0432 \u0444\u0430\u0439\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 <a href=\"https:\/\/ipython.readthedocs.io\/en\/stable\/interactive\/tutorial.html#startup-files\">IPython<\/a>. \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0442\u043e\u0447\u0435\u0447\u043d\u0443\u044e \u043d\u043e\u0442\u0430\u0446\u0438\u044e: <code>pd.set_option ('display.max_colwidth', 25)<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0433\u043e <a href=\"https:\/\/realpython.com\/python-dicts\/\">\u0441\u043b\u043e\u0432\u0430\u0440\u044f<\/a> \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">import pandas as pd  def start():     options = {         'display': {             'max_columns': None,             'max_colwidth': 25,             'expand_frame_repr': False,  # Don't wrap to multiple pages             'max_rows': 14,             'max_seq_items': 50,         # Max length of printed sequence             'precision': 4,             'show_dimensions': False         },         'mode': {             'chained_assignment': None   # Controls SettingWithCopyWarning         }     }      for category, option in options.items():         for op, value in option.items():             pd.set_option(f'{category}.{op}', value)  # Python 3.6+  if __name__ == '__main__':     start()     del start  # Clean up namespace in the interpreter<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0432 \u0441\u0435\u0430\u043d\u0441 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430, \u0432\u044b\u00a0\u0443\u0432\u0438\u0434\u0438\u0442\u0435, \u0447\u0442\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u0438\u00a0Pandas \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441 \u0432\u0430\u0448\u0438\u043c \u043d\u0430\u0431\u043e\u0440\u043e\u043c\u00a0\u043e\u043f\u0446\u0438\u0439:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">>>> pd.__name__ 'pandas' >>> pd.get_option('display.max_rows') 14<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u043c\u0438\u00a0<a href=\"https:\/\/en.wikipedia.org\/wiki\/Abalone\">abalone<\/a> \u0432\u00a0\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f UCI, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u00a0\u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0435 \u0432\u00a0\u0444\u0430\u0439\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435. \u0421\u043e\u043a\u0440\u0430\u0442\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043e\u00a014 \u0441\u0442\u0440\u043e\u043a \u0441\u00a0\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u0434\u043e\u00a04 \u0446\u0438\u0444\u0440 \u0434\u043b\u044f \u0447\u0438\u0441\u0435\u043b \u0441 \u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0435\u0439 \u0442\u043e\u0447\u043a\u043e\u0439:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">url = ('https:\/\/archive.ics.uci.edu\/ml\/' ...        'machine-learning-databases\/abalone\/abalone.data') >>> cols = ['sex', 'length', 'diam', 'height', 'weight', 'rings'] >>> abalone = pd.read_csv(url, usecols=[0, 1, 2, 3, 4, 8], names=cols)  >>> abalone      sex  length   diam  height  weight  rings 0      M   0.455  0.365   0.095  0.5140     15 1      M   0.350  0.265   0.090  0.2255      7 2      F   0.530  0.420   0.135  0.6770      9 3      M   0.440  0.365   0.125  0.5160     10 4      I   0.330  0.255   0.080  0.2050      7 5      I   0.425  0.300   0.095  0.3515      8 6      F   0.530  0.415   0.150  0.7775     20 # ... 4170   M   0.550  0.430   0.130  0.8395     10 4171   M   0.560  0.430   0.155  0.8675      8 4172   F   0.565  0.450   0.165  0.8870     11 4173   M   0.590  0.440   0.135  0.9660     10 4174   M   0.600  0.475   0.205  1.1760      9 4175   F   0.625  0.485   0.150  1.0945     10 4176   M   0.710  0.555   0.195  1.9485     12<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u041f\u043e\u0437\u0436\u0435 \u0432\u044b\u00a0\u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u044d\u0442\u043e\u0442 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u00a0\u0432\u00a0\u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445.<\/p>\n<h3>2. \u0418\u0433\u0440\u0443\u0448\u0435\u0447\u043d\u044b\u0435 c\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u043e\u0434\u0443\u043b\u044f\u00a0\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f Pandas<\/h3>\n<blockquote>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c <code>pandas.util.testing<\/code> \u0431\u044b\u043b <a href=\"https:\/\/pandas.pydata.org\/docs\/whatsnew\/v1.0.0.html#deprecations\">\u0443\u0434\u0430\u043b\u0451\u043d \u0432\u00a0Pandas 1.0<\/a>. \u041f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 API \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0437\u00a0<code>pandas.testing<\/code> \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d <code>assert_extension_array_equal()<\/code>, <code>assert_frame_equal()<\/code>, <code>assert_series_equal()<\/code> \u0438\u00a0<code>assert_index_equal()<\/code>. \u0410\u0432\u0442\u043e\u0440 \u043f\u0440\u0438\u0437\u043d\u0430\u0451\u0442, \u0447\u0442\u043e \u0443\u0437\u043d\u0430\u043b \u0432\u043a\u0443\u0441 \u0441\u0432\u043e\u0435\u0433\u043e \u043b\u0435\u043a\u0430\u0440\u0441\u0442\u0432\u0430 \u0437\u0430\u00a0\u0442\u043e, \u0447\u0442\u043e \u043f\u043e\u043b\u0430\u0433\u0430\u043b\u0441\u044f \u043d\u0430\u00a0\u043d\u0435\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Pandas.<\/p>\n<\/blockquote>\n<p>\u0412\u00a0\u043c\u043e\u0434\u0443\u043b\u0435 Pandas <code>testing<\/code> \u0441\u043a\u0440\u044b\u0442 \u0440\u044f\u0434 \u0443\u0434\u043e\u0431\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0434\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043a\u0432\u0430\u0437\u0438\u0440\u0435\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u044b\u0445 Series \u0438\u00a0\u0444\u0440\u0435\u0439\u043c\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">>>> import pandas.util.testing as tm >>> tm.N, tm.K = 15, 3  # Module-level default rows\/columns  >>> import numpy as np >>> np.random.seed(444)  >>> tm.makeTimeDataFrame(freq='M').head()                  A       B       C 2000-01-31  0.3574 -0.8804  0.2669 2000-02-29  0.3775  0.1526 -0.4803 2000-03-31  1.3823  0.2503  0.3008 2000-04-30  1.1755  0.0785 -0.1791 2000-05-31 -0.9393 -0.9039  1.1837  >>> tm.makeDataFrame().head()                  A       B       C nTLGGTiRHF -0.6228  0.6459  0.1251 WPBRn9jtsR -0.3187 -0.8091  1.1501 7B3wWfvuDA -1.9872 -1.0795  0.2987 yJ0BTjehH1  0.8802  0.7403 -1.2154 0luaYUYvy1 -0.9320  1.2912 -0.2907<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0418\u0445\u00a0\u043e\u043a\u043e\u043b\u043e 30, \u043f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u0432\u044b\u0437\u0432\u0430\u0432\u00a0<code>dir()<\/code> \u043d\u0430\u00a0\u043e\u0431\u044a\u0435\u043a\u0442\u0435 \u043c\u043e\u0434\u0443\u043b\u044f. \u0412\u043e\u0442\u00a0\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">>>> [i for i in dir(tm) if i.startswith('make')] ['makeBoolIndex',  'makeCategoricalIndex',  'makeCustomDataframe',  'makeCustomIndex',  # ...,  'makeTimeSeries',  'makeTimedeltaIndex',  'makeUIntIndex',  'makeUnicodeIndex']<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u041e\u043d\u0438\u00a0\u043f\u043e\u043b\u0435\u0437\u043d\u044b \u0434\u043b\u044f \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0438\u043d\u0433\u0430, \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0439 \u0438\u00a0\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u0441 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e \u0437\u043d\u0430\u043a\u043e\u043c\u044b\u043c\u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 Pandas.<\/p>\n<h3>3. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0430<\/h3>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u044b\u00a0\u0441\u043b\u044b\u0448\u0430\u043b\u0438 \u043e\u00a0\u0442\u0435\u0440\u043c\u0438\u043d\u0435 <strong>\u0430\u043ac\u0435\u0441\u0441\u043e\u0440<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439\u00a0\u0447\u0435\u043c-\u0442\u043e \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442 \u0433\u0435\u0442\u0442\u0435\u0440 (\u0445\u043e\u0442\u044f \u0433\u0435\u0442\u0442\u0435\u0440\u044b \u0438\u00a0\u0441\u0435\u0442\u0442\u0435\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0432\u00a0Python \u043d\u0435\u0447\u0430\u0441\u0442\u043e). \u0412 \u043d\u0430\u0448\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0435\u043c \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0430\u043a\u0441\u0435\u0441\u0441\u043e\u0440\u043e\u043c\u00a0\u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u043b\u0443\u0436\u0438\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c \u0434\u043b\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432. \u0412 Series [\u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438] \u0438\u0445\u00a0\u0442\u0440\u0438, \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u0438\u0445 4:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">>>> pd.Series._accessors {'cat', 'dt', 'sparse', 'str'}<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0414\u0430, \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u0435 \u0432\u044b\u0448\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043c\u043d\u043e\u0433\u043e\u0437\u043d\u0430\u0447\u043d\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043e \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u00a0\u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u044b.<\/p>\n<ul>\n<li>\n<p><code>.cat<\/code>\u00a0\u2014 \u0434\u043b\u044f \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445; <\/p>\n<\/li>\n<li>\n<p><code>.str<\/code>\u00a0\u2014 \u0434\u043b\u044f \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0445 (\u043e\u0431\u044a\u0435\u043a\u0442\u043d\u044b\u0445) \u0434\u0430\u043d\u043d\u044b\u0445; <\/p>\n<\/li>\n<li>\n<p><code>.dt<\/code>\u00a0\u2014 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0432\u0440\u0435\u043c\u0435\u043d\u0438. <\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0430\u0447\u043d\u0451\u043c \u0441\u00a0<code>.str<\/code>: \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435, \u0447\u0442\u043e \u0443\u00a0\u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043d\u0435\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u00a0\u0433\u043e\u0440\u043e\u0434\u0435\/\u043e\u0431\u043b\u0430\u0441\u0442\u0438\/\u0438\u043d\u0434\u0435\u043a\u0441\u0435 \u0432\u00a0\u0432\u0438\u0434\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044f \u0432\u00a0Series Pandas. \u0421\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b Pandas <a href=\"https:\/\/realpython.com\/numpy-array-programming\/#what-is-vectorization\">\u0432\u0435\u043a\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u044b<\/a>, \u0442\u043e \u0435\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441\u043e\u00a0\u0432\u0441\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c \u0431\u0435\u0437 \u044f\u0432\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 for:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">>>> addr = pd.Series([ ...     'Washington, D.C. 20003', ...     'Brooklyn, NY 11211-1755', ...     'Omaha, NE 68154', ...     'Pittsburgh, PA 15211' ... ])  >>> addr.str.upper() 0     WASHINGTON, D.C. 20003 1    BROOKLYN, NY 11211-1755 2            OMAHA, NE 68154 3       PITTSBURGH, PA 15211 dtype: object  >>> addr.str.count(r'\\d')  # 5 or 9-digit zip? 0    5 1    9 2    5 3    5 dtype: int64<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0441\u043b\u043e\u0436\u043d\u0435\u0435\u00a0\u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u0432\u044b\u00a0\u0445\u043e\u0442\u0438\u0442\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0442\u0440\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 city\/state\/ZIP \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e \u043d\u0430\u00a0\u043f\u043e\u043b\u044f \u0444\u0440\u0435\u0439\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. \u0412\u044b\u00a0\u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432\u00a0<code>.str.extract()<\/code>, \u0447\u0442\u043e\u0431\u044b \u00ab\u0438\u0437\u0432\u043b\u0435\u0447\u044c\u00bb \u0447\u0430\u0441\u0442\u0438 \u043a\u0430\u0436\u0434\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0438 \u0432 Series. \u0412\u00a0<code>.str.extract()<\/code>, <code>.str<\/code>\u00a0\u2014 \u044d\u0442\u043e \u0430\u043a\u0441\u0435\u0441\u0441\u043e\u0440, \u0430\u00a0<code>.str.extract()<\/code>\u00a0\u2014 \u043c\u0435\u0442\u043e\u0434 \u0430\u043a\u0441\u0435\u0441\u0441\u043e\u0440\u0430:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>>>> regex = (r'(?P&lt;city>[A-Za-z ]+), '      # One or more letters ...          r'(?P&lt;state>[A-Z]{2}) '        # 2 capital letters ...          r'(?P&lt;zip>\\d{5}(?:-\\d{4})?)')  # Optional 4-digit extension ... >>> addr.str.replace('.', '').str.extract(regex)          city state         zip 0  Washington    DC       20003 1    Brooklyn    NY  11211-1755 2       Omaha    NE       68154 3  Pittsburgh    PA       15211<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u041a\u043e\u0434 \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442\u00a0\u0446\u0435\u043f\u043e\u0447\u043a\u0443 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0433\u0434\u0435 <code>.str.extract (regex)<\/code> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u00a0\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 <code>addr.str.replace ('.', '')<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0447\u0438\u0449\u0430\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u043e\u0447\u0435\u043a, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u0440\u0430\u0441\u0438\u0432\u0443\u044e \u0434\u0432\u0443\u0445\u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u0443\u044e \u0430\u0431\u0431\u0440\u0435\u0432\u0438\u0430\u0442\u0443\u0440\u0443 \u0448\u0442\u0430\u0442\u0430. \u041f\u043e\u043b\u0435\u0437\u043d\u043e\u00a0\u043d\u0435\u043c\u043d\u043e\u0433\u043e\u00a0\u0437\u043d\u0430\u0442\u044c \u043e\u00a0\u0442\u043e\u043c, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u044d\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u044b-\u0430\u043a\u0441\u0435\u0441\u0441\u043e\u0440\u044b, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u043f\u043e\u0447\u0435\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0445, \u0430\u00a0\u043d\u0435\u00a0\u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435 <code>addr.apply (re.findall, \u2026)<\/code>. \u041a\u0430\u0436\u0434\u044b\u0439 \u0430\u043a\u0441\u0435\u0441\u0441\u043e\u0440\u00a0\u2014 \u044d\u0442\u043e \u043a\u043b\u0430\u0441\u0441 Python:<\/p>\n<ul>\n<li>\n<p><code>.str<\/code> \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u00a0<code>StringMethods<\/code>. <\/p>\n<\/li>\n<li>\n<p><code>.dt<\/code> \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u00a0<code>CombinedDatetimelikeProperties<\/code>. <\/p>\n<\/li>\n<li>\n<p><code>.cat<\/code> \u2014 \u043d\u0430 <code>CategoricalAccessor<\/code>.<\/p>\n<\/li>\n<\/ul>\n<p>\u042d\u0442\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u0437\u0430\u0442\u0435\u043c \u00ab\u043f\u0440\u0438\u043a\u0440\u0435\u043f\u043b\u044f\u044e\u0442\u0441\u044f\u00bb \u043a\u00a0Series \u0441\u00a0\u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>CachedAccessor<\/code>. \u0418\u043c\u0435\u043d\u043d\u043e \u043a\u043e\u0433\u0434\u0430 \u043a\u043b\u0430\u0441\u0441\u044b \u043e\u0431\u0451\u0440\u043d\u0443\u0442\u044b \u0432\u00a0<code>CachedAccessor<\/code>, \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043c\u0430\u0433\u0438\u044f. <\/p>\n<p><code>CachedAccessor<\/code> \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u043b\u0451\u043d \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0435\u0439 \u00ab\u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u00bb: \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430, \u0430\u00a0\u0437\u0430\u0442\u0435\u043c \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u044b\u0447\u043d\u044b\u043c \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c. \u042d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0443\u0442\u0451\u043c \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 <code>.__get__()<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 <a href=\"https:\/\/realpython.com\/python-descriptors\/\">\u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u0430<\/a> Python.<\/p>\n<blockquote>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b\u00a0\u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u00a0\u0440\u0430\u0431\u043e\u0442\u0435 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u043e\u0432, \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435<a href=\"https:\/\/docs.python.org\/howto\/descriptor.html\"> Descriptor HOWTO<\/a> \u0438\u00a0<a href=\"https:\/\/www.pydanny.com\/cached-property.html\">\u044d\u0442\u043e\u0442 \u043f\u043e\u0441\u0442<\/a> \u043e\u00a0\u0434\u0438\u0437\u0430\u0439\u043d\u0435 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432. \u0412\u00a0Python 3 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f <code>functools.lru_cache()<\/code>, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e\u0449\u0438\u0439 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u041f\u0430\u0442\u0442\u0435\u0440\u043d\u00a0\u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u0432\u0441\u044e\u0434\u0443, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440\u00a0\u0432\u00a0\u043f\u0430\u043a\u0435\u0442\u0435 <code>aiohttp<\/code>.<\/p>\n<\/blockquote>\n<p> \u0412\u0442\u043e\u0440\u043e\u0439 \u0430\u043a\u0441\u0435\u0441\u0441\u043e\u0440, <code>.dt<\/code>, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u043d\u00a0\u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u043a\u00a0<code>DatetimeIndex<\/code> Pandas, \u0438\u00a0\u0435\u0441\u043b\u0438 \u0435\u0433\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0434\u043b\u044f Series, \u0442\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u043d \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u00a0<code>DatetimeIndex<\/code>: <\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">>>> daterng = pd.Series(pd.date_range('2017', periods=9, freq='Q')) >>> daterng 0   2017-03-31 1   2017-06-30 2   2017-09-30 3   2017-12-31 4   2018-03-31 5   2018-06-30 6   2018-09-30 7   2018-12-31 8   2019-03-31 dtype: datetime64[ns]  >>>  daterng.dt.day_name() 0      Friday 1      Friday 2    Saturday 3      Sunday 4    Saturday 5    Saturday 6      Sunday 7      Monday 8      Sunday dtype: object  >>> # Second-half of year only >>> daterng[daterng.dt.quarter > 2] 2   2017-09-30 3   2017-12-31 6   2018-09-30 7   2018-12-31 dtype: datetime64[ns]  >>> daterng[daterng.dt.is_year_end] 3   2017-12-31 7   2018-12-31 dtype: datetime64[ns]<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0422\u0440\u0435\u0442\u0438\u0439 \u0430\u043a\u0441\u0435\u0441\u0441\u043e\u0440, <code>.cat<\/code>, \u2014 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u00a0\u0432\u0441\u043a\u043e\u0440\u0435 \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435.<\/p>\n<h3>4. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0434\u0430\u0442\u044b \u0438\u0437\u00a0\u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e\u00a0\u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043a\u0430\u043a \u0432\u00a0<code>daterng<\/code>, \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c Pandas <code>DatetimeIndex<\/code> \u0438\u0437\u00a0\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043d\u044b\u0445 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432,\u00a0\u0432\u043c\u0435\u0441\u0442\u0435 \u044d\u0442\u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u044b \u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442 \u0434\u0430\u0442\u0443 \u0438\u043b\u0438 \u0432\u0440\u0435\u043c\u044f:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">>>> from itertools import product >>> datecols = ['year', 'month', 'day']  >>> df = pd.DataFrame(list(product([2017, 2016], [1, 2], [1, 2, 3])), ...                   columns=datecols) >>> df['data'] = np.random.randn(len(df)) >>> df     year  month  day    data 0   2017      1    1 -0.0767 1   2017      1    2 -1.2798 2   2017      1    3  0.4032 3   2017      2    1  1.2377 4   2017      2    2 -0.2060 5   2017      2    3  0.6187 6   2016      1    1  2.3786 7   2016      1    2 -0.4730 8   2016      1    3 -2.1505 9   2016      2    1 -0.6340 10  2016      2    2  0.7964 11  2016      2    3  0.0005  >>> df.index = pd.to_datetime(df[datecols]) >>> df.head()             year  month  day    data 2017-01-01  2017      1    1 -0.0767 2017-01-02  2017      1    2 -1.2798 2017-01-03  2017      1    3  0.4032 2017-02-01  2017      2    1  1.2377 2017-02-02  2017      2    2 -0.2060<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0432\u044b\u00a0\u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043e\u0442\u00a0\u0441\u0442\u0430\u0440\u044b\u0445 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u0438\u00a0\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0445\u00a0\u0432\u00a0Series:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">>>> df = df.drop(datecols, axis=1).squeeze() >>> df.head() 2017-01-01   -0.0767 2017-01-02   -1.2798 2017-01-03    0.4032 2017-02-01    1.2377 2017-02-02   -0.2060 Name: data, dtype: float64  >>> df.index.dtype_str 'datetime64[ns]<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0418\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e \u0441\u0443\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0444\u0440\u0435\u0439\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e DataFrame \u043f\u043e\u0445\u043e\u0436 \u043d\u0430\u00a0\u0441\u043b\u043e\u0432\u0430\u0440\u044c Python, \u0433\u0434\u0435 \u0438\u043c\u0435\u043d\u0430 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u2014 \u044d\u0442\u043e \u043a\u043b\u044e\u0447\u0438, \u0430\u00a0\u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0442\u043e\u043b\u0431\u0446\u044b (Series)\u00a0\u2014 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u043b\u043e\u0432\u0430\u0440\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 <code>pd.to_datetime (df[datecols].to_dict (orient='list'))<\/code> \u0437\u0434\u0435\u0441\u044c\u00a0\u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. <\/p>\n<p>\u042d\u0442\u043e \u2014 \u0437\u0435\u0440\u043a\u0430\u043b\u043e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 <code>datetime.datetime<\/code> \u0432\u00a0Python, \u0433\u0434\u0435 \u0432\u044b\u00a0\u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0441\u00a0\u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <code>datetime.datetime(year=2000, month=1, day=15, hour=10)<\/code>.<\/p>\n<h3>5. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438\u00a0\u043c\u0435\u0441\u0442\u0430<\/h3>\n<p>\u041e\u0434\u043d\u0430 \u0438\u0437\u00a0\u043c\u043e\u0449\u043d\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 Pandas \u2014 \u0435\u0451 \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0438\u043f\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 (<a href=\"https:\/\/numpy.org\/doc\/stable\/reference\/arrays.dtypes.html\">dtype<\/a>) <code>Categorical<\/code>. \u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432\u044b\u00a0\u043d\u0435\u00a0\u0432\u0441\u0435\u0433\u0434\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u0435 \u0441\u00a0\u0433\u0438\u0433\u0430\u0431\u0430\u0439\u0442\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u00a0\u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438, \u0432\u044b\u00a0\u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0438\u0441\u044c \u0441\u043e\u00a0\u0441\u043b\u0443\u0447\u0430\u044f\u043c\u0438, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0430\u0434 \u0431\u043e\u043b\u044c\u0448\u0438\u043c DataFrame \u0437\u0430\u0432\u0438\u0441\u0430\u044e\u0442 \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u043c \u043d\u0430\u00a0\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u043a\u0443\u043d\u0434. <\/p>\n<p>dtype Pandas <code>object<\/code>\u00a0 \u2014\u00a0\u0447\u0430\u0441\u0442\u043e\u00a0\u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u00a0\u0434\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u00a0\u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. (<code>object<\/code>\u00a0\u2014 \u044d\u0442\u043e \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0434\u043b\u044f <code>str<\/code>, \u0440\u0430\u0437\u043d\u043e\u0440\u043e\u0434\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043b\u0438 \u00ab\u0434\u0440\u0443\u0433\u0438\u0445\u00bb \u0442\u0438\u043f\u043e\u0432.) \u0421\u0442\u0440\u043e\u043a\u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043c\u0435\u0441\u0442\u043e \u0432\u00a0\u043f\u0430\u043c\u044f\u0442\u0438:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">>>> colors = pd.Series([ ...     'periwinkle', ...     'mint green', ...     'burnt orange', ...     'periwinkle', ...     'burnt orange', ...     'rose', ...     'rose', ...     'mint green', ...     'rose', ...     'navy' ... ]) ... >>> import sys >>> colors.apply(sys.getsizeof) 0    59 1    59 2    61 3    59 4    61 5    53 6    53 7    59 8    53 9    53 dtype: int64<\/code><\/pre>\n<\/div>\n<\/details>\n<blockquote>\n<p>\u042f\u00a0\u0432\u044b\u0437\u0432\u0430\u043b <code>sys.getsizeof()<\/code>, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u044c, \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u043c\u0443\u044e \u043a\u0430\u0436\u0434\u044b\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0432\u00a0Series. \u041f\u043e\u043c\u043d\u0438\u0442\u0435, \u0447\u0442\u043e \u044d\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u044b Python, \u0443 \u043d\u0438\u0445 \u0435\u0441\u0442\u044c \u0438\u0437\u0434\u0435\u0440\u0436\u043a\u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432. (<code>sys.getsizeof ('')<\/code> \u0432\u0435\u0440\u043d\u0451\u0442 49 \u0431\u0430\u0439\u0442). \u0415\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <code>colors.memory_usage()<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0443\u043c\u043c\u0438\u0440\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438\u00a0\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u00a0\u0430\u0442\u0440\u0438\u0431\u0443\u0442 <code>.nbytes<\/code> \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 NumPy. \u041d\u0435\u00a0\u0443\u0432\u044f\u0437\u043d\u0438\u0442\u0435 \u0432\u00a0\u044d\u0442\u0438\u0445 \u0434\u0435\u0442\u0430\u043b\u044f\u0445: \u0432\u0430\u0436\u043d\u043e \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438, \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0449\u0435\u0435\u00a0\u0432\u00a0\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432, \u043e\u0431 \u044d\u0442\u043e\u043c \u043d\u0438\u0436\u0435.\u00a0<\/p>\n<\/blockquote>\n<p>\u0410\u00a0\u0447\u0442\u043e \u0435\u0441\u043b\u0438\u00a0\u0431\u044b \u043c\u044b\u00a0\u043c\u043e\u0433\u043b\u0438 \u0432\u0437\u044f\u0442\u044c\u00a0\u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u0432\u044b\u0448\u0435 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0446\u0432\u0435\u0442\u0430\u00a0\u0438\u00a0\u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437\u00a0\u043d\u0438\u0445 \u0432\u00a0\u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0449\u0435\u0435 \u043c\u0435\u043d\u044c\u0448\u0435 \u043c\u0435\u0441\u0442\u0430 \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e? \u041d\u0430\u0438\u0432\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">>>> mapper = {v: k for k, v in enumerate(colors.unique())} >>> mapper {'periwinkle': 0, 'mint green': 1, 'burnt orange': 2, 'rose': 3, 'navy': 4}  >>> as_int = colors.map(mapper) >>> as_int 0    0 1    1 2    2 3    0 4    2 5    3 6    3 7    1 8    3 9    4 dtype: int64  >>> as_int.apply(sys.getsizeof) 0    24 1    28 2    28 3    24 4    28 5    28 6    28 7    28 8    28 9    28 dtype: int64<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0414\u0440\u0443\u0433\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u043e\u00a0\u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0432\u00a0Pandas\u00a0\u2014\u00a0<code>pd.factorize (colors)<\/code> :<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>>>> pd.factorize(colors)[0] array([0, 1, 2, 0, 2, 3, 3, 1, 3, 4])<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0422\u0430\u043a \u0438\u043b\u0438 \u0438\u043d\u0430\u0447\u0435 \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043e\u0434\u0438\u0440\u0443\u0435\u0442\u0441\u044f\u00a0\u043a\u0430\u043a \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u043c\u044b\u0439 \u0442\u0438\u043f (\u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f). <\/p>\n<p>\u0412\u044b\u00a0\u0441\u0440\u0430\u0437\u0443 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u0435, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u043b\u043e\u0441\u044c \u043f\u043e\u0447\u0442\u0438 \u0432\u0434\u0432\u043e\u0435 \u043f\u043e\u00a0\u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441\u00a0\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u043e\u043b\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a \u0441\u00a0dtype <code>object<\/code>. \u0420\u0430\u043d\u0435\u0435 \u0432\u00a0\u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u043e\u0431 \u0430\u043a\u0441\u0435\u0441\u0441\u043e\u0440\u0430\u0445 \u044f\u00a0\u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u00a0\u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0439\u00a0\u0430\u0441\u0446\u0435\u0441\u0441\u043e\u0440 <code>.cat<\/code>. \u041f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u00a0<code>mapper<\/code> \u2014 \u0433\u0440\u0443\u0431\u0430\u044f \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u044f\u00a0\u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u043d\u0443\u0442\u0440\u0438 dtype <code>Categorical<\/code> \u0432\u00a0Pandas:<\/p>\n<blockquote>\n<p>\u00ab\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 <code>Categorical<\/code> \u043f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439 \u043f\u043b\u044e\u0441 \u0434\u043b\u0438\u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. \u041d\u0430\u043f\u0440\u043e\u0442\u0438\u0432, <code>object<\/code> dtype\u00a0\u2014 \u044d\u0442\u043e \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430, \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u043d\u0430\u044f \u043d\u0430\u00a0\u0434\u043b\u0438\u043d\u0443 \u0434\u0430\u043d\u043d\u044b\u0445\u00bb <a href=\"https:\/\/pandas.pydata.org\/pandas-docs\/stable\/categorical.html#memory-usage\">(\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a)<\/a>.<\/p>\n<\/blockquote>\n<p>\u0412\u00a0<code>colors<\/code> \u0432\u044b\u0448\u0435 \u0435\u0441\u0442\u044c \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u0434\u0432\u0443\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043d\u0430\u00a0\u043a\u0430\u0436\u0434\u043e\u0435 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0442\u043e\u00a0\u0435\u0441\u0442\u044c \u043d\u0430 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044e:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">>>> len(colors) \/ colors.nunique() 2.0<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u042d\u043a\u043e\u043d\u043e\u043c\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438 \u043e\u0442\u00a0\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u00a0<code>Categorical<\/code> \u0445\u043e\u0440\u043e\u0448\u0430, \u043d\u043e\u00a0\u043d\u0435\u0432\u0435\u043b\u0438\u043a\u0430:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">>>> # Not a huge space-saver to encode as Categorical >>> colors.memory_usage(index=False, deep=True) 650 >>> colors.astype('category').memory_usage(index=False, deep=True) 495<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u041d\u043e, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0431\u0443\u0434\u0435\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043d\u043e\u0433\u043e \u0434\u0435\u043c\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0433\u0434\u0435 \u043c\u0430\u043b\u043e \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u043e\u0431\u044a\u0451\u043c \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u0441\u044f \u0432 10 \u0440\u0430\u0437:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>>>> manycolors = colors.repeat(10) >>> len(manycolors) \/ manycolors.nunique()  # Much greater than 2.0x 20.0  >>> manycolors.memory_usage(index=False, deep=True) 6500 >>> manycolors.astype('category').memory_usage(index=False, deep=True) 585<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043f\u043e\u0432\u044b\u0448\u0430\u0435\u0442\u0441\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439: \u0434\u043b\u044f \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0445 <code>Series<\/code> \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 [\u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043d\u0430\u0434 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c <code>.cat.categories<\/code>, \u0430\u00a0\u043d\u0435\u00a0\u043d\u0430\u0434 \u043a\u0430\u0436\u0434\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c <code>Series<\/code>. \u0414\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438, \u0430\u00a0\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u043d\u0430\u00a0\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u043c\u0435\u044e\u0442 \u0430\u043a\u0441\u0435\u0441\u0441\u043e\u0440 <code>.cat<\/code> \u2014\u00a0\u043e\u043a\u043d\u043e \u0432\u00a0\u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0438\u00a0\u043c\u0435\u0442\u043e\u0434\u044b \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f\u043c\u0438:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">>>> ccolors = colors.astype('category') >>> ccolors.cat.categories Index(['burnt orange', 'mint green', 'navy', 'periwinkle', 'rose'], dtype='object')<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u041c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u0445\u043e\u0436\u0435\u0435 \u043d\u0430\u00a0\u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u044b\u0448\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u0435\u043b\u0430\u043b\u0441\u044f \u0432\u0440\u0443\u0447\u043d\u0443\u044e:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>>>> ccolors.cat.codes 0    3 1    1 2    0 3    3 4    0 5    4 6    4 7    1 8    4 9    2 dtype: int8<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0412\u0441\u0451, \u0447\u0442\u043e \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0432\u00a0\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u0440\u0443\u0447\u043d\u043e\u0439 \u0432\u044b\u0432\u043e\u0434,\u00a0\u2014 \u044d\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043a\u043e\u0434\u043e\u0432:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">>>> ccolors.cat.reorder_categories(mapper).cat.codes 0    0 1    1 2    2 3    0 4    2 5    3 6    3 7    1 8    3 9    4 dtype: int8<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e dtype\u00a0\u2014 \u044d\u0442\u043e <code>int8<\/code> NumPy, <a href=\"https:\/\/docs.scipy.org\/doc\/numpy-1.10.0\/user\/basics.types.html\">8-\u0431\u0438\u0442\u043d\u043e\u0435 \u0437\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u0446\u0435\u043b\u043e\u0435<\/a>, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043e\u0442 \u2212127 \u0434\u043e\u00a0128. \u0414\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u00a0\u043f\u0430\u043c\u044f\u0442\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0431\u0430\u0439\u0442. 64-\u0431\u0438\u0442\u043d\u044b\u0435 \u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0435 <code>int<\/code> \u0431\u044b\u043b\u0438\u00a0\u0431\u044b \u0438\u0437\u043b\u0438\u0448\u0435\u0441\u0442\u0432\u043e\u043c \u0441\u00a0\u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u0438. \u0413\u0440\u0443\u0431\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u0438\u0432\u0451\u043b \u043a\u00a0\u0434\u0430\u043d\u043d\u044b\u043c <code>int64<\/code> \u043f\u043e\u00a0\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0442\u043e\u0433\u0434\u0430 \u043a\u0430\u043a Pandas \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0443\u043c\u043d\u0430, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u00a0\u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u043c\u0443 \u0447\u0438\u0441\u043b\u043e\u0432\u043e\u043c\u0443 dtype. <\/p>\n<p>\u0411\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 <code>.cat<\/code> \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0441\u00a0\u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u043e\u043c \u0438\u00a0\u043c\u0430\u043d\u0438\u043f\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u0430\u043c\u0438\u043c\u0438 \u0431\u0430\u0437\u043e\u0432\u044b\u043c\u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f\u043c\u0438:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">>>> [i for i in dir(ccolors.cat) if not i.startswith('_')] ['add_categories',  'as_ordered',  'as_unordered',  'categories',  'codes',  'ordered',  'remove_categories',  'remove_unused_categories',  'rename_categories',  'reorder_categories',  'set_categories']<\/code><\/pre>\n<\/div>\n<\/details>\n<h3>6. \u0418\u043d\u0442\u0440\u043e\u0441\u043f\u0435\u043a\u0446\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 Groupby \u0447\u0435\u0440\u0435\u0437 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044e<\/h3>\n<p>\u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 <code>df.groupby ('x')<\/code> \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b\u00a0Pandas <code>groupby<\/code> \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043d\u0435\u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u044b\u043c\u0438. \u042d\u0442\u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u00a0 \u0438\u043d\u0441\u0442\u0430\u043d\u0446\u0438\u0440\u0443\u0435\u0442\u0441\u044f\u00a0\u043b\u0435\u043d\u0438\u0432\u043e \u0438\u00a0\u0441\u0430\u043c \u043f\u043e\u00a0\u0441\u0435\u0431\u0435 \u043d\u0435\u00a0\u0438\u043c\u0435\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u043e\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f. \u041f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c\u00a0\u044d\u0442\u043e \u043d\u0430\u00a0\u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 abalone \u0438\u0437 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">>>> abalone['ring_quartile'] = pd.qcut(abalone.rings, q=4, labels=range(1, 5)) >>> grouped = abalone.groupby('ring_quartile')  >>> grouped &lt;pandas.core.groupby.groupby.DataFrameGroupBy object at 0x11c1169b0><\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0425\u043e\u0440\u043e\u0448\u043e, \u0442\u0435\u043f\u0435\u0440\u044c \u0443\u00a0\u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 <code>groupby<\/code>, \u043d\u043e\u00a0\u0447\u0442\u043e \u044d\u0442\u043e \u0437\u0430\u00a0\u0448\u0442\u0443\u043a\u0430 \u0438\u00a0\u043a\u0430\u043a \u0435\u0451\u00a0\u0443\u0432\u0438\u0434\u0435\u0442\u044c?\u00a0\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435 <code>grouped.apply (func)<\/code>, \u0432\u044b\u00a0\u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u0435\u043c, \u0447\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u044b <code>groupby<\/code> \u043c\u043e\u0436\u043d\u043e \u0438\u0442\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">>>> help(grouped.__iter__)          Groupby iterator          Returns         -------         Generator yielding sequence of (name, subsetted object)         for each group<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u041d\u0435\u0447\u0442\u043e, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c\u043e\u0435 <code>grouped.__iter__()<\/code>, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043a\u043e\u0440\u0442\u0435\u0436 <code>(name, subsetted object)<\/code>, \u0433\u0434\u0435 <code>name<\/code>\u00a0\u2014 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0442\u043e\u043b\u0431\u0446\u0430 \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0438, \u0430\u00a0<code>subsetted object<\/code>\u00a0\u2014 \u044d\u0442\u043e DataFrame\u00a0\u2014\u00a0\u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e DataFrame \u043d\u0430\u00a0\u043e\u0441\u043d\u043e\u0432\u0435 \u043b\u044e\u0431\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0432\u0430\u043c\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0438,\u00a0\u0442\u043e\u00a0\u0435\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u043e\u00a0\u0433\u0440\u0443\u043f\u043f\u0430\u043c:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">>>> for idx, frame in grouped: ...     print(f'Ring quartile: {idx}') ...     print('-' * 16) ...     print(frame.nlargest(3, 'weight'), end='\\n\\n') ... Ring quartile: 1 ----------------      sex  length   diam  height  weight  rings ring_quartile 2619   M   0.690  0.540   0.185  1.7100      8             1 1044   M   0.690  0.525   0.175  1.7005      8             1 1026   M   0.645  0.520   0.175  1.5610      8             1  Ring quartile: 2 ----------------      sex  length  diam  height  weight  rings ring_quartile 2811   M   0.725  0.57   0.190  2.3305      9             2 1426   F   0.745  0.57   0.215  2.2500      9             2 1821   F   0.720  0.55   0.195  2.0730      9             2  Ring quartile: 3 ----------------      sex  length  diam  height  weight  rings ring_quartile 1209   F   0.780  0.63   0.215   2.657     11             3 1051   F   0.735  0.60   0.220   2.555     11             3 3715   M   0.780  0.60   0.210   2.548     11             3  Ring quartile: 4 ----------------      sex  length   diam  height  weight  rings ring_quartile 891    M   0.730  0.595    0.23  2.8255     17             4 1763   M   0.775  0.630    0.25  2.7795     12             4 165    M   0.725  0.570    0.19  2.5500     14             4<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u00a0\u043e\u0431\u044a\u0435\u043a\u0442 <code>groupby<\/code> \u0442\u0430\u043a\u0436\u0435 \u0438\u043c\u0435\u0435\u0442 <code>.groups<\/code> \u0438\u00a0\u0433\u0440\u0443\u043f\u043f\u043e\u0432\u043e\u0439 \u0433\u0435\u0442\u0442\u0435\u0440\u00a0\u2014 <code>.get_group()<\/code>:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">>>> grouped.groups.keys() dict_keys([1, 2, 3, 4])  >>> grouped.get_group(2).head()    sex  length   diam  height  weight  rings ring_quartile 2    F   0.530  0.420   0.135  0.6770      9             2 8    M   0.475  0.370   0.125  0.5095      9             2 19   M   0.450  0.320   0.100  0.3810      9             2 23   F   0.550  0.415   0.135  0.7635      9             2 39   M   0.355  0.290   0.090  0.3275      9             2<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u041d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442\u00a0\u0442\u043e\u0433\u043e, \u043a\u0430\u043a\u0438\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0432\u044b\u00a0\u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0435 \u043d\u0430\u0434 <code>grouped<\/code>, \u0431\u0443\u0434\u044c \u0442\u043e\u00a0\u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 Pandas \u0438\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437\u00a0\u044d\u0442\u0438\u0445 \u00ab\u043f\u043e\u0434\u0444\u0440\u0435\u0439\u043c\u043e\u0432\u00bb \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0437\u0430\u00a0\u0434\u0440\u0443\u0433\u0438\u043c \u043a\u0430\u043a \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u0418\u043c\u0435\u043d\u043d\u043e \u043e\u0442\u0441\u044e\u0434\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0442\u0435\u0440\u043c\u0438\u043d \u00absplit-apply-combine\u00bb: \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u00a0\u0433\u0440\u0443\u043f\u043f\u0430\u043c, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0440\u0430\u0441\u0447\u0451\u0442 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u044b \u0438\u00a0\u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u0438\u0445\u00a0\u0432\u00a0\u043d\u0435\u043a\u0443\u044e \u0430\u0433\u0440\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0444\u043e\u0440\u043c\u0443. \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0442\u0440\u0443\u0434\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c, \u043a\u0430\u043a \u0438\u043c\u0435\u043d\u043d\u043e \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0433\u0440\u0443\u043f\u043f\u044b, \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u00a0\u043f\u0435\u0447\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0438\u0437\u00a0\u043d\u0438\u0445 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u044b.<\/p>\n<h3>7. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u044d\u0442\u043e\u0442 \u0442\u0440\u044e\u043a \u0441 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u0434\u043b\u044f \u0431\u0438\u043d\u0438\u043d\u0433\u0430<\/h3>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435: \u0435\u0441\u0442\u044c Series \u0438\u00a0\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u00ab\u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u00bb, \u0433\u0434\u0435 \u043a\u0430\u0436\u0434\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u043a\u00a0\u043c\u043d\u043e\u0433\u043e\u0447\u043b\u0435\u043d\u043d\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435 \u0438\u043b\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435\u00a0\u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442\u00a0\u043d\u0438 \u043e\u0434\u043d\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u0435:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>>>> countries = pd.Series([ ...     'United States', ...     'Canada', ...     'Mexico', ...     'Belgium', ...     'United Kingdom', ...     'Thailand' ... ]) ... >>> groups = { ...     'North America': ('United States', 'Canada', 'Mexico', 'Greenland'), ...     'Europe': ('France', 'Germany', 'United Kingdom', 'Belgium') ... }<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0414\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c <code>countries<\/code> \u0441\u043e\u00a0\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c:<\/p>\n<details class=\"spoiler\">\n<summary>\u0422\u0435\u043a\u0441\u0442<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">0    North America 1    North America 2    North America 3           Europe 4           Europe 5            other dtype: object<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0417\u0434\u0435\u0441\u044c \u043d\u0443\u0436\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043f\u043e\u0445\u043e\u0436\u0430\u044f \u043d\u0430\u00a0\u0444\u0443\u043d\u043a\u0446\u0438\u044e Pandas <code>pd.cut()<\/code>, \u043d\u043e\u00a0\u0434\u043b\u044f \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0438 \u043d\u0430\u00a0\u043e\u0441\u043d\u043e\u0432\u0435 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u043d\u043e\u0441\u0442\u0438. \u0414\u043b\u044f \u0438\u043c\u0438\u0442\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f\u00a0<code>pd.Series.map()<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u00a0\u0443\u0436\u0435 \u0432\u0438\u0434\u0435\u043b\u0438:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">from typing import Any  def membership_map(s: pd.Series, groups: dict,                    fillvalue: Any=-1) -> pd.Series:     # Reverse &amp; expand the dictionary key-value pairs     groups = {x: k for k, v in groups.items() for x in v}     return s.map(groups).fillna(fillvalue)<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u041a\u043e\u0434 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0447\u0435\u043c \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b Python \u043f\u043e \u0433\u0440\u0443\u043f\u043f\u0430\u043c \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u044b:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">>>> membership_map(countries, groups, fillvalue='other') 0    North America 1    North America 2    North America 3           Europe 4           Europe 5            other dtype: object<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0420\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f, \u0447\u0442\u043e\u00a0\u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442. \u042d\u0442\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442, \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0439\u0442\u0438 \u0432\u00a0\u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u00a0\u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a\u0430 Python, <code>pdb<\/code>, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u00a0\u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<p>\u0417\u0430\u0434\u0430\u0447\u0430 \u2014 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043a\u0430\u0436\u0434\u0443\u044e \u0433\u0440\u0443\u043f\u043f\u0443 \u0432\u00a0<code>groups<\/code> \u0446\u0435\u043b\u043e\u043c\u0443 \u0447\u0438\u0441\u043b\u0443. \u041e\u0434\u043d\u0430\u043a\u043e <code>Series.map()<\/code> \u043d\u0435\u00a0\u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0451\u0442 <code>'ab'<\/code>\u00a0\u2014 \u0435\u043c\u0443 \u043d\u0443\u0436\u043d\u0430 \u0440\u0430\u0437\u0431\u0438\u0442\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f, \u0433\u0434\u0435 \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \u0438\u0437\u00a0\u043a\u0430\u0436\u0434\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u044b \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0451\u043d \u043d\u0430\u00a0\u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e. \u042d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f <a href=\"https:\/\/docs.python.org\/tutorial\/datastructures.html#dictionaries\">\u043e\u0445\u0432\u0430\u0442\u043e\u043c\u00a0\u0441\u043b\u043e\u0432\u0430\u0440\u044f<\/a>:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">>>> groups = dict(enumerate(('ab', 'cd', 'xyz'))) >>> {x: k for k, v in groups.items() for x in v} {'a': 0, 'b': 0, 'c': 1, 'd': 1, 'x': 2, 'y': 2, 'z': 2}<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u042d\u0442\u043e\u0442 \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u043c\u043e\u0436\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f\u00a0\u0432\u00a0<code>s.map()<\/code> \u0434\u043b\u044f \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u00ab\u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430\u00bb \u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432\u00a0\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0433\u0440\u0443\u043f\u043f.<\/p>\n<h3>8. \u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437\u00a0\u0431\u0443\u0444\u0435\u0440\u0430 \u043e\u0431\u043c\u0435\u043d\u0430<\/h3>\n<p>\u0427\u0430\u0441\u0442\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e\u00a0\u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437\u00a0\u0442\u0430\u043a\u043e\u0433\u043e \u043c\u0435\u0441\u0442\u0430, \u043a\u0430\u043a Excel \u0438\u043b\u0438 <a href=\"https:\/\/realpython.com\/setting-up-sublime-text-3-for-full-stack-python-development\/\">Sublime Text<\/a>, \u0432\u00a0\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 Pandas. \u0412\u00a0\u0438\u0434\u0435\u0430\u043b\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0445\u043e\u0447\u0435\u0442\u0441\u044f, \u043d\u0435\u00a0\u043f\u0440\u043e\u0445\u043e\u0434\u044f \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0439 \u044d\u0442\u0430\u043f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u00a0\u0444\u0430\u0439\u043b \u0438\u00a0\u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e <a href=\"https:\/\/realpython.com\/pandas-read-write-files\/\">\u0447\u0442\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u0430 \u0432\u00a0Pandas<\/a>. \u0412\u044b\u00a0\u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c DataFrames \u0438\u0437\u00a0\u0431\u0443\u0444\u0435\u0440\u0430 \u043e\u0431\u043c\u0435\u043d\u0430\u00a0\u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 \u0441\u00a0\u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>pd.read_clipboard()<\/code>. \u0415\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0432\u00a0\u0432\u0438\u0434\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0441\u043b\u043e\u0432 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0432\u00a0<code>pd.read_table()<\/code>.<\/p>\n<p>\u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u00a0DataFrame \u0438\u043b\u0438 Series. \u0412\u00a0Excel \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/00f\/291\/29b\/00f29129ba898d7b7bfbc68b61c6847c.jpeg\" width=\"576\" height=\"216\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/00f\/291\/29b\/00f29129ba898d7b7bfbc68b61c6847c.jpeg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0415\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u00a0\u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">a   b           c       d 0   1           inf     1\/1\/00 2   7.389056099 N\/A     5-Jan-13 4   54.59815003 nan     7\/24\/18 6   403.4287935 None    NaT<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u041f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u0435 \u0438\u00a0\u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0439\u0442\u0435\u00a0\u0442\u0435\u043a\u0441\u0442 \u0432\u044b\u0448\u0435 \u0438\u00a0\u0432\u044b\u0437\u043e\u0432\u0438\u0442\u0435 <code>pd.read_clipboard()<\/code>:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">>>> df = pd.read_clipboard(na_values=[None], parse_dates=['d']) >>> df    a         b    c          d 0  0    1.0000  inf 2000-01-01 1  2    7.3891  NaN 2013-01-05 2  4   54.5982  NaN 2018-07-24 3  6  403.4288  NaN        NaT  >>> df.dtypes a             int64 b           float64 c           float64 d    datetime64[ns] dtype: object<\/code><\/pre>\n<\/div>\n<\/details>\n<h3>9. \u0417\u0430\u043f\u0438\u0441\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 Pandas \u0432\u00a0\u0441\u0436\u0430\u0442\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442<\/h3>\n<p>\u042d\u0442\u043e\u0442 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439\u00a0\u043f\u0440\u0438\u043c\u0435\u0440 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a. \u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441\u00a0\u0432\u0435\u0440\u0441\u0438\u0438 Pandas 0.21.0 \u0432\u044b\u00a0\u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b Pandas \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0434\u043b\u044f \u0441\u0436\u0430\u0442\u0438\u044f gzip, bz2, zip \u0438\u043b\u0438 xz, \u0430\u00a0\u043d\u0435\u00a0\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043d\u0435\u0441\u0436\u0430\u0442\u044b\u0439 \u0444\u0430\u0439\u043b \u0432\u00a0\u043f\u0430\u043c\u044f\u0442\u0438 \u0438\u00a0\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c\u00a0\u0435\u0433\u043e. \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 \u0434\u0430\u043d\u043d\u044b\u0435 <code>abalone<\/code> \u0438\u0437\u00a0\u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0442\u0440\u044e\u043a\u0430:<\/p>\n<pre><code class=\"python\">abalone.to_json('df.json.gz', orient='records',                 lines=True, compression='gzip')<\/code><\/pre>\n<p>\u041a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0440\u0430\u0437\u043d\u0438\u0446\u044b \u0432\u00a0\u0440\u0430\u0437\u043c\u0435\u0440\u0430\u0445 \u0440\u0430\u0432\u0435\u043d 11,6:<\/p>\n<pre><code class=\"python\">>>> import os.path >>> abalone.to_json('df.json', orient='records', lines=True) >>> os.path.getsize('df.json') \/ os.path.getsize('df.json.gz') 11.603035760226396<\/code><\/pre>\n<p>Data Science \u2014 \u044d\u0442\u043e \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430, \u043d\u043e \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441 \u0443\u0447\u0451\u0442\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u043c. \u0412 \u044d\u0442\u043e\u043c \u043e\u0434\u043d\u0430 \u0438\u0437 \u043f\u0440\u0438\u0447\u0438\u043d \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u0437\u0430\u0440\u043f\u043b\u0430\u0442\u044b \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0441\u0442\u0430 \u0432 \u043d\u0430\u0443\u043a\u0435 \u043e \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u0442\u0430\u0442\u044c \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043c\u043e\u0447\u044c \u0432\u0430\u043c <a href=\"https:\/\/skillfactory.ru\/dstpro?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_dspr_160821&amp;utm_term=conc\">\u043d\u0430 \u043d\u0430\u0448\u0435\u043c \u043a\u0443\u0440\u0441\u0435<\/a>. \u0422\u0430\u043a\u0436\u0435 \u0432\u044b <a href=\"https:\/\/skillfactory.ru\/courses\/?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=sf_allcourses_160821&amp;utm_term=conc\">\u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0437\u043d\u0430\u0442\u044c<\/a>, \u043a\u0430\u043a \u043d\u0430\u0447\u0430\u0442\u044c \u043a\u0430\u0440\u044c\u0435\u0440\u0443 \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0430 \u0438\u043b\u0438 \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u0430\u0447\u0430\u0442\u044c \u0441 \u043d\u0443\u043b\u044f \u0438\u043b\u0438 \u043f\u0440\u043e\u043a\u0430\u0447\u0430\u0442\u044c\u0441\u044f \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u0445, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 <a href=\"https:\/\/skillfactory.ru\/python-fullstack-web-developer?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_fpw_160821&amp;utm_term=conc\">Fullstack-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043d\u0430 Python<\/a>:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/32c\/641\/b75\/32c641b75ed5442bb86d5dd11ee05700.png\" width=\"1000\" height=\"200\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/32c\/641\/b75\/32c641b75ed5442bb86d5dd11ee05700.png\"\/><figcaption><\/figcaption><\/figure>\n<p><strong>Data Science \u0438 Machine Learning<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/dstpro?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_dspr_160821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Data Scientist<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/dataanalystpro?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=analytics_dapr_160821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Data Analyst<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/math-stat-for-ds#syllabus?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_mat_160821&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u00ab\u041c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0430 \u0434\u043b\u044f Data Science\u00bb<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/math_and_ml?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_matml_160821&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u00ab\u041c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0430 \u0438 Machine Learning \u0434\u043b\u044f Data Science\u00bb<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/dataengineer?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_dea_160821&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u043f\u043e Data Engineering<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/ml-and-dl?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_mldl_160821&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u00abMachine Learning \u0438 Deep Learning\u00bb<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/ml-programma-machine-learning-online?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_ml_160821&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u043f\u043e Machine Learning<\/a><\/p>\n<\/li>\n<\/ul>\n<p><strong>Python, \u0432\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/python-fullstack-web-developer?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_fpw_160821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Fullstack-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043d\u0430 Python<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/python-for-web-developers?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_pws_160821&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u00abPython \u0434\u043b\u044f \u0432\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438\u00bb<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/frontend?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_fr_160821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Frontend-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/webdev?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_webdev_160821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f \u0412\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041c\u043e\u0431\u0438\u043b\u044c\u043d\u0430\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/iosdev?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_iosdev_160821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f iOS-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/android?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_andr_160821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Android-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<\/ul>\n<p><strong>Java \u0438 C#<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/java?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_java_160821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Java-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/java-qa-engineer?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_qaja_160821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f QA-\u0438\u043d\u0436\u0435\u043d\u0435\u0440 \u043d\u0430 JAVA<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/csharp?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_cdev_160821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f C#-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/game-dev?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_gamedev_160821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0438\u0433\u0440 \u043d\u0430 Unity<\/a><\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041e\u0442 \u043e\u0441\u043d\u043e\u0432 \u2014 \u0432 \u0433\u043b\u0443\u0431\u0438\u043d\u0443<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/algo?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_algo_160821&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u00ab\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445\u00bb<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/cplus?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_cplus_160821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f C++ \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/cybersecurity?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_hacker_160821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f \u042d\u0442\u0438\u0447\u043d\u044b\u0439 \u0445\u0430\u043a\u0435\u0440<\/a><\/p>\n<\/li>\n<\/ul>\n<p><strong>\u0410 \u0442\u0430\u043a\u0436\u0435:<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/devops?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_devops_160821&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u043f\u043e DevOps<\/a><\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/573154\/\"> https:\/\/habr.com\/ru\/articles\/573154\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041a \u0441\u0442\u0430\u0440\u0442\u0443 \u0444\u043b\u0430\u0433\u043c\u0430\u043d\u0441\u043a\u043e\u0433\u043e <a href=\"https:\/\/skillfactory.ru\/dstpro?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_dspr_160821&amp;utm_term=lead\">\u043a\u0443\u0440\u0441\u0430 \u043f\u043e Data Science<\/a> \u0434\u0435\u043b\u0438\u043c\u0441\u044f \u0441\u043e\u043a\u0440\u0430\u0449\u0451\u043d\u043d\u044b\u043c \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c \u0438\u0437 \u0431\u043b\u043e\u0433\u0430 RealPython \u043e \u0442\u0440\u044e\u043a\u0430\u0445 \u0441 Pandas, \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0438 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430\u043c\u0438 \u0438 \u0438\u0445 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u043e\u043c. \u0417\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u0435\u043c\u0430 \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0438 \u043f\u0430\u043c\u044f\u0442\u0438, \u0441\u0436\u0430\u0442\u0438\u0435 \u0444\u0440\u0435\u0439\u043c\u043e\u0432, \u0438\u043d\u0442\u0440\u043e\u0441\u043f\u0435\u043a\u0446\u0438\u044f GroupBy \u0447\u0435\u0440\u0435\u0437 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044e \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0442\u0435\u043c\u044b. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438, \u043a\u0430\u043a \u0432\u0441\u0435\u0433\u0434\u0430, \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c.<\/p>\n<hr\/>\n<h2>1. \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u00a0\u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430<\/h2>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u044b\u00a0\u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0438\u0441\u044c \u0441\u00a0\u0431\u043e\u0433\u0430\u0442\u044b\u043c\u0438 <a href=\"https:\/\/pandas.pydata.org\/pandas-docs\/stable\/options.html\">\u043e\u043f\u0446\u0438\u044f\u043c\u0438 \u0438\u00a0\u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438<\/a> \u0441\u0438\u0441\u0442\u0435\u043c\u044b Pandas. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 Pandas \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043d\u0438\u0436\u0430\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u00a0\u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435\u00a0\u0432\u00a0\u0441\u0440\u0435\u0434\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432. \u041c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f\u00a0<code>pd.set_option()<\/code> \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u043e\u00a0\u0441\u0432\u043e\u0435\u043c\u0443 \u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044e \u0441\u00a0\u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/skillfactory.ru\/python-fullstack-web-developer?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_fpw_160821&amp;utm_term=main\">Python<\/a> \u0438\u043b\u0438 \u0432 \u0444\u0430\u0439\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 <a href=\"https:\/\/ipython.readthedocs.io\/en\/stable\/interactive\/tutorial.html#startup-files\">IPython<\/a>. \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0442\u043e\u0447\u0435\u0447\u043d\u0443\u044e \u043d\u043e\u0442\u0430\u0446\u0438\u044e: <code>pd.set_option ('display.max_colwidth', 25)<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0433\u043e <a href=\"https:\/\/realpython.com\/python-dicts\/\">\u0441\u043b\u043e\u0432\u0430\u0440\u044f<\/a> \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">import pandas as pd  def start():     options = {         'display': {             'max_columns': None,             'max_colwidth': 25,             'expand_frame_repr': False,  # Don't wrap to multiple pages             'max_rows': 14,             'max_seq_items': 50,         # Max length of printed sequence             'precision': 4,             'show_dimensions': False         },         'mode': {             'chained_assignment': None   # Controls SettingWithCopyWarning         }     }      for category, option in options.items():         for op, value in option.items():             pd.set_option(f'{category}.{op}', value)  # Python 3.6+  if __name__ == '__main__':     start()     del start  # Clean up namespace in the interpreter<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0432 \u0441\u0435\u0430\u043d\u0441 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430, \u0432\u044b\u00a0\u0443\u0432\u0438\u0434\u0438\u0442\u0435, \u0447\u0442\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u0438\u00a0Pandas \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441 \u0432\u0430\u0448\u0438\u043c \u043d\u0430\u0431\u043e\u0440\u043e\u043c\u00a0\u043e\u043f\u0446\u0438\u0439:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">>>> pd.__name__ 'pandas' >>> pd.get_option('display.max_rows') 14<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u043c\u0438\u00a0<a href=\"https:\/\/en.wikipedia.org\/wiki\/Abalone\">abalone<\/a> \u0432\u00a0\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f UCI, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u00a0\u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0435 \u0432\u00a0\u0444\u0430\u0439\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435. \u0421\u043e\u043a\u0440\u0430\u0442\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043e\u00a014 \u0441\u0442\u0440\u043e\u043a \u0441\u00a0\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u0434\u043e\u00a04 \u0446\u0438\u0444\u0440 \u0434\u043b\u044f \u0447\u0438\u0441\u0435\u043b \u0441 \u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0435\u0439 \u0442\u043e\u0447\u043a\u043e\u0439:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">url = ('https:\/\/archive.ics.uci.edu\/ml\/' ...        'machine-learning-databases\/abalone\/abalone.data') >>> cols = ['sex', 'length', 'diam', 'height', 'weight', 'rings'] >>> abalone = pd.read_csv(url, usecols=[0, 1, 2, 3, 4, 8], names=cols)  >>> abalone      sex  length   diam  height  weight  rings 0      M   0.455  0.365   0.095  0.5140     15 1      M   0.350  0.265   0.090  0.2255      7 2      F   0.530  0.420   0.135  0.6770      9 3      M   0.440  0.365   0.125  0.5160     10 4      I   0.330  0.255   0.080  0.2050      7 5      I   0.425  0.300   0.095  0.3515      8 6      F   0.530  0.415   0.150  0.7775     20 # ... 4170   M   0.550  0.430   0.130  0.8395     10 4171   M   0.560  0.430   0.155  0.8675      8 4172   F   0.565  0.450   0.165  0.8870     11 4173   M   0.590  0.440   0.135  0.9660     10 4174   M   0.600  0.475   0.205  1.1760      9 4175   F   0.625  0.485   0.150  1.0945     10 4176   M   0.710  0.555   0.195  1.9485     12<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u041f\u043e\u0437\u0436\u0435 \u0432\u044b\u00a0\u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u044d\u0442\u043e\u0442 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u00a0\u0432\u00a0\u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445.<\/p>\n<h3>2. \u0418\u0433\u0440\u0443\u0448\u0435\u0447\u043d\u044b\u0435 c\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u043e\u0434\u0443\u043b\u044f\u00a0\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f Pandas<\/h3>\n<blockquote>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c <code>pandas.util.testing<\/code> \u0431\u044b\u043b <a href=\"https:\/\/pandas.pydata.org\/docs\/whatsnew\/v1.0.0.html#deprecations\">\u0443\u0434\u0430\u043b\u0451\u043d \u0432\u00a0Pandas 1.0<\/a>. \u041f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 API \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0437\u00a0<code>pandas.testing<\/code> \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d <code>assert_extension_array_equal()<\/code>, <code>assert_frame_equal()<\/code>, <code>assert_series_equal()<\/code> \u0438\u00a0<code>assert_index_equal()<\/code>. \u0410\u0432\u0442\u043e\u0440 \u043f\u0440\u0438\u0437\u043d\u0430\u0451\u0442, \u0447\u0442\u043e \u0443\u0437\u043d\u0430\u043b \u0432\u043a\u0443\u0441 \u0441\u0432\u043e\u0435\u0433\u043e \u043b\u0435\u043a\u0430\u0440\u0441\u0442\u0432\u0430 \u0437\u0430\u00a0\u0442\u043e, \u0447\u0442\u043e \u043f\u043e\u043b\u0430\u0433\u0430\u043b\u0441\u044f \u043d\u0430\u00a0\u043d\u0435\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Pandas.<\/p>\n<\/blockquote>\n<p>\u0412\u00a0\u043c\u043e\u0434\u0443\u043b\u0435 Pandas <code>testing<\/code> \u0441\u043a\u0440\u044b\u0442 \u0440\u044f\u0434 \u0443\u0434\u043e\u0431\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0434\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043a\u0432\u0430\u0437\u0438\u0440\u0435\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u044b\u0445 Series \u0438\u00a0\u0444\u0440\u0435\u0439\u043c\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">>>> import pandas.util.testing as tm >>> tm.N, tm.K = 15, 3  # Module-level default rows\/columns  >>> import numpy as np >>> np.random.seed(444)  >>> tm.makeTimeDataFrame(freq='M').head()                  A       B       C 2000-01-31  0.3574 -0.8804  0.2669 2000-02-29  0.3775  0.1526 -0.4803 2000-03-31  1.3823  0.2503  0.3008 2000-04-30  1.1755  0.0785 -0.1791 2000-05-31 -0.9393 -0.9039  1.1837  >>> tm.makeDataFrame().head()                  A       B       C nTLGGTiRHF -0.6228  0.6459  0.1251 WPBRn9jtsR -0.3187 -0.8091  1.1501 7B3wWfvuDA -1.9872 -1.0795  0.2987 yJ0BTjehH1  0.8802  0.7403 -1.2154 0luaYUYvy1 -0.9320  1.2912 -0.2907<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0418\u0445\u00a0\u043e\u043a\u043e\u043b\u043e 30, \u043f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u0432\u044b\u0437\u0432\u0430\u0432\u00a0<code>dir()<\/code> \u043d\u0430\u00a0\u043e\u0431\u044a\u0435\u043a\u0442\u0435 \u043c\u043e\u0434\u0443\u043b\u044f. \u0412\u043e\u0442\u00a0\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">>>> [i for i in dir(tm) if i.startswith('make')] ['makeBoolIndex',  'makeCategoricalIndex',  'makeCustomDataframe',  'makeCustomIndex',  # ...,  'makeTimeSeries',  'makeTimedeltaIndex',  'makeUIntIndex',  'makeUnicodeIndex']<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u041e\u043d\u0438\u00a0\u043f\u043e\u043b\u0435\u0437\u043d\u044b \u0434\u043b\u044f \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0438\u043d\u0433\u0430, \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0439 \u0438\u00a0\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u0441 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e \u0437\u043d\u0430\u043a\u043e\u043c\u044b\u043c\u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 Pandas.<\/p>\n<h3>3. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0430<\/h3>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u044b\u00a0\u0441\u043b\u044b\u0448\u0430\u043b\u0438 \u043e\u00a0\u0442\u0435\u0440\u043c\u0438\u043d\u0435 <strong>\u0430\u043ac\u0435\u0441\u0441\u043e\u0440<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439\u00a0\u0447\u0435\u043c-\u0442\u043e \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442 \u0433\u0435\u0442\u0442\u0435\u0440 (\u0445\u043e\u0442\u044f \u0433\u0435\u0442\u0442\u0435\u0440\u044b \u0438\u00a0\u0441\u0435\u0442\u0442\u0435\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0432\u00a0Python \u043d\u0435\u0447\u0430\u0441\u0442\u043e). \u0412 \u043d\u0430\u0448\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0435\u043c \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0430\u043a\u0441\u0435\u0441\u0441\u043e\u0440\u043e\u043c\u00a0\u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u043b\u0443\u0436\u0438\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c \u0434\u043b\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432. \u0412 Series [\u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438] \u0438\u0445\u00a0\u0442\u0440\u0438, \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u0438\u0445 4:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">>>> pd.Series._accessors {'cat', 'dt', 'sparse', 'str'}<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0414\u0430, \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u0435 \u0432\u044b\u0448\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043c\u043d\u043e\u0433\u043e\u0437\u043d\u0430\u0447\u043d\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043e \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u00a0\u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u044b.<\/p>\n<ul>\n<li>\n<p><code>.cat<\/code>\u00a0\u2014 \u0434\u043b\u044f \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445; <\/p>\n<\/li>\n<li>\n<p><code>.str<\/code>\u00a0\u2014 \u0434\u043b\u044f \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0445 (\u043e\u0431\u044a\u0435\u043a\u0442\u043d\u044b\u0445) \u0434\u0430\u043d\u043d\u044b\u0445; <\/p>\n<\/li>\n<li>\n<p><code>.dt<\/code>\u00a0\u2014 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0432\u0440\u0435\u043c\u0435\u043d\u0438. <\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0430\u0447\u043d\u0451\u043c \u0441\u00a0<code>.str<\/code>: \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435, \u0447\u0442\u043e \u0443\u00a0\u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043d\u0435\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u00a0\u0433\u043e\u0440\u043e\u0434\u0435\/\u043e\u0431\u043b\u0430\u0441\u0442\u0438\/\u0438\u043d\u0434\u0435\u043a\u0441\u0435 \u0432\u00a0\u0432\u0438\u0434\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044f \u0432\u00a0Series Pandas. \u0421\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b Pandas <a href=\"https:\/\/realpython.com\/numpy-array-programming\/#what-is-vectorization\">\u0432\u0435\u043a\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u044b<\/a>, \u0442\u043e \u0435\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441\u043e\u00a0\u0432\u0441\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c \u0431\u0435\u0437 \u044f\u0432\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 for:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">>>> addr = pd.Series([ ...     'Washington, D.C. 20003', ...     'Brooklyn, NY 11211-1755', ...     'Omaha, NE 68154', ...     'Pittsburgh, PA 15211' ... ])  >>> addr.str.upper() 0     WASHINGTON, D.C. 20003 1    BROOKLYN, NY 11211-1755 2            OMAHA, NE 68154 3       PITTSBURGH, PA 15211 dtype: object  >>> addr.str.count(r'\\d')  # 5 or 9-digit zip? 0    5 1    9 2    5 3    5 dtype: int64<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0441\u043b\u043e\u0436\u043d\u0435\u0435\u00a0\u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u0432\u044b\u00a0\u0445\u043e\u0442\u0438\u0442\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0442\u0440\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 city\/state\/ZIP \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e \u043d\u0430\u00a0\u043f\u043e\u043b\u044f \u0444\u0440\u0435\u0439\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. \u0412\u044b\u00a0\u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432\u00a0<code>.str.extract()<\/code>, \u0447\u0442\u043e\u0431\u044b \u00ab\u0438\u0437\u0432\u043b\u0435\u0447\u044c\u00bb \u0447\u0430\u0441\u0442\u0438 \u043a\u0430\u0436\u0434\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0438 \u0432 Series. \u0412\u00a0<code>.str.extract()<\/code>, <code>.str<\/code>\u00a0\u2014 \u044d\u0442\u043e \u0430\u043a\u0441\u0435\u0441\u0441\u043e\u0440, \u0430\u00a0<code>.str.extract()<\/code>\u00a0\u2014 \u043c\u0435\u0442\u043e\u0434 \u0430\u043a\u0441\u0435\u0441\u0441\u043e\u0440\u0430:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>>>> regex = (r'(?P&lt;city>[A-Za-z ]+), '      # One or more letters ...          r'(?P&lt;state>[A-Z]{2}) '        # 2 capital letters ...          r'(?P&lt;zip>\\d{5}(?:-\\d{4})?)')  # Optional 4-digit extension ... >>> addr.str.replace('.', '').str.extract(regex)          city state         zip 0  Washington    DC       20003 1    Brooklyn    NY  11211-1755 2       Omaha    NE       68154 3  Pittsburgh    PA       15211<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u041a\u043e\u0434 \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442\u00a0\u0446\u0435\u043f\u043e\u0447\u043a\u0443 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0433\u0434\u0435 <code>.str.extract (regex)<\/code> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u00a0\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 <code>addr.str.replace ('.', '')<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0447\u0438\u0449\u0430\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u043e\u0447\u0435\u043a, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u0440\u0430\u0441\u0438\u0432\u0443\u044e \u0434\u0432\u0443\u0445\u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u0443\u044e \u0430\u0431\u0431\u0440\u0435\u0432\u0438\u0430\u0442\u0443\u0440\u0443 \u0448\u0442\u0430\u0442\u0430. \u041f\u043e\u043b\u0435\u0437\u043d\u043e\u00a0\u043d\u0435\u043c\u043d\u043e\u0433\u043e\u00a0\u0437\u043d\u0430\u0442\u044c \u043e\u00a0\u0442\u043e\u043c, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u044d\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u044b-\u0430\u043a\u0441\u0435\u0441\u0441\u043e\u0440\u044b, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u043f\u043e\u0447\u0435\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0445, \u0430\u00a0\u043d\u0435\u00a0\u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435 <code>addr.apply (re.findall, \u2026)<\/code>. \u041a\u0430\u0436\u0434\u044b\u0439 \u0430\u043a\u0441\u0435\u0441\u0441\u043e\u0440\u00a0\u2014 \u044d\u0442\u043e \u043a\u043b\u0430\u0441\u0441 Python:<\/p>\n<ul>\n<li>\n<p><code>.str<\/code> \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u00a0<code>StringMethods<\/code>. <\/p>\n<\/li>\n<li>\n<p><code>.dt<\/code> \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u00a0<code>CombinedDatetimelikeProperties<\/code>. <\/p>\n<\/li>\n<li>\n<p><code>.cat<\/code> \u2014 \u043d\u0430 <code>CategoricalAccessor<\/code>.<\/p>\n<\/li>\n<\/ul>\n<p>\u042d\u0442\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u0437\u0430\u0442\u0435\u043c \u00ab\u043f\u0440\u0438\u043a\u0440\u0435\u043f\u043b\u044f\u044e\u0442\u0441\u044f\u00bb \u043a\u00a0Series \u0441\u00a0\u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>CachedAccessor<\/code>. \u0418\u043c\u0435\u043d\u043d\u043e \u043a\u043e\u0433\u0434\u0430 \u043a\u043b\u0430\u0441\u0441\u044b \u043e\u0431\u0451\u0440\u043d\u0443\u0442\u044b \u0432\u00a0<code>CachedAccessor<\/code>, \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043c\u0430\u0433\u0438\u044f. <\/p>\n<p><code>CachedAccessor<\/code> \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u043b\u0451\u043d \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0435\u0439 \u00ab\u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u00bb: \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430, \u0430\u00a0\u0437\u0430\u0442\u0435\u043c \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u044b\u0447\u043d\u044b\u043c \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c. \u042d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0443\u0442\u0451\u043c \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 <code>.__get__()<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 <a href=\"https:\/\/realpython.com\/python-descriptors\/\">\u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u0430<\/a> Python.<\/p>\n<blockquote>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b\u00a0\u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u00a0\u0440\u0430\u0431\u043e\u0442\u0435 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u043e\u0432, \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435<a href=\"https:\/\/docs.python.org\/howto\/descriptor.html\"> Descriptor HOWTO<\/a> \u0438\u00a0<a href=\"https:\/\/www.pydanny.com\/cached-property.html\">\u044d\u0442\u043e\u0442 \u043f\u043e\u0441\u0442<\/a> \u043e\u00a0\u0434\u0438\u0437\u0430\u0439\u043d\u0435 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432. \u0412\u00a0Python 3 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f <code>functools.lru_cache()<\/code>, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e\u0449\u0438\u0439 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u041f\u0430\u0442\u0442\u0435\u0440\u043d\u00a0\u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u0432\u0441\u044e\u0434\u0443, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440\u00a0\u0432\u00a0\u043f\u0430\u043a\u0435\u0442\u0435 <code>aiohttp<\/code>.<\/p>\n<\/blockquote>\n<p> \u0412\u0442\u043e\u0440\u043e\u0439 \u0430\u043a\u0441\u0435\u0441\u0441\u043e\u0440, <code>.dt<\/code>, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0422\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u043d\u00a0\u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u043a\u00a0<code>DatetimeIndex<\/code> Pandas, \u0438\u00a0\u0435\u0441\u043b\u0438 \u0435\u0433\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0434\u043b\u044f Series, \u0442\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u043d \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u00a0<code>DatetimeIndex<\/code>: <\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">>>> daterng = pd.Series(pd.date_range('2017', periods=9, freq='Q')) >>> daterng 0   2017-03-31 1   2017-06-30 2   2017-09-30 3   2017-12-31 4   2018-03-31 5   2018-06-30 6   2018-09-30 7   2018-12-31 8   2019-03-31 dtype: datetime64[ns]  >>>  daterng.dt.day_name() 0      Friday 1      Friday 2    Saturday 3      Sunday 4    Saturday 5    Saturday 6      Sunday 7      Monday 8      Sunday dtype: object  >>> # Second-half of year only >>> daterng[daterng.dt.quarter > 2] 2   2017-09-30 3   2017-12-31 6   2018-09-30 7   2018-12-31 dtype: datetime64[ns]  >>> daterng[daterng.dt.is_year_end] 3   2017-12-31 7   2018-12-31 dtype: datetime64[ns]<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0422\u0440\u0435\u0442\u0438\u0439 \u0430\u043a\u0441\u0435\u0441\u0441\u043e\u0440, <code>.cat<\/code>, \u2014 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u00a0\u0432\u0441\u043a\u043e\u0440\u0435 \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435.<\/p>\n<h3>4. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0434\u0430\u0442\u044b \u0438\u0437\u00a0\u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e\u00a0\u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043a\u0430\u043a \u0432\u00a0<code>daterng<\/code>, \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c Pandas <code>DatetimeIndex<\/code> \u0438\u0437\u00a0\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043d\u044b\u0445 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432,\u00a0\u0432\u043c\u0435\u0441\u0442\u0435 \u044d\u0442\u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u044b \u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442 \u0434\u0430\u0442\u0443 \u0438\u043b\u0438 \u0432\u0440\u0435\u043c\u044f:<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438 \u0432\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">>>> from itertools import product >>> datecols = ['year', 'month', 'day']  >>> df = pd.DataFrame(list(product([2017, 2016], [1, 2], [1, 2, 3])), ...                   columns=datecols) >>> df['data'] = np.random.randn(len(df)) >>> df     year  month  day    data 0   2017      1    1 -0.0767 1   2017      1    2 -1.2798 2   2017      1    3  0.4032 3   2017      2    1  1.2377 4   2017      2    2 -0.2060 5   2017      2    3  0.6187 6   2016      1    1  2.3786 7   2016      1    2 -0.4730 8   2016      1    3 -2.1505 9   2016      2    1 -0.6340 10  2016      2    2  0.7964 11  2016      2    3  0.0005  >>> df.index = pd.to_datetime(df[datecols]) >>> df.head()             year  month  day    data 2017-01-01  2017      1    1 -0.0767 2017-01-02  2017      1    2 -1.2798 2017-01-03  2017      1    3  0.4032 2017-02-01  2017      2    1  1.2377 2017-02-02  2017      2    2 -0.2060<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446,<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-394205","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/394205","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=394205"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/394205\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=394205"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=394205"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=394205"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}