current_marks-checkpoint



In [9]:
import pandas as pd
import numpy as np
df = pd.read_csv('2016.csv')
df["Итог"] = df[list(df.columns)[3:]].sum(axis=1)
df["Итог 2"] = df["Итог"] + (100 - np.max(df["Итог", :22]))
df.head(len(df))


---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-9-0962a2d3344a> in <module>()
      3 df = pd.read_csv('2016.csv')
      4 df["Итог"] = df[list(df.columns)[3:]].sum(axis=1)
----> 5 df["Итог 2"] = df["Итог"] + (100 - np.max(df["Итог", :22]))
      6 df.head(len(df))

E:\Anaconda3\lib\site-packages\pandas\core\frame.py in __getitem__(self, key)
   2057             return self._getitem_multilevel(key)
   2058         else:
-> 2059             return self._getitem_column(key)
   2060 
   2061     def _getitem_column(self, key):

E:\Anaconda3\lib\site-packages\pandas\core\frame.py in _getitem_column(self, key)
   2064         # get column
   2065         if self.columns.is_unique:
-> 2066             return self._get_item_cache(key)
   2067 
   2068         # duplicate columns & possible reduce dimensionality

E:\Anaconda3\lib\site-packages\pandas\core\generic.py in _get_item_cache(self, item)
   1382         """Return the cached item, item represents a label indexer."""
   1383         cache = self._item_cache
-> 1384         res = cache.get(item)
   1385         if res is None:
   1386             values = self._data.get(item)

TypeError: unhashable type: 'slice'

In [7]:
df["Итог"]


Out[7]:
0      28.0
1      30.0
2      55.5
3      39.0
4      78.5
5      60.5
6      28.0
7      61.0
8      61.0
9      81.0
10     47.0
11     70.0
12     76.0
13     62.0
14     60.0
15     57.0
16     81.0
17     78.0
18     69.5
19     75.5
20     63.0
21     73.0
22    100.0
Name: Итог, dtype: float64