title stringlengths 1 185 | diff stringlengths 0 32.2M | body stringlengths 0 123k ⌀ | url stringlengths 57 58 | created_at stringlengths 20 20 | closed_at stringlengths 20 20 | merged_at stringlengths 20 20 ⌀ | updated_at stringlengths 20 20 |
|---|---|---|---|---|---|---|---|
PERF: improved performance of multiindex slicing | diff --git a/doc/source/whatsnew/v0.17.0.txt b/doc/source/whatsnew/v0.17.0.txt
index 168fd803c5f8a..65b5266380d96 100644
--- a/doc/source/whatsnew/v0.17.0.txt
+++ b/doc/source/whatsnew/v0.17.0.txt
@@ -63,6 +63,8 @@ Performance Improvements
- 4x improvement in ``timedelta`` string parsing (:issue:`6755`)
- 8x improvement in ``timedelta64`` and ``datetime64`` ops (:issue:`6755`)
+- Significantly improved performance of indexing ``MultiIndex`` with slicers (:issue:`10287`)
+- Improved performance of ``Series.isin`` for datetimelike/integer Series (:issue:`10287`)
.. _whatsnew_0170.bug_fixes:
diff --git a/pandas/core/common.py b/pandas/core/common.py
index 990eec08d0bd6..76deb773c06c4 100644
--- a/pandas/core/common.py
+++ b/pandas/core/common.py
@@ -2497,6 +2497,10 @@ def is_integer_dtype(arr_or_dtype):
return (issubclass(tipo, np.integer) and
not issubclass(tipo, (np.datetime64, np.timedelta64)))
+def is_int64_dtype(arr_or_dtype):
+ tipo = _get_dtype_type(arr_or_dtype)
+ return issubclass(tipo, np.int64)
+
def is_int_or_datetime_dtype(arr_or_dtype):
tipo = _get_dtype_type(arr_or_dtype)
diff --git a/pandas/core/index.py b/pandas/core/index.py
index fad71c94cc417..35cf2c5aec3d5 100644
--- a/pandas/core/index.py
+++ b/pandas/core/index.py
@@ -105,6 +105,7 @@ class Index(IndexOpsMixin, PandasObject):
_is_numeric_dtype = False
_engine_type = _index.ObjectEngine
+ _isin_type = lib.ismember
def __new__(cls, data=None, dtype=None, copy=False, name=None, fastpath=False,
tupleize_cols=True, **kwargs):
@@ -1838,7 +1839,7 @@ def isin(self, values, level=None):
value_set = set(values)
if level is not None:
self._validate_index_level(level)
- return lib.ismember(np.array(self), value_set)
+ return self._isin_type(np.array(self), value_set)
def _can_reindex(self, indexer):
"""
@@ -3381,6 +3382,7 @@ class Int64Index(NumericIndex):
_outer_indexer = _algos.outer_join_indexer_int64
_engine_type = _index.Int64Engine
+ _isin_type = lib.ismember_int64
def __new__(cls, data=None, dtype=None, copy=False, name=None, fastpath=False, **kwargs):
@@ -5237,13 +5239,39 @@ def partial_selection(key, indexer=None):
indexer = self._get_level_indexer(key, level=level)
return indexer, maybe_droplevels(indexer, [level], drop_level)
- def _get_level_indexer(self, key, level=0):
- # return a boolean indexer or a slice showing where the key is
+ def _get_level_indexer(self, key, level=0, indexer=None):
+ # return an indexer, boolean array or a slice showing where the key is
# in the totality of values
+ # if the indexer is provided, then use this
level_index = self.levels[level]
labels = self.labels[level]
+ def convert_indexer(start, stop, step, indexer=indexer, labels=labels):
+ # given the inputs and the labels/indexer, compute an indexer set
+ # if we have a provided indexer, then this need not consider
+ # the entire labels set
+
+ r = np.arange(start,stop,step)
+ if indexer is not None and len(indexer) != len(labels):
+
+ # we have an indexer which maps the locations in the labels that we
+ # have already selected (and is not an indexer for the entire set)
+ # otherwise this is wasteful
+ # so we only need to examine locations that are in this set
+ # the only magic here is that the result are the mappings to the
+ # set that we have selected
+ from pandas import Series
+ mapper = Series(indexer)
+ result = Series(Index(labels.take(indexer)).isin(r).nonzero()[0])
+ m = result.map(mapper).values
+
+ else:
+ m = np.zeros(len(labels),dtype=bool)
+ m[np.in1d(labels,r,assume_unique=True)] = True
+
+ return m
+
if isinstance(key, slice):
# handle a slice, returnig a slice if we can
# otherwise a boolean indexer
@@ -5269,17 +5297,13 @@ def _get_level_indexer(self, key, level=0):
# a partial date slicer on a DatetimeIndex generates a slice
# note that the stop ALREADY includes the stopped point (if
# it was a string sliced)
- m = np.zeros(len(labels),dtype=bool)
- m[np.in1d(labels,np.arange(start.start,stop.stop,step))] = True
- return m
+ return convert_indexer(start.start,stop.stop,step)
elif level > 0 or self.lexsort_depth == 0 or step is not None:
# need to have like semantics here to right
# searching as when we are using a slice
# so include the stop+1 (so we include stop)
- m = np.zeros(len(labels),dtype=bool)
- m[np.in1d(labels,np.arange(start,stop+1,step))] = True
- return m
+ return convert_indexer(start,stop+1,step)
else:
# sorted, so can return slice object -> view
i = labels.searchsorted(start, side='left')
@@ -5317,59 +5341,73 @@ def get_locs(self, tup):
raise KeyError('MultiIndex Slicing requires the index to be fully lexsorted'
' tuple len ({0}), lexsort depth ({1})'.format(len(tup), self.lexsort_depth))
- def _convert_indexer(r):
+ # indexer
+ # this is the list of all values that we want to select
+ n = len(self)
+ indexer = None
+
+ def _convert_to_indexer(r):
+ # return an indexer
if isinstance(r, slice):
- m = np.zeros(len(self),dtype=bool)
+ m = np.zeros(n,dtype=bool)
m[r] = True
- return m
- return r
+ r = m.nonzero()[0]
+ elif is_bool_indexer(r):
+ if len(r) != n:
+ raise ValueError("cannot index with a boolean indexer that is"
+ " not the same length as the index")
+ r = r.nonzero()[0]
+ return Int64Index(r)
+
+ def _update_indexer(idxr, indexer=indexer):
+ if indexer is None:
+ indexer = Index(np.arange(n))
+ if idxr is None:
+ return indexer
+ return indexer & idxr
- ranges = []
for i,k in enumerate(tup):
if is_bool_indexer(k):
# a boolean indexer, must be the same length!
k = np.asarray(k)
- if len(k) != len(self):
- raise ValueError("cannot index with a boolean indexer that is"
- " not the same length as the index")
- ranges.append(k)
+ indexer = _update_indexer(_convert_to_indexer(k), indexer=indexer)
+
elif is_list_like(k):
# a collection of labels to include from this level (these are or'd)
- indexers = []
+ indexers = None
for x in k:
try:
- indexers.append(_convert_indexer(self._get_level_indexer(x, level=i)))
+ idxrs = _convert_to_indexer(self._get_level_indexer(x, level=i, indexer=indexer))
+ indexers = idxrs if indexers is None else indexers | idxrs
except (KeyError):
# ignore not founds
continue
- if len(k):
- ranges.append(reduce(np.logical_or, indexers))
+
+ if indexers is not None:
+ indexer = _update_indexer(indexers, indexer=indexer)
else:
- ranges.append(np.zeros(self.labels[i].shape, dtype=bool))
+
+ # no matches we are done
+ return Int64Index([]).values
elif is_null_slice(k):
# empty slice
- pass
+ indexer = _update_indexer(None, indexer=indexer)
elif isinstance(k,slice):
# a slice, include BOTH of the labels
- ranges.append(self._get_level_indexer(k,level=i))
+ indexer = _update_indexer(_convert_to_indexer(self._get_level_indexer(k,level=i,indexer=indexer)), indexer=indexer)
else:
# a single label
- ranges.append(self.get_loc_level(k,level=i,drop_level=False)[0])
-
- # identity
- if len(ranges) == 0:
- return slice(0,len(self))
-
- elif len(ranges) == 1:
- return ranges[0]
+ indexer = _update_indexer(_convert_to_indexer(self.get_loc_level(k,level=i,drop_level=False)[0]), indexer=indexer)
- # construct a boolean indexer if we have a slice or boolean indexer
- return reduce(np.logical_and,[ _convert_indexer(r) for r in ranges ])
+ # empty indexer
+ if indexer is None:
+ return Int64Index([]).values
+ return indexer.values
def truncate(self, before=None, after=None):
"""
diff --git a/pandas/core/indexing.py b/pandas/core/indexing.py
index 02309e6e4e3b5..6bc505127f872 100644
--- a/pandas/core/indexing.py
+++ b/pandas/core/indexing.py
@@ -509,7 +509,7 @@ def can_do_equal_len():
def _align_series(self, indexer, ser):
# indexer to assign Series can be tuple, slice, scalar
- if isinstance(indexer, (slice, np.ndarray, list)):
+ if isinstance(indexer, (slice, np.ndarray, list, Index)):
indexer = tuple([indexer])
if isinstance(indexer, tuple):
@@ -1719,7 +1719,7 @@ def maybe_convert_ix(*args):
ixify = True
for arg in args:
- if not isinstance(arg, (np.ndarray, list, ABCSeries)):
+ if not isinstance(arg, (np.ndarray, list, ABCSeries, Index)):
ixify = False
if ixify:
diff --git a/pandas/core/series.py b/pandas/core/series.py
index dfbc5dbf84572..d1ddd086bf8b7 100644
--- a/pandas/core/series.py
+++ b/pandas/core/series.py
@@ -19,6 +19,7 @@
is_list_like, _values_from_object,
_possibly_cast_to_datetime, _possibly_castable,
_possibly_convert_platform, _try_sort,
+ is_int64_dtype,
ABCSparseArray, _maybe_match_name,
_coerce_to_dtype, SettingWithCopyError,
_maybe_box_datetimelike, ABCDataFrame,
@@ -2250,17 +2251,22 @@ def isin(self, values):
# may need i8 conversion for proper membership testing
comps = _values_from_object(self)
+ f = lib.ismember
if com.is_datetime64_dtype(self):
from pandas.tseries.tools import to_datetime
values = Series(to_datetime(values)).values.view('i8')
comps = comps.view('i8')
+ f = lib.ismember_int64
elif com.is_timedelta64_dtype(self):
from pandas.tseries.timedeltas import to_timedelta
values = Series(to_timedelta(values)).values.view('i8')
comps = comps.view('i8')
+ f = lib.ismember_int64
+ elif is_int64_dtype(self):
+ f = lib.ismember_int64
value_set = set(values)
- result = lib.ismember(comps, value_set)
+ result = f(comps, value_set)
return self._constructor(result, index=self.index).__finalize__(self)
def between(self, left, right, inclusive=True):
diff --git a/pandas/lib.pyx b/pandas/lib.pyx
index cc4c43494176e..27ba6f953306d 100644
--- a/pandas/lib.pyx
+++ b/pandas/lib.pyx
@@ -156,6 +156,31 @@ def ismember(ndarray arr, set values):
return result.view(np.bool_)
+def ismember_int64(ndarray[int64_t] arr, set values):
+ '''
+ Checks whether
+
+ Parameters
+ ----------
+ arr : ndarray of int64
+ values : set
+
+ Returns
+ -------
+ ismember : ndarray (boolean dtype)
+ '''
+ cdef:
+ Py_ssize_t i, n
+ ndarray[uint8_t] result
+ int64_t v
+
+ n = len(arr)
+ result = np.empty(n, dtype=np.uint8)
+ for i in range(n):
+ result[i] = arr[i] in values
+
+ return result.view(np.bool_)
+
#----------------------------------------------------------------------
# datetime / io related
diff --git a/pandas/tests/test_indexing.py b/pandas/tests/test_indexing.py
index 710367bf04605..94bb2c9f8ea81 100644
--- a/pandas/tests/test_indexing.py
+++ b/pandas/tests/test_indexing.py
@@ -2293,6 +2293,7 @@ def f():
index=pd.MultiIndex.from_product([['A','B','C'],['foo']],
names=['one','two'])
).sortlevel()
+
result = s.loc[idx[:,['foo']]]
assert_series_equal(result,expected)
result = s.loc[idx[:,['foo','bah']]]
@@ -2304,9 +2305,9 @@ def f():
df = DataFrame(np.random.randn(5, 6), index=range(5), columns=multi_index)
df = df.sortlevel(0, axis=1)
+ expected = DataFrame(index=range(5),columns=multi_index.reindex([])[0])
result1 = df.loc[:, ([], slice(None))]
result2 = df.loc[:, (['foo'], [])]
- expected = DataFrame(index=range(5),columns=multi_index.reindex([])[0])
assert_frame_equal(result1, expected)
assert_frame_equal(result2, expected)
diff --git a/pandas/tseries/base.py b/pandas/tseries/base.py
index 15f69b38febce..ae869ce9bd794 100644
--- a/pandas/tseries/base.py
+++ b/pandas/tseries/base.py
@@ -449,7 +449,7 @@ def isin(self, values):
return self.asobject.isin(values)
value_set = set(values.asi8)
- return lib.ismember(self.asi8, value_set)
+ return lib.ismember_int64(self.asi8, value_set)
def shift(self, n, freq=None):
"""
diff --git a/vb_suite/indexing.py b/vb_suite/indexing.py
index 012eb462fcc48..9fbc070ac3b9d 100644
--- a/vb_suite/indexing.py
+++ b/vb_suite/indexing.py
@@ -235,3 +235,33 @@
series_ix_slice = Benchmark("s.ix[:800000]", setup)
series_ix_list_like = Benchmark("s.ix[[800000]]", setup)
series_ix_array = Benchmark("s.ix[np.arange(10000)]", setup)
+
+
+# multi-index slicing
+setup = common_setup + """
+np.random.seed(1234)
+idx=pd.IndexSlice
+n=100000
+mdt = pandas.DataFrame()
+mdt['A'] = np.random.choice(range(10000,45000,1000), n)
+mdt['B'] = np.random.choice(range(10,400), n)
+mdt['C'] = np.random.choice(range(1,150), n)
+mdt['D'] = np.random.choice(range(10000,45000), n)
+mdt['x'] = np.random.choice(range(400), n)
+mdt['y'] = np.random.choice(range(25), n)
+
+
+test_A = 25000
+test_B = 25
+test_C = 40
+test_D = 35000
+
+eps_A = 5000
+eps_B = 5
+eps_C = 5
+eps_D = 5000
+mdt2 = mdt.set_index(['A','B','C','D']).sortlevel()
+"""
+
+multiindex_slicers = Benchmark('mdt2.loc[idx[test_A-eps_A:test_A+eps_A,test_B-eps_B:test_B+eps_B,test_C-eps_C:test_C+eps_C,test_D-eps_D:test_D+eps_D],:]', setup,
+ start_date=datetime(2015, 1, 1))
diff --git a/vb_suite/series_methods.py b/vb_suite/series_methods.py
index 1659340cfe050..d0c31cb04ca6a 100644
--- a/vb_suite/series_methods.py
+++ b/vb_suite/series_methods.py
@@ -7,6 +7,9 @@
setup = common_setup + """
s1 = Series(np.random.randn(10000))
s2 = Series(np.random.randint(1, 10, 10000))
+s3 = Series(np.random.randint(1, 10, 100000)).astype('int64')
+values = [1,2]
+s4 = s3.astype('object')
"""
series_nlargest1 = Benchmark('s1.nlargest(3, take_last=True);'
@@ -27,3 +30,10 @@
's2.nsmallest(3, take_last=False)',
setup,
start_date=datetime(2014, 1, 25))
+
+series_isin_int64 = Benchmark('s3.isin(values)',
+ setup,
+ start_date=datetime(2014, 1, 25))
+series_isin_object = Benchmark('s4.isin(values)',
+ setup,
+ start_date=datetime(2014, 1, 25))
| closes #10287
master
```
In [22]: %timeit mdt2.loc[idx[test_A-eps_A:test_A+eps_A],:].loc[idx[:,test_B-eps_B:test_B+eps_B],:].loc[idx[:,:,test_C-eps_C:test_C+eps_C],:].loc[idx[:,:,:,test_D-eps_D:test_D+eps_D],:]
10 loops, best of 3: 141 ms per loop
In [23]: %timeit mdt2.loc[idx[test_A-eps_A:test_A+eps_A,test_B-eps_B:test_B+eps_B,test_C-eps_C:test_C+eps_C,test_D-eps_D:test_D+eps_D],:]
1 loops, best of 3: 4.23 s per loop
```
PR
```
# this actually is a bit faster in master. but this repeated chain indexing is frowned upon anyhow
In [22]: %timeit mdt2.loc[idx[test_A-eps_A:test_A+eps_A],:].loc[idx[:,test_B-eps_B:test_B+eps_B],:].loc[idx[:,:,test_C-eps_C:test_C+eps_C],:].loc[idx[:,:,:,test_D-eps_D:test_D+eps_D],:]
1 loops, best of 3: 210 ms per loop
# this is the prefered method (as you can set with this and such), and such a huge diff.
In [23]: %timeit mdt2.loc[idx[test_A-eps_A:test_A+eps_A,test_B-eps_B:test_B+eps_B,test_C-eps_C:test_C+eps_C,test_D-eps_D:test_D+eps_D],:]
1 loops, best of 3: 425 ms per loop
```
master
```
In [10]: %timeit s3.isin([1,2])
100 loops, best of 3: 8.83 ms per loop
```
PR
```
In [2]: s3 = Series(np.random.randint(1, 10, 100000)).astype('int64')
In [5]: %timeit s3.isin([1,2])
100 loops, best of 3: 2.47 ms per loop
```
| https://api.github.com/repos/pandas-dev/pandas/pulls/10290 | 2015-06-05T19:16:08Z | 2015-06-24T20:59:59Z | 2015-06-24T20:59:59Z | 2015-06-24T20:59:59Z |
Update v0.16.2.txt | diff --git a/doc/source/whatsnew/v0.16.2.txt b/doc/source/whatsnew/v0.16.2.txt
index a0e1577137e0a..78fa8aac13395 100644
--- a/doc/source/whatsnew/v0.16.2.txt
+++ b/doc/source/whatsnew/v0.16.2.txt
@@ -39,7 +39,9 @@ Backwards incompatible API changes
Other API Changes
^^^^^^^^^^^^^^^^^
-- ``Holiday`` now raises ``NotImplementedError`` if both ``offset`` and ``observance`` are used in constructor instead of returning an incorrect result (:issue:`10217`).
+- ``Holiday`` now raises ``NotImplementedError`` if both ``offset`` and ``observance`` are used in constructor. (:issue:`102171`)
+
+- ``axis`` parameter of method ``DataFrame.quantile`` now accepts also ``index`` and``column``. (:issue:`9543`)
.. _whatsnew_0162.performance:
@@ -57,7 +59,7 @@ Bug Fixes
- Bug where read_hdf store.select modifies the passed columns list when
multi-indexed (:issue:`7212`)
- Bug in ``Categorical`` repr with ``display.width`` of ``None`` in Python 3 (:issue:`10087`)
-
+- Bug in ``DataFrame.quantile``: no check on the value inserted for the ``axis`` parameter (if 'foo' was inserted, no ``ValueError()`` was raised) (:issue:`9543`)
- Bug in groupby.apply aggregation for Categorical not preserving categories (:issue:`10138`)
- Bug in ``mean()`` where integer dtypes can overflow (:issue:`10172`)
- Bug where Panel.from_dict does not set dtype when specified (:issue:`10058`)
@@ -69,7 +71,7 @@ Bug Fixes
- Bug in getting timezone data with ``dateutil`` on various platforms ( :issue:`9059`, :issue:`8639`, :issue:`9663`, :issue:`10121`)
- Bug in display datetimes with mixed frequencies uniformly; display 'ms' datetimes to the proper precision. (:issue:`10170`)
-- Bung in ``Series`` arithmetic methods may incorrectly hold names (:issue:`10068`)
+- Bug in ``Series`` arithmetic methods may incorrectly hold names (:issue:`10068`)
- Bug in ``DatetimeIndex`` and ``TimedeltaIndex`` names are lost after timedelta arithmetics ( :issue:`9926`)
| Added description of Pull Request 9544
| https://api.github.com/repos/pandas-dev/pandas/pulls/10286 | 2015-06-05T09:04:00Z | 2015-06-05T09:16:00Z | null | 2023-05-11T01:13:01Z |
BUG: DataFrame.where does not handle Series slice correctly (#10218) | diff --git a/doc/source/whatsnew/v0.17.0.txt b/doc/source/whatsnew/v0.17.0.txt
index d30b7875e44b7..c1c8f619d3166 100644
--- a/doc/source/whatsnew/v0.17.0.txt
+++ b/doc/source/whatsnew/v0.17.0.txt
@@ -785,3 +785,4 @@ Bug Fixes
- Bug in ``read_msgpack`` where encoding is not respected (:issue:`10580`)
- Bug preventing access to the first index when using ``iloc`` with a list containing the appropriate negative integer (:issue:`10547`, :issue:`10779`)
- Bug in ``TimedeltaIndex`` formatter causing error while trying to save ``DataFrame`` with ``TimedeltaIndex`` using ``to_csv`` (:issue:`10833`)
+- BUG in ``DataFrame.where`` when handling Series slicing (:issue:`10218`, :issue:`9558`)
diff --git a/pandas/core/frame.py b/pandas/core/frame.py
index 1f222f9f99cbe..449ac239cf7d0 100644
--- a/pandas/core/frame.py
+++ b/pandas/core/frame.py
@@ -2596,6 +2596,14 @@ def _reindex_multi(self, axes, copy, fill_value):
copy=copy,
fill_value=fill_value)
+ @Appender(_shared_docs['align'] % _shared_doc_kwargs)
+ def align(self, other, join='outer', axis=None, level=None, copy=True,
+ fill_value=None, method=None, limit=None, fill_axis=0,
+ broadcast_axis=None):
+ return super(DataFrame, self).align(other, join=join, axis=axis, level=level, copy=copy,
+ fill_value=fill_value, method=method, limit=limit,
+ fill_axis=fill_axis, broadcast_axis=broadcast_axis)
+
@Appender(_shared_docs['reindex'] % _shared_doc_kwargs)
def reindex(self, index=None, columns=None, **kwargs):
return super(DataFrame, self).reindex(index=index, columns=columns,
diff --git a/pandas/core/generic.py b/pandas/core/generic.py
index bc49e9dd79e6a..c21d7588ec7d1 100644
--- a/pandas/core/generic.py
+++ b/pandas/core/generic.py
@@ -3447,8 +3447,7 @@ def last(self, offset):
start = self.index.searchsorted(start_date, side='right')
return self.ix[start:]
- def align(self, other, join='outer', axis=None, level=None, copy=True,
- fill_value=None, method=None, limit=None, fill_axis=0):
+ _shared_docs['align'] = (
"""
Align two object on their axes with the
specified join method for each axis Index
@@ -3470,17 +3469,46 @@ def align(self, other, join='outer', axis=None, level=None, copy=True,
"compatible" value
method : str, default None
limit : int, default None
- fill_axis : {0, 1}, default 0
+ fill_axis : %(axes_single_arg)s, default 0
Filling axis, method and limit
+ broadcast_axis : %(axes_single_arg)s, default None
+ Broadcast values along this axis, if aligning two objects of
+ different dimensions
+
+ .. versionadded:: 0.17.0
Returns
-------
- (left, right) : (type of input, type of other)
+ (left, right) : (%(klass)s, type of other)
Aligned objects
"""
+ )
+
+ @Appender(_shared_docs['align'] % _shared_doc_kwargs)
+ def align(self, other, join='outer', axis=None, level=None, copy=True,
+ fill_value=None, method=None, limit=None, fill_axis=0,
+ broadcast_axis=None):
from pandas import DataFrame, Series
method = com._clean_fill_method(method)
+ if broadcast_axis == 1 and self.ndim != other.ndim:
+ if isinstance(self, Series):
+ # this means other is a DataFrame, and we need to broadcast self
+ df = DataFrame(dict((c, self) for c in other.columns),
+ **other._construct_axes_dict())
+ return df._align_frame(other, join=join, axis=axis, level=level,
+ copy=copy, fill_value=fill_value,
+ method=method, limit=limit,
+ fill_axis=fill_axis)
+ elif isinstance(other, Series):
+ # this means self is a DataFrame, and we need to broadcast other
+ df = DataFrame(dict((c, other) for c in self.columns),
+ **self._construct_axes_dict())
+ return self._align_frame(df, join=join, axis=axis, level=level,
+ copy=copy, fill_value=fill_value,
+ method=method, limit=limit,
+ fill_axis=fill_axis)
+
if axis is not None:
axis = self._get_axis_number(axis)
if isinstance(other, DataFrame):
@@ -3516,11 +3544,11 @@ def _align_frame(self, other, join='outer', axis=None, level=None,
self.columns.join(other.columns, how=join, level=level,
return_indexers=True)
- left = self._reindex_with_indexers({0: [join_index, ilidx],
+ left = self._reindex_with_indexers({0: [join_index, ilidx],
1: [join_columns, clidx]},
copy=copy, fill_value=fill_value,
allow_dups=True)
- right = other._reindex_with_indexers({0: [join_index, iridx],
+ right = other._reindex_with_indexers({0: [join_index, iridx],
1: [join_columns, cridx]},
copy=copy, fill_value=fill_value,
allow_dups=True)
@@ -3624,7 +3652,7 @@ def where(self, cond, other=np.nan, inplace=False, axis=None, level=None,
try_cast=False, raise_on_error=True):
if isinstance(cond, NDFrame):
- cond = cond.reindex(**self._construct_axes_dict())
+ cond, _ = cond.align(self, join='right', broadcast_axis=1)
else:
if not hasattr(cond, 'shape'):
raise ValueError('where requires an ndarray like object for '
diff --git a/pandas/core/panel.py b/pandas/core/panel.py
index bc342d5919bb8..919c416c347cd 100644
--- a/pandas/core/panel.py
+++ b/pandas/core/panel.py
@@ -628,6 +628,9 @@ def _needs_reindex_multi(self, axes, method, level):
""" don't allow a multi reindex on Panel or above ndim """
return False
+ def align(self, other, **kwargs):
+ raise NotImplementedError
+
def dropna(self, axis=0, how='any', inplace=False):
"""
Drop 2D from panel, holding passed axis constant
diff --git a/pandas/core/series.py b/pandas/core/series.py
index 8768d0e139e7b..3006984a9915c 100644
--- a/pandas/core/series.py
+++ b/pandas/core/series.py
@@ -2164,6 +2164,14 @@ def _needs_reindex_multi(self, axes, method, level):
"""
return False
+ @Appender(generic._shared_docs['align'] % _shared_doc_kwargs)
+ def align(self, other, join='outer', axis=None, level=None, copy=True,
+ fill_value=None, method=None, limit=None, fill_axis=0,
+ broadcast_axis=None):
+ return super(Series, self).align(other, join=join, axis=axis, level=level, copy=copy,
+ fill_value=fill_value, method=method, limit=limit,
+ fill_axis=fill_axis, broadcast_axis=broadcast_axis)
+
@Appender(generic._shared_docs['rename'] % _shared_doc_kwargs)
def rename(self, index=None, **kwargs):
return super(Series, self).rename(index=index, **kwargs)
diff --git a/pandas/tests/test_frame.py b/pandas/tests/test_frame.py
index 022594e296c2a..a9dedac74add5 100644
--- a/pandas/tests/test_frame.py
+++ b/pandas/tests/test_frame.py
@@ -10065,6 +10065,34 @@ def test_align(self):
self.assertRaises(ValueError, self.frame.align, af.ix[0, :3],
join='inner', axis=2)
+ # align dataframe to series with broadcast or not
+ idx = self.frame.index
+ s = Series(range(len(idx)), index=idx)
+
+ left, right = self.frame.align(s, axis=0)
+ tm.assert_index_equal(left.index, self.frame.index)
+ tm.assert_index_equal(right.index, self.frame.index)
+ self.assertTrue(isinstance(right, Series))
+
+ left, right = self.frame.align(s, broadcast_axis=1)
+ tm.assert_index_equal(left.index, self.frame.index)
+ expected = {}
+ for c in self.frame.columns:
+ expected[c] = s
+ expected = DataFrame(expected, index=self.frame.index,
+ columns=self.frame.columns)
+ assert_frame_equal(right, expected)
+
+ # GH 9558
+ df = DataFrame({'a':[1,2,3], 'b':[4,5,6]})
+ result = df[df['a'] == 2]
+ expected = DataFrame([[2, 5]], index=[1], columns=['a', 'b'])
+ assert_frame_equal(result, expected)
+
+ result = df.where(df['a'] == 2, 0)
+ expected = DataFrame({'a':[0, 2, 0], 'b':[0, 5, 0]})
+ assert_frame_equal(result, expected)
+
def _check_align(self, a, b, axis, fill_axis, how, method, limit=None):
aa, ab = a.align(b, axis=axis, join=how, method=method, limit=limit,
fill_axis=fill_axis)
@@ -10310,6 +10338,13 @@ def _check_set(df, cond, check_dtypes = True):
cond = (df >= 0)[1:]
_check_set(df, cond)
+ # GH 10218
+ # test DataFrame.where with Series slicing
+ df = DataFrame({'a': range(3), 'b': range(4, 7)})
+ result = df.where(df['a'] == 1)
+ expected = df[df['a'] == 1].reindex(df.index)
+ assert_frame_equal(result, expected)
+
def test_where_bug(self):
# GH 2793
| closes #10218
| https://api.github.com/repos/pandas-dev/pandas/pulls/10283 | 2015-06-05T03:00:16Z | 2015-08-26T01:41:14Z | 2015-08-26T01:41:14Z | 2015-08-30T18:08:39Z |
Update holiday.py to reflect that MLK Jr. Day was first observed in 1986. | diff --git a/doc/source/whatsnew/v0.17.0.txt b/doc/source/whatsnew/v0.17.0.txt
index 18c39ccf820eb..edaf0840682f8 100644
--- a/doc/source/whatsnew/v0.17.0.txt
+++ b/doc/source/whatsnew/v0.17.0.txt
@@ -587,8 +587,6 @@ Performance Improvements
Bug Fixes
~~~~~~~~~
-
-
- Bug in ``DataFrame.to_html(index=False)`` renders unnecessary ``name`` row (:issue:`10344`)
- Bug in ``DataFrame.apply`` when function returns categorical series. (:issue:`9573`)
- Bug in ``to_datetime`` with invalid dates and formats supplied (:issue:`10154`)
@@ -602,6 +600,7 @@ Bug Fixes
- Bug in ``offsets.generate_range`` where ``start`` and ``end`` have finer precision than ``offset`` (:issue:`9907`)
- Bug in ``pd.rolling_*`` where ``Series.name`` would be lost in the output (:issue:`10565`)
- Bug in ``stack`` when index or columns are not unique. (:issue:`10417`)
+- Bug in ``USFederalHolidayCalendar`` where ``USMemorialDay`` and ``USMartinLutherKingJr`` were incorrect (:issue:`10278` and :issue:`9760` )
diff --git a/pandas/tests/test_tseries.py b/pandas/tests/test_tseries.py
index f10d541a7e23b..00ba9d1389b71 100644
--- a/pandas/tests/test_tseries.py
+++ b/pandas/tests/test_tseries.py
@@ -9,7 +9,10 @@
import pandas.lib as lib
import pandas._period as period
import pandas.algos as algos
-from pandas.tseries.holiday import Holiday, SA, next_monday
+from pandas.tseries.holiday import Holiday, SA, next_monday,USMartinLutherKingJr,USMemorialDay,AbstractHolidayCalendar
+import datetime
+
+
from pandas import DateOffset
@@ -751,6 +754,28 @@ def test_get_period_field_raises_on_out_of_range(self):
def test_get_period_field_array_raises_on_out_of_range(self):
self.assertRaises(ValueError, period.get_period_field_arr, -1, np.empty(1), 0)
+class TestFederalHolidayCalendar(tm.TestCase):
+ # Test for issue 10278
+ def test_no_mlk_before_1984(self):
+ class MLKCalendar(AbstractHolidayCalendar):
+ rules=[USMartinLutherKingJr]
+ holidays = MLKCalendar().holidays(start='1984', end='1988').to_pydatetime().tolist()
+ # Testing to make sure holiday is not incorrectly observed before 1986
+ self.assertEqual(holidays, [datetime.datetime(1986, 1, 20, 0, 0), datetime.datetime(1987, 1, 19, 0, 0)])
+
+ def test_memorial_day(self):
+ class MemorialDay(AbstractHolidayCalendar):
+ rules=[USMemorialDay]
+ holidays = MemorialDay().holidays(start='1971', end='1980').to_pydatetime().tolist()
+ # Fixes 5/31 error and checked manually against wikipedia
+ self.assertEqual(holidays, [datetime.datetime(1971, 5, 31, 0, 0), datetime.datetime(1972, 5, 29, 0, 0),
+ datetime.datetime(1973, 5, 28, 0, 0), datetime.datetime(1974, 5, 27, 0, 0),
+ datetime.datetime(1975, 5, 26, 0, 0), datetime.datetime(1976, 5, 31, 0, 0),
+ datetime.datetime(1977, 5, 30, 0, 0), datetime.datetime(1978, 5, 29, 0, 0),
+ datetime.datetime(1979, 5, 28, 0, 0)])
+
+
+
class TestHolidayConflictingArguments(tm.TestCase):
diff --git a/pandas/tseries/holiday.py b/pandas/tseries/holiday.py
index f55569302ca05..e98c5dd93e68a 100644
--- a/pandas/tseries/holiday.py
+++ b/pandas/tseries/holiday.py
@@ -405,15 +405,15 @@ def merge(self, other, inplace=False):
else:
return holidays
-USMemorialDay = Holiday('MemorialDay', month=5, day=24,
- offset=DateOffset(weekday=MO(1)))
+USMemorialDay = Holiday('MemorialDay', month=5, day=31,
+ offset=DateOffset(weekday=MO(-1)))
USLaborDay = Holiday('Labor Day', month=9, day=1,
offset=DateOffset(weekday=MO(1)))
USColumbusDay = Holiday('Columbus Day', month=10, day=1,
offset=DateOffset(weekday=MO(2)))
USThanksgivingDay = Holiday('Thanksgiving', month=11, day=1,
offset=DateOffset(weekday=TH(4)))
-USMartinLutherKingJr = Holiday('Dr. Martin Luther King Jr.', month=1, day=1,
+USMartinLutherKingJr = Holiday('Dr. Martin Luther King Jr.', start_date=datetime(1986,1,1), month=1, day=1,
offset=DateOffset(weekday=MO(3)))
USPresidentsDay = Holiday('President''s Day', month=2, day=1,
offset=DateOffset(weekday=MO(3)))
| closes #9760
Fixing MLK day not observed before 1986, per https://github.com/pydata/pandas/issues/10278#issuecomment-109002244
| https://api.github.com/repos/pandas-dev/pandas/pulls/10282 | 2015-06-04T20:34:51Z | 2015-08-18T11:09:17Z | null | 2015-08-18T16:58:13Z |
PERF/CLN: Improve datetime-like index ops perf | diff --git a/doc/source/whatsnew/v0.18.0.txt b/doc/source/whatsnew/v0.18.0.txt
index c1b7ff82f4c76..6db2cb409df85 100644
--- a/doc/source/whatsnew/v0.18.0.txt
+++ b/doc/source/whatsnew/v0.18.0.txt
@@ -139,6 +139,8 @@ Performance Improvements
- Improved performance of ``andrews_curves`` (:issue:`11534`)
+- Improved huge ``DatetimeIndex``, ``PeriodIndex`` and ``TimedeltaIndex``'s ops performance including ``NaT`` (:issue:`10277`)
+
diff --git a/pandas/tseries/base.py b/pandas/tseries/base.py
index 4f0780ef2d660..ed9bf8d3862ce 100644
--- a/pandas/tseries/base.py
+++ b/pandas/tseries/base.py
@@ -281,12 +281,11 @@ def _maybe_mask_results(self, result, fill_value=None, convert=None):
"""
if self.hasnans:
- mask = self.asi8 == tslib.iNaT
if convert:
result = result.astype(convert)
if fill_value is None:
fill_value = np.nan
- result[mask] = fill_value
+ result[self._isnan] = fill_value
return result
def tolist(self):
@@ -312,8 +311,7 @@ def min(self, axis=None):
return self._box_func(i8[0])
if self.hasnans:
- mask = i8 == tslib.iNaT
- min_stamp = i8[~mask].min()
+ min_stamp = self[~self._isnan].asi8.min()
else:
min_stamp = i8.min()
return self._box_func(min_stamp)
@@ -331,7 +329,7 @@ def argmin(self, axis=None):
i8 = self.asi8
if self.hasnans:
- mask = i8 == tslib.iNaT
+ mask = self._isnan
if mask.all():
return -1
i8 = i8.copy()
@@ -355,8 +353,7 @@ def max(self, axis=None):
return self._box_func(i8[-1])
if self.hasnans:
- mask = i8 == tslib.iNaT
- max_stamp = i8[~mask].max()
+ max_stamp = self[~self._isnan].asi8.max()
else:
max_stamp = i8.max()
return self._box_func(max_stamp)
@@ -374,7 +371,7 @@ def argmax(self, axis=None):
i8 = self.asi8
if self.hasnans:
- mask = i8 == tslib.iNaT
+ mask = self._isnan
if mask.all():
return -1
i8 = i8.copy()
@@ -498,9 +495,9 @@ def _add_delta_td(self, other):
# return the i8 result view
inc = tslib._delta_to_nanoseconds(other)
- mask = self.asi8 == tslib.iNaT
new_values = (self.asi8 + inc).view('i8')
- new_values[mask] = tslib.iNaT
+ if self.hasnans:
+ new_values[self._isnan] = tslib.iNaT
return new_values.view('i8')
def _add_delta_tdi(self, other):
@@ -513,9 +510,10 @@ def _add_delta_tdi(self, other):
self_i8 = self.asi8
other_i8 = other.asi8
- mask = (self_i8 == tslib.iNaT) | (other_i8 == tslib.iNaT)
new_values = self_i8 + other_i8
- new_values[mask] = tslib.iNaT
+ if self.hasnans or other.hasnans:
+ mask = (self._isnan) | (other._isnan)
+ new_values[mask] = tslib.iNaT
return new_values.view(self.dtype)
def isin(self, values):
diff --git a/pandas/tseries/index.py b/pandas/tseries/index.py
index 88816fd0c0dad..14acfb57afe56 100644
--- a/pandas/tseries/index.py
+++ b/pandas/tseries/index.py
@@ -93,9 +93,8 @@ def wrapper(self, other):
if o_mask.any():
result[o_mask] = nat_result
- mask = self.asi8 == tslib.iNaT
- if mask.any():
- result[mask] = nat_result
+ if self.hasnans:
+ result[self._isnan] = nat_result
# support of bool dtype indexers
if com.is_bool_dtype(result):
diff --git a/pandas/tseries/period.py b/pandas/tseries/period.py
index 3f4bba0344ca0..534804900c5e6 100644
--- a/pandas/tseries/period.py
+++ b/pandas/tseries/period.py
@@ -589,9 +589,9 @@ def shift(self, n):
-------
shifted : PeriodIndex
"""
- mask = self.values == tslib.iNaT
values = self.values + n * self.freq.n
- values[mask] = tslib.iNaT
+ if self.hasnans:
+ values[self._isnan] = tslib.iNaT
return PeriodIndex(data=values, name=self.name, freq=self.freq)
@cache_readonly
diff --git a/pandas/tseries/tdi.py b/pandas/tseries/tdi.py
index 3f884ee32dd76..ea61e4f247e58 100644
--- a/pandas/tseries/tdi.py
+++ b/pandas/tseries/tdi.py
@@ -51,9 +51,8 @@ def wrapper(self, other):
if o_mask.any():
result[o_mask] = nat_result
- mask = self.asi8 == tslib.iNaT
- if mask.any():
- result[mask] = nat_result
+ if self.hasnans:
+ result[self._isnan] = nat_result
# support of bool dtype indexers
if com.is_bool_dtype(result):
@@ -334,7 +333,7 @@ def _get_field(self, m):
hasnans = self.hasnans
if hasnans:
result = np.empty(len(self), dtype='float64')
- mask = values == tslib.iNaT
+ mask = self._isnan
imask = ~mask
result.flat[imask] = np.array([ getattr(Timedelta(val),m) for val in values[imask] ])
result[mask] = np.nan
diff --git a/pandas/tseries/tests/test_base.py b/pandas/tseries/tests/test_base.py
index 4d353eccba972..bf37bd4afe1da 100644
--- a/pandas/tseries/tests/test_base.py
+++ b/pandas/tseries/tests/test_base.py
@@ -124,6 +124,8 @@ def test_minmax(self):
for idx in [idx1, idx2]:
self.assertEqual(idx.min(), pd.Timestamp('2011-01-01', tz=tz))
self.assertEqual(idx.max(), pd.Timestamp('2011-01-03', tz=tz))
+ self.assertEqual(idx.argmin(), 0)
+ self.assertEqual(idx.argmax(), 2)
for op in ['min', 'max']:
# Return NaT
@@ -579,6 +581,8 @@ def test_minmax(self):
for idx in [idx1, idx2]:
self.assertEqual(idx.min(), Timedelta('1 days')),
self.assertEqual(idx.max(), Timedelta('3 days')),
+ self.assertEqual(idx.argmin(), 0)
+ self.assertEqual(idx.argmax(), 2)
for op in ['min', 'max']:
# Return NaT
@@ -1209,6 +1213,10 @@ def test_minmax(self):
for idx in [idx1, idx2]:
self.assertEqual(idx.min(), pd.Period('2011-01-01', freq='D'))
self.assertEqual(idx.max(), pd.Period('2011-01-03', freq='D'))
+ self.assertEqual(idx1.argmin(), 1)
+ self.assertEqual(idx2.argmin(), 0)
+ self.assertEqual(idx1.argmax(), 3)
+ self.assertEqual(idx2.argmax(), 2)
for op in ['min', 'max']:
# Return NaT
| Add `_isnan` to `DatetimeIndexOpsMixin` to cache `NaT` mask.
This leads to some perf improvement which is noticeable in larger data.
### after fix
```
import pandas as pd
import numpy as np
np.random.seed(1)
idx = pd.DatetimeIndex(np.append(np.array([pd.tslib.iNaT]),
np.random.randint(500, 1000, size=100000000)))
%timeit idx.max()
1 loops, best of 3: 599 ms per loop
%timeit idx.min()
1 loops, best of 3: 608 ms per loop
```
### before fix:
```
%timeit idx.max()
1 loops, best of 3: 940 ms per loop
%timeit idx.min()
1 loops, best of 3: 883 ms per loop
```
| https://api.github.com/repos/pandas-dev/pandas/pulls/10277 | 2015-06-04T15:19:00Z | 2015-12-10T12:22:48Z | 2015-12-10T12:22:48Z | 2022-10-13T00:16:35Z |
TST: Check series names | diff --git a/pandas/computation/tests/test_eval.py b/pandas/computation/tests/test_eval.py
index 0c07dc5c214b4..8f82e2eaea711 100644
--- a/pandas/computation/tests/test_eval.py
+++ b/pandas/computation/tests/test_eval.py
@@ -1207,7 +1207,9 @@ def f():
a = 1
old_a = df.a.copy()
df.eval('a = a + b')
- assert_series_equal(old_a + df.b, df.a)
+ result = old_a + df.b
+ assert_series_equal(result, df.a, check_names=False)
+ self.assertTrue(result.name is None)
f()
@@ -1251,7 +1253,7 @@ def test_date_boolean(self):
res = self.eval('df.dates1 < 20130101', local_dict={'df': df},
engine=self.engine, parser=self.parser)
expec = df.dates1 < '20130101'
- assert_series_equal(res, expec)
+ assert_series_equal(res, expec, check_names=False)
def test_simple_in_ops(self):
if self.parser != 'python':
diff --git a/pandas/io/tests/test_json/test_pandas.py b/pandas/io/tests/test_json/test_pandas.py
index 26fae0717f956..39f645aef0154 100644
--- a/pandas/io/tests/test_json/test_pandas.py
+++ b/pandas/io/tests/test_json/test_pandas.py
@@ -409,12 +409,10 @@ def _check_orient(series, orient, dtype=None, numpy=False):
if orient == "records" or orient == "values":
assert_almost_equal(series.values, unser.values)
else:
- try:
- assert_series_equal(series, unser)
- except:
- raise
if orient == "split":
- self.assertEqual(series.name, unser.name)
+ assert_series_equal(series, unser)
+ else:
+ assert_series_equal(series, unser, check_names=False)
def _check_all_orients(series, dtype=None):
_check_orient(series, "columns", dtype=dtype)
@@ -491,7 +489,8 @@ def test_axis_dates(self):
# series
json = self.ts.to_json()
result = read_json(json, typ='series')
- assert_series_equal(result, self.ts)
+ assert_series_equal(result, self.ts, check_names=False)
+ self.assertTrue(result.name is None)
def test_convert_dates(self):
diff --git a/pandas/io/tests/test_parsers.py b/pandas/io/tests/test_parsers.py
index 7d52c6ad4cb3b..1177149e7efa6 100755
--- a/pandas/io/tests/test_parsers.py
+++ b/pandas/io/tests/test_parsers.py
@@ -272,7 +272,8 @@ def test_squeeze(self):
b,2
c,3
"""
- expected = Series([1, 2, 3], index=Index(['a', 'b', 'c'], name=0))
+ idx = Index(['a', 'b', 'c'], name=0)
+ expected = Series([1, 2, 3], name=1, index=idx)
result = self.read_table(StringIO(data), sep=',', index_col=0,
header=None, squeeze=True)
tm.assert_isinstance(result, Series)
@@ -2638,7 +2639,7 @@ def test_iteration_open_handle(self):
result = read_table(f, squeeze=True, header=None,
engine='python')
- expected = Series(['DDD', 'EEE', 'FFF', 'GGG'])
+ expected = Series(['DDD', 'EEE', 'FFF', 'GGG'], name=0)
tm.assert_series_equal(result, expected)
def test_iterator(self):
diff --git a/pandas/io/tests/test_sql.py b/pandas/io/tests/test_sql.py
index 9576f80696350..54d53c909d9ca 100644
--- a/pandas/io/tests/test_sql.py
+++ b/pandas/io/tests/test_sql.py
@@ -1256,7 +1256,7 @@ def test_transactions(self):
self._transaction_test()
def test_get_schema_create_table(self):
- # Use a dataframe without a bool column, since MySQL converts bool to
+ # Use a dataframe without a bool column, since MySQL converts bool to
# TINYINT (which read_sql_table returns as an int and causes a dtype
# mismatch)
@@ -2025,7 +2025,7 @@ def test_tquery(self):
frame = tm.makeTimeDataFrame()
sql.write_frame(frame, name='test_table', con=self.db)
result = sql.tquery("select A from test_table", self.db)
- expected = Series(frame.A, frame.index) # not to have name
+ expected = Series(frame.A.values, frame.index) # not to have name
result = Series(result, frame.index)
tm.assert_series_equal(result, expected)
@@ -2370,7 +2370,7 @@ def test_tquery(self):
cur.execute(drop_sql)
sql.write_frame(frame, name='test_table', con=self.db, flavor='mysql')
result = sql.tquery("select A from test_table", self.db)
- expected = Series(frame.A, frame.index) # not to have name
+ expected = Series(frame.A.values, frame.index) # not to have name
result = Series(result, frame.index)
tm.assert_series_equal(result, expected)
diff --git a/pandas/sparse/tests/test_sparse.py b/pandas/sparse/tests/test_sparse.py
index 96e5ff87fbb0c..b506758355228 100644
--- a/pandas/sparse/tests/test_sparse.py
+++ b/pandas/sparse/tests/test_sparse.py
@@ -12,7 +12,8 @@
dec = np.testing.dec
from pandas.util.testing import (assert_almost_equal, assert_series_equal,
- assert_frame_equal, assert_panel_equal, assertRaisesRegexp, assert_array_equal)
+ assert_frame_equal, assert_panel_equal, assertRaisesRegexp,
+ assert_array_equal, assert_attr_equal)
from numpy.testing import assert_equal
from pandas import Series, DataFrame, bdate_range, Panel, MultiIndex
@@ -76,9 +77,11 @@ def _test_data2_zero():
return arr, index
-def assert_sp_series_equal(a, b, exact_indices=True):
+def assert_sp_series_equal(a, b, exact_indices=True, check_names=True):
assert(a.index.equals(b.index))
assert_sp_array_equal(a, b)
+ if check_names:
+ assert_attr_equal('name', a, b)
def assert_sp_frame_equal(left, right, exact_indices=True):
@@ -130,7 +133,6 @@ def setUp(self):
self.bseries = SparseSeries(arr, index=index, kind='block',
name='bseries')
-
self.ts = self.bseries
self.btseries = SparseSeries(arr, index=date_index, kind='block')
@@ -168,10 +170,10 @@ def test_construct_DataFrame_with_sp_series(self):
df.dtypes
str(df)
- assert_sp_series_equal(df['col'], self.bseries)
+ assert_sp_series_equal(df['col'], self.bseries, check_names=False)
result = df.iloc[:, 0]
- assert_sp_series_equal(result, self.bseries)
+ assert_sp_series_equal(result, self.bseries, check_names=False)
# blocking
expected = Series({'col': 'float64:sparse'})
@@ -209,14 +211,16 @@ def test_dense_to_sparse(self):
bseries = series.to_sparse(kind='block')
iseries = series.to_sparse(kind='integer')
assert_sp_series_equal(bseries, self.bseries)
- assert_sp_series_equal(iseries, self.iseries)
+ assert_sp_series_equal(iseries, self.iseries, check_names=False)
+ self.assertEqual(iseries.name, self.bseries.name)
# non-NaN fill value
series = self.zbseries.to_dense()
zbseries = series.to_sparse(kind='block', fill_value=0)
ziseries = series.to_sparse(kind='integer', fill_value=0)
assert_sp_series_equal(zbseries, self.zbseries)
- assert_sp_series_equal(ziseries, self.ziseries)
+ assert_sp_series_equal(ziseries, self.ziseries, check_names=False)
+ self.assertEqual(ziseries.name, self.zbseries.name)
def test_to_dense_preserve_name(self):
assert(self.bseries.name is not None)
@@ -244,7 +248,7 @@ def _check_const(sparse, name):
# use passed name
result = SparseSeries(sparse, name='x')
- assert_sp_series_equal(result, sparse)
+ assert_sp_series_equal(result, sparse, check_names=False)
self.assertEqual(result.name, 'x')
_check_const(self.bseries, 'bseries')
@@ -1301,7 +1305,7 @@ def _check_frame(frame):
# insert SparseSeries
frame['E'] = frame['A']
tm.assert_isinstance(frame['E'], SparseSeries)
- assert_sp_series_equal(frame['E'], frame['A'])
+ assert_sp_series_equal(frame['E'], frame['A'], check_names=False)
# insert SparseSeries differently-indexed
to_insert = frame['A'][::2]
@@ -1315,13 +1319,14 @@ def _check_frame(frame):
# insert Series
frame['F'] = frame['A'].to_dense()
tm.assert_isinstance(frame['F'], SparseSeries)
- assert_sp_series_equal(frame['F'], frame['A'])
+ assert_sp_series_equal(frame['F'], frame['A'], check_names=False)
# insert Series differently-indexed
to_insert = frame['A'].to_dense()[::2]
frame['G'] = to_insert
expected = to_insert.reindex(
frame.index).fillna(frame.default_fill_value)
+ expected.name = 'G'
assert_series_equal(frame['G'].to_dense(), expected)
# insert ndarray
@@ -1349,18 +1354,18 @@ def _check_frame(frame):
def test_setitem_corner(self):
self.frame['a'] = self.frame['B']
- assert_sp_series_equal(self.frame['a'], self.frame['B'])
+ assert_sp_series_equal(self.frame['a'], self.frame['B'], check_names=False)
def test_setitem_array(self):
arr = self.frame['B']
self.frame['E'] = arr
- assert_sp_series_equal(self.frame['E'], self.frame['B'])
+ assert_sp_series_equal(self.frame['E'], self.frame['B'], check_names=False)
self.frame['F'] = arr[:-1]
index = self.frame.index[:-1]
- assert_sp_series_equal(
- self.frame['E'].reindex(index), self.frame['F'].reindex(index))
+ assert_sp_series_equal(self.frame['E'].reindex(index),
+ self.frame['F'].reindex(index), check_names=False)
def test_delitem(self):
A = self.frame['A']
diff --git a/pandas/tests/test_categorical.py b/pandas/tests/test_categorical.py
index 21b64378cfc24..bec688db99114 100755
--- a/pandas/tests/test_categorical.py
+++ b/pandas/tests/test_categorical.py
@@ -1233,7 +1233,7 @@ def test_codes_dtypes(self):
def test_basic(self):
# test basic creation / coercion of categoricals
- s = Series(self.factor,name='A')
+ s = Series(self.factor, name='A')
self.assertEqual(s.dtype,'category')
self.assertEqual(len(s),len(self.factor))
str(s.values)
@@ -1260,8 +1260,9 @@ def test_basic(self):
df = DataFrame({'A' : s, 'B' : s, 'C' : 1})
result1 = df['A']
result2 = df['B']
- tm.assert_series_equal(result1,s)
- tm.assert_series_equal(result2,s)
+ tm.assert_series_equal(result1, s)
+ tm.assert_series_equal(result2, s, check_names=False)
+ self.assertEqual(result2.name, 'B')
self.assertEqual(len(df),len(self.factor))
str(df.values)
str(df)
@@ -1344,23 +1345,23 @@ def test_construction_frame(self):
# GH8626
# dict creation
- df = DataFrame({ 'A' : list('abc') },dtype='category')
- expected = Series(list('abc'),dtype='category')
- tm.assert_series_equal(df['A'],expected)
+ df = DataFrame({ 'A' : list('abc') }, dtype='category')
+ expected = Series(list('abc'), dtype='category', name='A')
+ tm.assert_series_equal(df['A'], expected)
# to_frame
- s = Series(list('abc'),dtype='category')
+ s = Series(list('abc'), dtype='category')
result = s.to_frame()
- expected = Series(list('abc'),dtype='category')
- tm.assert_series_equal(result[0],expected)
+ expected = Series(list('abc'), dtype='category', name=0)
+ tm.assert_series_equal(result[0], expected)
result = s.to_frame(name='foo')
- expected = Series(list('abc'),dtype='category')
- tm.assert_series_equal(result['foo'],expected)
+ expected = Series(list('abc'), dtype='category', name='foo')
+ tm.assert_series_equal(result['foo'], expected)
# list-like creation
- df = DataFrame(list('abc'),dtype='category')
- expected = Series(list('abc'),dtype='category')
- tm.assert_series_equal(df[0],expected)
+ df = DataFrame(list('abc'), dtype='category')
+ expected = Series(list('abc'), dtype='category', name=0)
+ tm.assert_series_equal(df[0], expected)
# ndim != 1
df = DataFrame([pd.Categorical(list('abc'))])
@@ -1833,7 +1834,11 @@ def f(x):
# Monotonic
df = DataFrame({"a": [5, 15, 25]})
c = pd.cut(df.a, bins=[0,10,20,30,40])
- tm.assert_series_equal(df.a.groupby(c).transform(sum), df['a'])
+
+ result = df.a.groupby(c).transform(sum)
+ tm.assert_series_equal(result, df['a'], check_names=False)
+ self.assertTrue(result.name is None)
+
tm.assert_series_equal(df.a.groupby(c).transform(lambda xs: np.sum(xs)), df['a'])
tm.assert_frame_equal(df.groupby(c).transform(sum), df[['a']])
tm.assert_frame_equal(df.groupby(c).transform(lambda xs: np.max(xs)), df[['a']])
@@ -1845,7 +1850,11 @@ def f(x):
# Non-monotonic
df = DataFrame({"a": [5, 15, 25, -5]})
c = pd.cut(df.a, bins=[-10, 0,10,20,30,40])
- tm.assert_series_equal(df.a.groupby(c).transform(sum), df['a'])
+
+ result = df.a.groupby(c).transform(sum)
+ tm.assert_series_equal(result, df['a'], check_names=False)
+ self.assertTrue(result.name is None)
+
tm.assert_series_equal(df.a.groupby(c).transform(lambda xs: np.sum(xs)), df['a'])
tm.assert_frame_equal(df.groupby(c).transform(sum), df[['a']])
tm.assert_frame_equal(df.groupby(c).transform(lambda xs: np.sum(xs)), df[['a']])
@@ -1983,19 +1992,19 @@ def test_slicing(self):
df = DataFrame({'value': (np.arange(100)+1).astype('int64')})
df['D'] = pd.cut(df.value, bins=[0,25,50,75,100])
- expected = Series([11,'(0, 25]'],index=['value','D'])
+ expected = Series([11,'(0, 25]'], index=['value','D'], name=10)
result = df.iloc[10]
- tm.assert_series_equal(result,expected)
+ tm.assert_series_equal(result, expected)
expected = DataFrame({'value': np.arange(11,21).astype('int64')},
index=np.arange(10,20).astype('int64'))
expected['D'] = pd.cut(expected.value, bins=[0,25,50,75,100])
result = df.iloc[10:20]
- tm.assert_frame_equal(result,expected)
+ tm.assert_frame_equal(result, expected)
- expected = Series([9,'(0, 25]'],index=['value','D'])
+ expected = Series([9,'(0, 25]'],index=['value', 'D'], name=8)
result = df.loc[8]
- tm.assert_series_equal(result,expected)
+ tm.assert_series_equal(result, expected)
def test_slicing_and_getting_ops(self):
@@ -2151,7 +2160,8 @@ def test_slicing_doc_examples(self):
tm.assert_series_equal(result, expected)
result = df.loc["h":"j","cats"]
- expected = Series(Categorical(['a','b','b'],categories=['a','b','c']),index=['h','i','j'])
+ expected = Series(Categorical(['a','b','b'], name='cats',
+ categories=['a','b','c']), index=['h','i','j'])
tm.assert_series_equal(result, expected)
result = df.ix["h":"j",0:1]
@@ -2832,21 +2842,21 @@ def test_to_records(self):
# GH8626
# dict creation
- df = DataFrame({ 'A' : list('abc') },dtype='category')
- expected = Series(list('abc'),dtype='category')
- tm.assert_series_equal(df['A'],expected)
+ df = DataFrame({ 'A' : list('abc') }, dtype='category')
+ expected = Series(list('abc'), dtype='category', name='A')
+ tm.assert_series_equal(df['A'], expected)
# list-like creation
- df = DataFrame(list('abc'),dtype='category')
- expected = Series(list('abc'),dtype='category')
- tm.assert_series_equal(df[0],expected)
+ df = DataFrame(list('abc'), dtype='category')
+ expected = Series(list('abc'), dtype='category', name=0)
+ tm.assert_series_equal(df[0], expected)
# to record array
# this coerces
result = df.to_records()
expected = np.rec.array([(0, 'a'), (1, 'b'), (2, 'c')],
dtype=[('index', '<i8'), ('0', 'O')])
- tm.assert_almost_equal(result,expected)
+ tm.assert_almost_equal(result, expected)
def test_numeric_like_ops(self):
diff --git a/pandas/tests/test_frame.py b/pandas/tests/test_frame.py
index f74cb07557342..33614b7d87c0f 100644
--- a/pandas/tests/test_frame.py
+++ b/pandas/tests/test_frame.py
@@ -189,8 +189,8 @@ def test_setitem_list(self):
data = self.frame[['A', 'B']]
self.frame[['B', 'A']] = data
- assert_series_equal(self.frame['B'], data['A'])
- assert_series_equal(self.frame['A'], data['B'])
+ assert_series_equal(self.frame['B'], data['A'], check_names=False)
+ assert_series_equal(self.frame['A'], data['B'], check_names=False)
with assertRaisesRegexp(ValueError, 'Columns must be same length as key'):
data[['A']] = self.frame[['A', 'B']]
@@ -202,13 +202,13 @@ def test_setitem_list(self):
df.ix[1, ['tt1', 'tt2']] = [1, 2]
result = df.ix[1, ['tt1', 'tt2']]
- expected = Series([1, 2], df.columns, dtype=np.int_)
+ expected = Series([1, 2], df.columns, dtype=np.int_, name=1)
assert_series_equal(result, expected)
df['tt1'] = df['tt2'] = '0'
df.ix[1, ['tt1', 'tt2']] = ['1', '2']
result = df.ix[1, ['tt1', 'tt2']]
- expected = Series(['1', '2'], df.columns)
+ expected = Series(['1', '2'], df.columns, name=1)
assert_series_equal(result, expected)
def test_setitem_list_not_dataframe(self):
@@ -221,7 +221,7 @@ def test_setitem_list_of_tuples(self):
self.frame['tuples'] = tuples
result = self.frame['tuples']
- expected = Series(tuples, index=self.frame.index)
+ expected = Series(tuples, index=self.frame.index, name='tuples')
assert_series_equal(result, expected)
def test_setitem_mulit_index(self):
@@ -505,7 +505,9 @@ def test_getitem_setitem_ix_negative_integers(self):
a = DataFrame(randn(20, 2), index=[chr(x + 65) for x in range(20)])
a.ix[-1] = a.ix[-2]
- assert_series_equal(a.ix[-1], a.ix[-2])
+ assert_series_equal(a.ix[-1], a.ix[-2], check_names=False)
+ self.assertEqual(a.ix[-1].name, 'T')
+ self.assertEqual(a.ix[-2].name, 'S')
def test_getattr(self):
tm.assert_series_equal(self.frame.A, self.frame['A'])
@@ -574,7 +576,7 @@ def f():
def test_setitem_tuple(self):
self.frame['A', 'B'] = self.frame['A']
- assert_series_equal(self.frame['A', 'B'], self.frame['A'])
+ assert_series_equal(self.frame['A', 'B'], self.frame['A'], check_names=False)
def test_setitem_always_copy(self):
s = self.frame['A'].copy()
@@ -772,16 +774,16 @@ def test_setitem_clear_caches(self):
df.ix[2:, 'z'] = 42
- expected = Series([np.nan, np.nan, 42, 42], index=df.index)
+ expected = Series([np.nan, np.nan, 42, 42], index=df.index, name='z')
self.assertIsNot(df['z'], foo)
assert_series_equal(df['z'], expected)
def test_setitem_None(self):
# GH #766
self.frame[None] = self.frame['A']
- assert_series_equal(self.frame.iloc[:,-1], self.frame['A'])
- assert_series_equal(self.frame.loc[:,None], self.frame['A'])
- assert_series_equal(self.frame[None], self.frame['A'])
+ assert_series_equal(self.frame.iloc[:,-1], self.frame['A'], check_names=False)
+ assert_series_equal(self.frame.loc[:,None], self.frame['A'], check_names=False)
+ assert_series_equal(self.frame[None], self.frame['A'], check_names=False)
repr(self.frame)
def test_setitem_empty(self):
@@ -1077,7 +1079,8 @@ def test_setitem_fancy_mixed_2d(self):
self.assertTrue(isnull(self.mixed_frame.ix[5]).all())
self.mixed_frame.ix[5] = self.mixed_frame.ix[6]
- assert_series_equal(self.mixed_frame.ix[5], self.mixed_frame.ix[6])
+ assert_series_equal(self.mixed_frame.ix[5], self.mixed_frame.ix[6],
+ check_names=False)
# #1432
df = DataFrame({1: [1., 2., 3.],
@@ -1092,7 +1095,7 @@ def test_setitem_fancy_mixed_2d(self):
assert_frame_equal(df, expected)
def test_ix_align(self):
- b = Series(randn(10))
+ b = Series(randn(10), name=0)
b.sort()
df_orig = DataFrame(randn(10, 4))
df = df_orig.copy()
@@ -2040,14 +2043,15 @@ def test_setitem_with_sparse_value(self):
df = pd.DataFrame({'c_1':['a', 'b', 'c'], 'n_1': [1., 2., 3.]})
sp_series = pd.Series([0, 0, 1]).to_sparse(fill_value=0)
df['new_column'] = sp_series
- tm.assert_series_equal(df['new_column'], sp_series)
+ tm.assert_series_equal(df['new_column'], sp_series, check_names=False)
def test_setitem_with_unaligned_sparse_value(self):
df = pd.DataFrame({'c_1':['a', 'b', 'c'], 'n_1': [1., 2., 3.]})
sp_series = (pd.Series([0, 0, 1], index=[2, 1, 0])
.to_sparse(fill_value=0))
df['new_column'] = sp_series
- tm.assert_series_equal(df['new_column'], pd.Series([1, 0, 0]))
+ exp = pd.Series([1, 0, 0], name='new_column')
+ tm.assert_series_equal(df['new_column'], exp)
_seriesd = tm.getSeriesData()
@@ -2452,7 +2456,8 @@ def test_set_index_cast_datetimeindex(self):
# assignt to frame
df['B'] = i
result = df['B']
- assert_series_equal(result, expected)
+ assert_series_equal(result, expected, check_names=False)
+ self.assertEqual(result.name, 'B')
# keep the timezone
result = i.to_series(keep_tz=True)
@@ -2468,7 +2473,8 @@ def test_set_index_cast_datetimeindex(self):
# list of datetimes with a tz
df['D'] = i.to_pydatetime()
result = df['D']
- assert_series_equal(result, expected)
+ assert_series_equal(result, expected, check_names=False)
+ self.assertEqual(result.name, 'D')
# GH 6785
# set the index manually
@@ -5929,7 +5935,13 @@ def test_combineSeries(self):
added = self.tsframe + ts
for key, col in compat.iteritems(self.tsframe):
- assert_series_equal(added[key], col + ts)
+ result = col + ts
+ assert_series_equal(added[key], result, check_names=False)
+ self.assertEqual(added[key].name, key)
+ if col.name == ts.name:
+ self.assertEqual(result.name, 'A')
+ else:
+ self.assertTrue(result.name is None)
smaller_frame = self.tsframe[:-5]
smaller_added = smaller_frame + ts
@@ -7592,7 +7604,7 @@ def test_dropEmptyRows(self):
mat[:5] = nan
frame = DataFrame({'foo': mat}, index=self.frame.index)
- original = Series(mat, index=self.frame.index)
+ original = Series(mat, index=self.frame.index, name='foo')
expected = original.dropna()
inplace_frame1, inplace_frame2 = frame.copy(), frame.copy()
@@ -7615,7 +7627,7 @@ def test_dropIncompleteRows(self):
frame = DataFrame({'foo': mat}, index=self.frame.index)
frame['bar'] = 5
- original = Series(mat, index=self.frame.index)
+ original = Series(mat, index=self.frame.index, name='foo')
inp_frame1, inp_frame2 = frame.copy(), frame.copy()
smaller_frame = frame.dropna()
@@ -7692,8 +7704,8 @@ def test_dropna(self):
def test_drop_and_dropna_caching(self):
# tst that cacher updates
- original = Series([1, 2, np.nan])
- expected = Series([1, 2], dtype=original.dtype)
+ original = Series([1, 2, np.nan], name='A')
+ expected = Series([1, 2], dtype=original.dtype, name='A')
df = pd.DataFrame({'A': original.values.copy()})
df2 = df.copy()
df['A'].dropna()
@@ -9299,7 +9311,7 @@ def test_xs_corner(self):
# no columns but index
df = DataFrame(index=['a', 'b', 'c'])
result = df.xs('a')
- expected = Series([])
+ expected = Series([], name='a')
assert_series_equal(result, expected)
def test_xs_duplicates(self):
@@ -9738,7 +9750,8 @@ def _check_get(df, cond, check_dtypes = True):
rs = df.where(cond, other1)
rs2 = df.where(cond.values, other1)
for k, v in rs.iteritems():
- assert_series_equal(v, Series(np.where(cond[k], df[k], other1[k]),index=v.index))
+ exp = Series(np.where(cond[k], df[k], other1[k]),index=v.index)
+ assert_series_equal(v, exp, check_names=False)
assert_frame_equal(rs, rs2)
# dtypes
@@ -9779,7 +9792,7 @@ def _check_align(df, cond, other, check_dtypes = True):
o = other[k].values
new_values = d if c.all() else np.where(c, d, o)
- expected = Series(new_values,index=result.index)
+ expected = Series(new_values, index=result.index, name=k)
# since we can't always have the correct numpy dtype
# as numpy doesn't know how to downcast, don't check
@@ -10226,7 +10239,7 @@ def test_shift(self):
d = self.tsframe.index[0]
shifted_d = d + datetools.BDay(5)
assert_series_equal(self.tsframe.xs(d),
- shiftedFrame.xs(shifted_d))
+ shiftedFrame.xs(shifted_d), check_names=False)
# shift int frame
int_shifted = self.intframe.shift(1)
@@ -11264,27 +11277,27 @@ def test_combine_first_mixed_bug(self):
df2 = DataFrame([[-42.6, np.nan, True], [-5., 1.6, False]], index=[1, 2])
result = df1.combine_first(df2)[2]
- expected = Series([True,True,False])
- assert_series_equal(result,expected)
+ expected = Series([True, True, False], name=2)
+ assert_series_equal(result, expected)
# GH 3593, converting datetime64[ns] incorrecly
df0 = DataFrame({"a":[datetime(2000, 1, 1), datetime(2000, 1, 2), datetime(2000, 1, 3)]})
df1 = DataFrame({"a":[None, None, None]})
df2 = df1.combine_first(df0)
- assert_frame_equal(df2,df0)
+ assert_frame_equal(df2, df0)
df2 = df0.combine_first(df1)
- assert_frame_equal(df2,df0)
+ assert_frame_equal(df2, df0)
df0 = DataFrame({"a":[datetime(2000, 1, 1), datetime(2000, 1, 2), datetime(2000, 1, 3)]})
df1 = DataFrame({"a":[datetime(2000, 1, 2), None, None]})
df2 = df1.combine_first(df0)
result = df0.copy()
result.iloc[0,:] = df1.iloc[0,:]
- assert_frame_equal(df2,result)
+ assert_frame_equal(df2, result)
df2 = df0.combine_first(df1)
- assert_frame_equal(df2,df0)
+ assert_frame_equal(df2, df0)
def test_update(self):
df = DataFrame([[1.5, nan, 3.],
@@ -11497,8 +11510,14 @@ def test_clip_against_series(self):
ub_mask = df.iloc[:, i] >= ub
mask = ~lb_mask & ~ub_mask
- assert_series_equal(clipped_df.loc[lb_mask, i], lb[lb_mask])
- assert_series_equal(clipped_df.loc[ub_mask, i], ub[ub_mask])
+ result = clipped_df.loc[lb_mask, i]
+ assert_series_equal(result, lb[lb_mask], check_names=False)
+ self.assertEqual(result.name, i)
+
+ result = clipped_df.loc[ub_mask, i]
+ assert_series_equal(result, ub[ub_mask], check_names=False)
+ self.assertEqual(result.name, i)
+
assert_series_equal(clipped_df.loc[mask, i], df.loc[mask, i])
def test_clip_against_frame(self):
@@ -11837,7 +11856,12 @@ def alt(x):
[0, 1, 2, 0, 1, 2],
[0, 1, 0, 1, 0, 1]])
df = DataFrame(np.random.randn(6, 3), index=index)
- assert_series_equal(df.kurt(), df.kurt(level=0).xs('bar'))
+
+ kurt = df.kurt()
+ kurt2 = df.kurt(level=0).xs('bar')
+ assert_series_equal(kurt, kurt2, check_names=False)
+ self.assertTrue(kurt.name is None)
+ self.assertEqual(kurt2.name, 'bar')
def _check_stat_op(self, name, alternative, frame=None, has_skipna=True,
has_numeric_only=False, check_dtype=True, check_dates=False,
@@ -13118,63 +13142,64 @@ def test_constructor_with_convert(self):
# #2845
df = DataFrame({'A' : [2**63-1] })
result = df['A']
- expected = Series(np.asarray([2**63-1], np.int64))
+ expected = Series(np.asarray([2**63-1], np.int64), name='A')
assert_series_equal(result, expected)
df = DataFrame({'A' : [2**63] })
result = df['A']
- expected = Series(np.asarray([2**63], np.object_))
+ expected = Series(np.asarray([2**63], np.object_), name='A')
assert_series_equal(result, expected)
df = DataFrame({'A' : [datetime(2005, 1, 1), True] })
result = df['A']
- expected = Series(np.asarray([datetime(2005, 1, 1), True], np.object_))
+ expected = Series(np.asarray([datetime(2005, 1, 1), True], np.object_),
+ name='A')
assert_series_equal(result, expected)
df = DataFrame({'A' : [None, 1] })
result = df['A']
- expected = Series(np.asarray([np.nan, 1], np.float_))
+ expected = Series(np.asarray([np.nan, 1], np.float_), name='A')
assert_series_equal(result, expected)
df = DataFrame({'A' : [1.0, 2] })
result = df['A']
- expected = Series(np.asarray([1.0, 2], np.float_))
+ expected = Series(np.asarray([1.0, 2], np.float_), name='A')
assert_series_equal(result, expected)
df = DataFrame({'A' : [1.0+2.0j, 3] })
result = df['A']
- expected = Series(np.asarray([1.0+2.0j, 3], np.complex_))
+ expected = Series(np.asarray([1.0+2.0j, 3], np.complex_), name='A')
assert_series_equal(result, expected)
df = DataFrame({'A' : [1.0+2.0j, 3.0] })
result = df['A']
- expected = Series(np.asarray([1.0+2.0j, 3.0], np.complex_))
+ expected = Series(np.asarray([1.0+2.0j, 3.0], np.complex_), name='A')
assert_series_equal(result, expected)
df = DataFrame({'A' : [1.0+2.0j, True] })
result = df['A']
- expected = Series(np.asarray([1.0+2.0j, True], np.object_))
+ expected = Series(np.asarray([1.0+2.0j, True], np.object_), name='A')
assert_series_equal(result, expected)
df = DataFrame({'A' : [1.0, None] })
result = df['A']
- expected = Series(np.asarray([1.0, np.nan], np.float_))
+ expected = Series(np.asarray([1.0, np.nan], np.float_), name='A')
assert_series_equal(result, expected)
df = DataFrame({'A' : [1.0+2.0j, None] })
result = df['A']
- expected = Series(np.asarray([1.0+2.0j, np.nan], np.complex_))
+ expected = Series(np.asarray([1.0+2.0j, np.nan], np.complex_), name='A')
assert_series_equal(result, expected)
df = DataFrame({'A' : [2.0, 1, True, None] })
result = df['A']
- expected = Series(np.asarray([2.0, 1, True, None], np.object_))
+ expected = Series(np.asarray([2.0, 1, True, None], np.object_), name='A')
assert_series_equal(result, expected)
df = DataFrame({'A' : [2.0, 1, datetime(2006, 1, 1), None] })
result = df['A']
expected = Series(np.asarray([2.0, 1, datetime(2006, 1, 1),
- None], np.object_))
+ None], np.object_), name='A')
assert_series_equal(result, expected)
def test_construction_with_mixed(self):
@@ -13282,8 +13307,8 @@ def test_assign_columns(self):
frame = self.frame.copy()
frame.columns = ['foo', 'bar', 'baz', 'quux', 'foo2']
- assert_series_equal(self.frame['C'], frame['baz'])
- assert_series_equal(self.frame['hi'], frame['foo2'])
+ assert_series_equal(self.frame['C'], frame['baz'], check_names=False)
+ assert_series_equal(self.frame['hi'], frame['foo2'], check_names=False)
def test_columns_with_dups(self):
@@ -13593,9 +13618,12 @@ def test_dot(self):
# Check series argument
result = a.dot(b['one'])
- assert_series_equal(result, expected['one'])
+ assert_series_equal(result, expected['one'], check_names=False)
+ self.assertTrue(result.name is None)
+
result = a.dot(b1['one'])
- assert_series_equal(result, expected['one'])
+ assert_series_equal(result, expected['one'], check_names=False)
+ self.assertTrue(result.name is None)
# can pass correct-length arrays
row = a.ix[0].values
diff --git a/pandas/tests/test_generic.py b/pandas/tests/test_generic.py
index 3f751310438e4..a03fe3c2241a3 100644
--- a/pandas/tests/test_generic.py
+++ b/pandas/tests/test_generic.py
@@ -921,8 +921,8 @@ def test_describe_empty(self):
def test_describe_none(self):
noneSeries = Series([None])
noneSeries.name = 'None'
- assert_series_equal(noneSeries.describe(),
- Series([0, 0], index=['count', 'unique']))
+ expected = Series([0, 0], index=['count', 'unique'], name='None')
+ assert_series_equal(noneSeries.describe(), expected)
class TestDataFrame(tm.TestCase, Generic):
@@ -980,11 +980,11 @@ def test_interp_combo(self):
'C': [1, 2, 3, 5], 'D': list('abcd')})
result = df['A'].interpolate()
- expected = Series([1., 2., 3., 4.])
+ expected = Series([1., 2., 3., 4.], name='A')
assert_series_equal(result, expected)
result = df['A'].interpolate(downcast='infer')
- expected = Series([1, 2, 3, 4])
+ expected = Series([1, 2, 3, 4], name='A')
assert_series_equal(result, expected)
def test_interp_nan_idx(self):
@@ -1519,7 +1519,7 @@ def test_set_attribute(self):
df.y = 5
assert_equal(df.y, 5)
- assert_series_equal(df['y'], Series([2, 4, 6]))
+ assert_series_equal(df['y'], Series([2, 4, 6], name='y'))
class TestPanel(tm.TestCase, Generic):
diff --git a/pandas/tests/test_graphics.py b/pandas/tests/test_graphics.py
index 82f4b8c05ca06..433645448fe2b 100644
--- a/pandas/tests/test_graphics.py
+++ b/pandas/tests/test_graphics.py
@@ -454,12 +454,12 @@ def is_grid_on():
self.plt.subplot(1,4*len(kinds),spndx); spndx+=1
mpl.rc('axes',grid=False)
obj.plot(kind=kind, **kws)
- self.assertFalse(is_grid_on())
+ self.assertFalse(is_grid_on())
self.plt.subplot(1,4*len(kinds),spndx); spndx+=1
mpl.rc('axes',grid=True)
obj.plot(kind=kind, grid=False, **kws)
- self.assertFalse(is_grid_on())
+ self.assertFalse(is_grid_on())
if kind != 'pie':
self.plt.subplot(1,4*len(kinds),spndx); spndx+=1
@@ -1143,7 +1143,7 @@ def test_table(self):
@slow
def test_series_grid_settings(self):
# Make sure plot defaults to rcParams['axes.grid'] setting, GH 9792
- self._check_grid_settings(Series([1,2,3]),
+ self._check_grid_settings(Series([1,2,3]),
plotting._series_kinds + plotting._common_kinds)
@@ -1376,7 +1376,7 @@ def test_unsorted_index(self):
ax = df.plot()
l = ax.get_lines()[0]
rs = l.get_xydata()
- rs = Series(rs[:, 1], rs[:, 0], dtype=np.int64)
+ rs = Series(rs[:, 1], rs[:, 0], dtype=np.int64, name='y')
tm.assert_series_equal(rs, df.y)
@slow
@@ -3467,9 +3467,9 @@ def test_sharey_and_ax(self):
@slow
def test_df_grid_settings(self):
# Make sure plot defaults to rcParams['axes.grid'] setting, GH 9792
- self._check_grid_settings(DataFrame({'a':[1,2,3],'b':[2,3,4]}),
+ self._check_grid_settings(DataFrame({'a':[1,2,3],'b':[2,3,4]}),
plotting._dataframe_kinds, kws={'x':'a','y':'b'})
-
+
@tm.mplskip
class TestDataFrameGroupByPlots(TestPlotBase):
diff --git a/pandas/tests/test_groupby.py b/pandas/tests/test_groupby.py
index 0789e20df3945..e1ae65c95b965 100644
--- a/pandas/tests/test_groupby.py
+++ b/pandas/tests/test_groupby.py
@@ -286,7 +286,9 @@ def test_nth(self):
g = df[0]
expected = s.groupby(g).first()
expected2 = s.groupby(g).apply(lambda x: x.iloc[0])
- assert_series_equal(expected2,expected)
+ assert_series_equal(expected2, expected, check_names=False)
+ self.assertTrue(expected.name, 0)
+ self.assertEqual(expected.name, 1)
# validate first
v = s[g==1].iloc[0]
@@ -1098,7 +1100,7 @@ def nsum(x):
df.groupby('col1').transform(nsum)['col2'],
df.groupby('col1')['col2'].transform(nsum)]
for result in results:
- assert_series_equal(result, expected)
+ assert_series_equal(result, expected, check_names=False)
def test_with_na(self):
index = Index(np.arange(10))
@@ -1251,9 +1253,9 @@ def test_series_describe_multikey(self):
ts = tm.makeTimeSeries()
grouped = ts.groupby([lambda x: x.year, lambda x: x.month])
result = grouped.describe().unstack()
- assert_series_equal(result['mean'], grouped.mean())
- assert_series_equal(result['std'], grouped.std())
- assert_series_equal(result['min'], grouped.min())
+ assert_series_equal(result['mean'], grouped.mean(), check_names=False)
+ assert_series_equal(result['std'], grouped.std(), check_names=False)
+ assert_series_equal(result['min'], grouped.min(), check_names=False)
def test_series_describe_single(self):
ts = tm.makeTimeSeries()
@@ -1304,7 +1306,7 @@ def test_frame_describe_multikey(self):
for col in self.tsframe:
expected = grouped[col].describe()
- assert_series_equal(result[col], expected)
+ assert_series_equal(result[col], expected, check_names=False)
groupedT = self.tsframe.groupby({'A': 0, 'B': 0,
'C': 1, 'D': 1}, axis=1)
@@ -1901,7 +1903,6 @@ def test_builtins_apply(self): # GH8155
df = pd.DataFrame(np.random.randint(1, 50, (1000, 2)),
columns=['jim', 'joe'])
df['jolie'] = np.random.randn(1000)
- print(df.head())
for keys in ['jim', ['jim', 'joe']]: # single key & multi-key
if keys == 'jim': continue
@@ -1949,6 +1950,7 @@ def _testit(op):
expd.setdefault(cat1, {})[cat2] = op(group['C'])
exp = DataFrame(expd).T.stack(dropna=False)
exp.index.names = ['A', 'B']
+ exp.name = 'C'
result = op(grouped)['C']
assert_series_equal(result, exp)
@@ -2207,7 +2209,8 @@ def trans2(group):
result = df.groupby('A').apply(trans)
exp = df.groupby('A')['C'].apply(trans2)
- assert_series_equal(result, exp)
+ assert_series_equal(result, exp, check_names=False)
+ self.assertEqual(result.name, 'C')
def test_apply_transform(self):
grouped = self.ts.groupby(lambda x: x.month)
@@ -3106,7 +3109,8 @@ def test_rank_apply(self):
expected.append(piece.value.rank())
expected = concat(expected, axis=0)
expected = expected.reindex(result.index)
- assert_series_equal(result, expected)
+ assert_series_equal(result, expected, check_names=False)
+ self.assertTrue(result.name is None)
result = df.groupby(['key1', 'key2']).value.rank(pct=True)
@@ -3115,7 +3119,8 @@ def test_rank_apply(self):
expected.append(piece.value.rank(pct=True))
expected = concat(expected, axis=0)
expected = expected.reindex(result.index)
- assert_series_equal(result, expected)
+ assert_series_equal(result, expected, check_names=False)
+ self.assertTrue(result.name is None)
def test_dont_clobber_name_column(self):
df = DataFrame({'key': ['a', 'a', 'a', 'b', 'b', 'b'],
@@ -3147,7 +3152,8 @@ def test_skip_group_keys(self):
pieces.append(group.order()[:3])
expected = concat(pieces)
- assert_series_equal(result, expected)
+ assert_series_equal(result, expected, check_names=False)
+ self.assertTrue(result.name is None)
def test_no_nonsense_name(self):
# GH #995
@@ -4328,7 +4334,7 @@ def test_filter_using_len(self):
s = df['B']
grouped = s.groupby(s)
actual = grouped.filter(lambda x: len(x) > 2)
- expected = Series(4*['b'], index=np.arange(2, 6))
+ expected = Series(4*['b'], index=np.arange(2, 6), name='B')
assert_series_equal(actual, expected)
actual = grouped.filter(lambda x: len(x) > 4)
@@ -4410,7 +4416,7 @@ def test_filter_and_transform_with_non_unique_int_index(self):
# Transform Series
actual = grouped_ser.transform(len)
- expected = Series([1, 2, 2, 1, 2, 1, 1, 2], index)
+ expected = Series([1, 2, 2, 1, 2, 1, 1, 2], index, name='pid')
assert_series_equal(actual, expected)
# Transform (a column from) DataFrameGroupBy
@@ -4450,7 +4456,7 @@ def test_filter_and_transform_with_multiple_non_unique_int_index(self):
# Transform Series
actual = grouped_ser.transform(len)
- expected = Series([1, 2, 2, 1, 2, 1, 1, 2], index)
+ expected = Series([1, 2, 2, 1, 2, 1, 1, 2], index, name='pid')
assert_series_equal(actual, expected)
# Transform (a column from) DataFrameGroupBy
@@ -4530,7 +4536,7 @@ def test_filter_and_transform_with_non_unique_float_index(self):
# Transform Series
actual = grouped_ser.transform(len)
- expected = Series([1, 2, 2, 1, 2, 1, 1, 2], index)
+ expected = Series([1, 2, 2, 1, 2, 1, 1, 2], index, name='pid')
assert_series_equal(actual, expected)
# Transform (a column from) DataFrameGroupBy
@@ -4573,7 +4579,7 @@ def test_filter_and_transform_with_non_unique_timestamp_index(self):
# Transform Series
actual = grouped_ser.transform(len)
- expected = Series([1, 2, 2, 1, 2, 1, 1, 2], index)
+ expected = Series([1, 2, 2, 1, 2, 1, 1, 2], index, name='pid')
assert_series_equal(actual, expected)
# Transform (a column from) DataFrameGroupBy
@@ -4613,7 +4619,7 @@ def test_filter_and_transform_with_non_unique_string_index(self):
# Transform Series
actual = grouped_ser.transform(len)
- expected = Series([1, 2, 2, 1, 2, 1, 1, 2], index)
+ expected = Series([1, 2, 2, 1, 2, 1, 1, 2], index, name='pid')
assert_series_equal(actual, expected)
# Transform (a column from) DataFrameGroupBy
diff --git a/pandas/tests/test_indexing.py b/pandas/tests/test_indexing.py
index c998ce65791a3..c6d31fb8d0449 100644
--- a/pandas/tests/test_indexing.py
+++ b/pandas/tests/test_indexing.py
@@ -373,8 +373,8 @@ def test_imethods_with_dups(self):
df = s.to_frame()
result = df.iloc[2]
- expected = Series(2,index=[0])
- assert_series_equal(result,expected)
+ expected = Series(2, index=[0], name=2)
+ assert_series_equal(result, expected)
result = df.iat[2,0]
expected = 2
@@ -512,7 +512,7 @@ def test_iloc_getitem_dups(self):
self.assertTrue(isnull(result))
result = df.iloc[0,:]
- expected = Series([np.nan,1,3,3],index=['A','B','A','B'])
+ expected = Series([np.nan, 1, 3, 3], index=['A','B','A','B'], name=0)
assert_series_equal(result,expected)
def test_iloc_getitem_array(self):
@@ -1021,8 +1021,8 @@ def test_loc_general(self):
# mixed type
result = DataFrame({ 'a' : [Timestamp('20130101')], 'b' : [1] }).iloc[0]
- expected = Series([ Timestamp('20130101'), 1],index=['a','b'])
- assert_series_equal(result,expected)
+ expected = Series([ Timestamp('20130101'), 1], index=['a','b'], name=0)
+ assert_series_equal(result, expected)
self.assertEqual(result.dtype, object)
def test_loc_setitem_consistency(self):
@@ -1126,12 +1126,12 @@ def test_loc_setitem_frame(self):
# setting with mixed labels
df = DataFrame({1:[1,2],2:[3,4],'a':['a','b']})
- result = df.loc[0,[1,2]]
- expected = Series([1,3],index=[1,2],dtype=object)
- assert_series_equal(result,expected)
+ result = df.loc[0, [1,2]]
+ expected = Series([1,3],index=[1,2],dtype=object, name=0)
+ assert_series_equal(result, expected)
expected = DataFrame({1:[5,2],2:[6,4],'a':['a','b']})
- df.loc[0,[1,2]] = [5,6]
+ df.loc[0, [1,2]] = [5,6]
assert_frame_equal(df, expected)
def test_loc_setitem_frame_multiples(self):
@@ -1404,8 +1404,8 @@ def f():
df.ix[2:5, 'bar'] = np.array([2.33j, 1.23+0.1j, 2.2, 1.0])
result = df.ix[2:5, 'bar']
- expected = Series([2.33j, 1.23+0.1j, 2.2, 1.0],index=[2,3,4,5])
- assert_series_equal(result,expected)
+ expected = Series([2.33j, 1.23+0.1j, 2.2, 1.0], index=[2,3,4,5], name='bar')
+ assert_series_equal(result, expected)
# dtype getting changed?
df = DataFrame(index=Index(lrange(1,11)))
@@ -1473,7 +1473,9 @@ def test_iloc_getitem_multiindex(self):
# the first row
rs = mi_int.iloc[0]
xp = mi_int.ix[4].ix[8]
- assert_series_equal(rs, xp)
+ assert_series_equal(rs, xp, check_names=False)
+ self.assertEqual(rs.name, (4, 8))
+ self.assertEqual(xp.name, 8)
# 2nd (last) columns
rs = mi_int.iloc[:,2]
@@ -2955,14 +2957,14 @@ def test_mi_access(self):
# GH 4146, not returning a block manager when selecting a unique index
# from a duplicate index
# as of 4879, this returns a Series (which is similar to what happens with a non-unique)
- expected = Series(['a',1,1],index=['h1','h3','h5'])
+ expected = Series(['a',1,1], index=['h1','h3','h5'], name='A1')
result = df2['A']['A1']
- assert_series_equal(result,expected)
+ assert_series_equal(result, expected)
# selecting a non_unique from the 2nd level
expected = DataFrame([['d',4,4],['e',5,5]],index=Index(['B2','B2'],name='sub'),columns=['h1','h3','h5'],).T
result = df2['A']['B2']
- assert_frame_equal(result,expected)
+ assert_frame_equal(result, expected)
def test_non_unique_loc_memory_error(self):
@@ -3057,15 +3059,16 @@ def test_dups_loc(self):
# GH4726
# dup indexing with iloc/loc
- df = DataFrame([[1,2,'foo','bar',Timestamp('20130101')]],
- columns=['a','a','a','a','a'],index=[1])
- expected = Series([1,2,'foo','bar',Timestamp('20130101')],index=['a','a','a','a','a'])
+ df = DataFrame([[1, 2, 'foo', 'bar', Timestamp('20130101')]],
+ columns=['a','a','a','a','a'], index=[1])
+ expected = Series([1, 2, 'foo', 'bar', Timestamp('20130101')],
+ index=['a','a','a','a','a'], name=1)
result = df.iloc[0]
- assert_series_equal(result,expected)
+ assert_series_equal(result, expected)
result = df.loc[1]
- assert_series_equal(result,expected)
+ assert_series_equal(result, expected)
def test_partial_setting(self):
diff --git a/pandas/tests/test_multilevel.py b/pandas/tests/test_multilevel.py
index b2efc20aa0694..9460c6373d0d2 100644
--- a/pandas/tests/test_multilevel.py
+++ b/pandas/tests/test_multilevel.py
@@ -149,7 +149,7 @@ def test_reindex_level(self):
# Series
result = month_sums['A'].reindex(self.ymd.index, level=1)
expected = self.ymd['A'].groupby(level='month').transform(np.sum)
- assert_series_equal(result, expected)
+ assert_series_equal(result, expected, check_names=False)
# axis=1
month_sums = self.ymd.T.sum(axis=1, level='month')
@@ -173,6 +173,7 @@ def _check_op(opname):
broadcasted = self.ymd['A'].groupby(
level='month').transform(np.sum)
expected = op(self.ymd['A'], broadcasted)
+ expected.name = 'A'
assert_series_equal(result, expected)
_check_op('sub')
@@ -1209,7 +1210,8 @@ def test_groupby_transform(self):
applied = grouped.apply(lambda x: x * 2)
expected = grouped.transform(lambda x: x * 2)
- assert_series_equal(applied.reindex(expected.index), expected)
+ result = applied.reindex(expected.index)
+ assert_series_equal(result, expected, check_names=False)
def test_unstack_sparse_keyspace(self):
# memory problems with naive impl #2278
diff --git a/pandas/tests/test_panel.py b/pandas/tests/test_panel.py
index 57fd465993e14..e86551c6b9158 100644
--- a/pandas/tests/test_panel.py
+++ b/pandas/tests/test_panel.py
@@ -1700,7 +1700,8 @@ def test_compound(self):
compounded = self.panel.compound()
assert_series_equal(compounded['ItemA'],
- (1 + self.panel['ItemA']).product(0) - 1)
+ (1 + self.panel['ItemA']).product(0) - 1,
+ check_names=False)
def test_shift(self):
# major
@@ -2186,7 +2187,7 @@ def test_ops_differently_indexed(self):
# careful, mutation
self.panel['foo'] = lp2['ItemA']
assert_series_equal(self.panel['foo'].reindex(lp2.index),
- lp2['ItemA'])
+ lp2['ItemA'], check_names=False)
def test_ops_scalar(self):
result = self.panel.mul(2)
diff --git a/pandas/tests/test_panel4d.py b/pandas/tests/test_panel4d.py
index fff3b0c5450b1..7a72200077225 100644
--- a/pandas/tests/test_panel4d.py
+++ b/pandas/tests/test_panel4d.py
@@ -471,7 +471,7 @@ def test_major_xs(self):
idx = self.panel4d.major_axis[5]
xs = self.panel4d.major_xs(idx)
- assert_series_equal(xs['l1'].T['ItemA'], ref.xs(idx))
+ assert_series_equal(xs['l1'].T['ItemA'], ref.xs(idx), check_names=False)
# not contained
idx = self.panel4d.major_axis[0] - bday
@@ -489,7 +489,7 @@ def test_minor_xs(self):
idx = self.panel4d.minor_axis[1]
xs = self.panel4d.minor_xs(idx)
- assert_series_equal(xs['l1'].T['ItemA'], ref[idx])
+ assert_series_equal(xs['l1'].T['ItemA'], ref[idx], check_names=False)
# not contained
self.assertRaises(Exception, self.panel4d.minor_xs, 'E')
@@ -1099,6 +1099,5 @@ def test_to_excel(self):
if __name__ == '__main__':
import nose
- nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure',
- '--with-timer'],
+ nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
exit=False)
diff --git a/pandas/tests/test_series.py b/pandas/tests/test_series.py
index eb583f17f3ace..30566c703d4ec 100644
--- a/pandas/tests/test_series.py
+++ b/pandas/tests/test_series.py
@@ -1064,7 +1064,7 @@ def test_pop(self):
result = k.pop('B')
self.assertEqual(result, 4)
- expected = Series([0,0],index=['A','C'])
+ expected = Series([0, 0], index=['A', 'C'], name=4)
assert_series_equal(k, expected)
def test_not_hashable(self):
@@ -1453,8 +1453,10 @@ def test_setitem(self):
# set item that's not contained
s = self.series.copy()
s['foobar'] = 1
- expected = self.series.append(Series([1],index=['foobar']))
- assert_series_equal(s,expected)
+
+ app = Series([1], index=['foobar'], name='series')
+ expected = self.series.append(app)
+ assert_series_equal(s, expected)
def test_setitem_dtypes(self):
@@ -2717,7 +2719,8 @@ def test_round(self):
# numpy.round doesn't preserve metadata, probably a numpy bug,
# re: GH #314
result = np.round(self.ts, 2)
- expected = Series(np.round(self.ts.values, 2), index=self.ts.index)
+ expected = Series(np.round(self.ts.values, 2), index=self.ts.index,
+ name='ts')
assert_series_equal(result, expected)
self.assertEqual(result.name, self.ts.name)
@@ -2866,7 +2869,7 @@ def test_modulo(self):
assert_series_equal(result, expected)
result = p['first'] % 0
- expected = Series(np.nan, index=p.index)
+ expected = Series(np.nan, index=p.index, name='first')
assert_series_equal(result, expected)
p = p.astype('float64')
@@ -2895,13 +2898,13 @@ def test_div(self):
# no longer do integer div for any ops, but deal with the 0's
p = DataFrame({'first': [3, 4, 5, 8], 'second': [0, 0, 0, 3]})
result = p['first'] / p['second']
- expected = Series(
- p['first'].values.astype(float) / p['second'].values, dtype='float64')
+ expected = Series(p['first'].values.astype(float) / p['second'].values,
+ dtype='float64')
expected.iloc[0:3] = np.inf
assert_series_equal(result, expected)
result = p['first'] / 0
- expected = Series(np.inf, index=p.index)
+ expected = Series(np.inf, index=p.index, name='first')
assert_series_equal(result, expected)
p = p.astype('float64')
@@ -2911,7 +2914,8 @@ def test_div(self):
p = DataFrame({'first': [3, 4, 5, 8], 'second': [1, 1, 1, 1]})
result = p['first'] / p['second']
- assert_series_equal(result, p['first'].astype('float64'))
+ assert_series_equal(result, p['first'].astype('float64'), check_names=False)
+ self.assertTrue(result.name is None)
self.assertFalse(np.array_equal(result, p['second'] / p['first']))
# inf signing
@@ -2926,7 +2930,7 @@ def test_div(self):
expected = Series([-0.01,-np.inf])
result = p['second'].div(p['first'])
- assert_series_equal(result, expected)
+ assert_series_equal(result, expected, check_names=False)
result = p['second'] / p['first']
assert_series_equal(result, expected)
@@ -3101,13 +3105,13 @@ def test_operators_timedelta64(self):
# timestamp on lhs
result = resultb + df['A']
- expected = Series(
- [Timestamp('20111230'), Timestamp('20120101'), Timestamp('20120103')])
+ values = [Timestamp('20111230'), Timestamp('20120101'), Timestamp('20120103')]
+ expected = Series(values, name='A')
assert_series_equal(result, expected)
# datetimes on rhs
result = df['A'] - datetime(2001, 1, 1)
- expected = Series([timedelta(days=4017 + i) for i in range(3)])
+ expected = Series([timedelta(days=4017 + i) for i in range(3)], name='A')
assert_series_equal(result, expected)
self.assertEqual(result.dtype, 'm8[ns]')
@@ -3432,13 +3436,14 @@ def test_ops_datetimelike_align(self):
dt.iloc[2] = np.nan
dt2 = dt[::-1]
- expected = Series([timedelta(0),timedelta(0),pd.NaT])
-
- result = dt2-dt
- assert_series_equal(result,expected)
+ expected = Series([timedelta(0), timedelta(0), pd.NaT])
+ # name is reset
+ result = dt2 - dt
+ assert_series_equal(result, expected)
- result = (dt2.to_frame()-dt.to_frame())[0]
- assert_series_equal(result,expected)
+ expected = Series(expected, name=0)
+ result = (dt2.to_frame() - dt.to_frame())[0]
+ assert_series_equal(result, expected)
def test_timedelta64_functions(self):
@@ -3739,25 +3744,27 @@ def test_datetime64_with_index(self):
# arithmetic integer ops with an index
s = Series(np.random.randn(5))
- expected = s-s.index.to_series()
- result = s-s.index
- assert_series_equal(result,expected)
+ expected = s - s.index.to_series()
+ result = s - s.index
+ assert_series_equal(result, expected)
# GH 4629
# arithmetic datetime64 ops with an index
- s = Series(date_range('20130101',periods=5),index=date_range('20130101',periods=5))
- expected = s-s.index.to_series()
- result = s-s.index
- assert_series_equal(result,expected)
+ s = Series(date_range('20130101', periods=5),
+ index=date_range('20130101', periods=5))
+ expected = s - s.index.to_series()
+ result = s - s.index
+ assert_series_equal(result, expected)
- result = s-s.index.to_period()
- assert_series_equal(result,expected)
+ result = s - s.index.to_period()
+ assert_series_equal(result, expected)
- df = DataFrame(np.random.randn(5,2),index=date_range('20130101',periods=5))
+ df = DataFrame(np.random.randn(5,2),
+ index=date_range('20130101', periods=5))
df['date'] = Timestamp('20130102')
df['expected'] = df['date'] - df.index.to_series()
df['result'] = df['date'] - df.index
- assert_series_equal(df['result'],df['expected'])
+ assert_series_equal(df['result'], df['expected'], check_names=False)
def test_timedelta64_nan(self):
@@ -4934,14 +4941,17 @@ def test_from_csv(self):
with ensure_clean() as path:
self.ts.to_csv(path)
ts = Series.from_csv(path)
- assert_series_equal(self.ts, ts)
+ assert_series_equal(self.ts, ts, check_names=False)
+ self.assertTrue(ts.name is None)
self.assertTrue(ts.index.name is None)
self.series.to_csv(path)
series = Series.from_csv(path)
self.assertIsNone(series.name)
self.assertIsNone(series.index.name)
- assert_series_equal(self.series, series)
+ assert_series_equal(self.series, series, check_names=False)
+ self.assertTrue(series.name is None)
+ self.assertTrue(series.index.name is None)
outfile = open(path, 'w')
outfile.write('1998-01-01|1.0\n1999-01-01|2.0')
@@ -5191,7 +5201,8 @@ def test_tshift(self):
shifted2 = self.ts.tshift(freq=self.ts.index.freq)
assert_series_equal(shifted, shifted2)
- inferred_ts = Series(self.ts.values, Index(np.asarray(self.ts.index)))
+ inferred_ts = Series(self.ts.values, Index(np.asarray(self.ts.index)),
+ name='ts')
shifted = inferred_ts.tshift(1)
unshifted = shifted.tshift(-1)
assert_series_equal(shifted, self.ts.tshift(1))
@@ -5779,7 +5790,7 @@ def test_map_dict_with_tuple_keys(self):
df['labels'] = df['a'].map(label_mappings)
df['expected_labels'] = pd.Series(['A', 'B', 'A', 'B'], index=df.index)
# All labels should be filled now
- tm.assert_series_equal(df['labels'], df['expected_labels'])
+ tm.assert_series_equal(df['labels'], df['expected_labels'], check_names=False)
def test_apply(self):
assert_series_equal(self.ts.apply(np.sqrt), np.sqrt(self.ts))
@@ -6361,6 +6372,8 @@ def test_unstack(self):
left = ts.unstack()
right = DataFrame([[nan, 1], [2, nan]], index=[101, 102],
columns=[nan, 3.5])
+ print(left)
+ print(right)
assert_frame_equal(left, right)
idx = pd.MultiIndex.from_arrays([['cat', 'cat', 'cat', 'dog', 'dog'],
diff --git a/pandas/tools/tests/test_merge.py b/pandas/tools/tests/test_merge.py
index cf5cc4661ec52..7b322b0d311de 100644
--- a/pandas/tools/tests/test_merge.py
+++ b/pandas/tools/tests/test_merge.py
@@ -922,8 +922,10 @@ def run_asserts(left, right):
self.assertFalse(res['4th'].isnull().any())
self.assertFalse(res['5th'].isnull().any())
- tm.assert_series_equal(res['4th'], - res['5th'])
- tm.assert_series_equal(res['4th'], bind_cols(res.iloc[:, :-2]))
+ tm.assert_series_equal(res['4th'], - res['5th'], check_names=False)
+ result = bind_cols(res.iloc[:, :-2])
+ tm.assert_series_equal(res['4th'], result, check_names=False)
+ self.assertTrue(result.name is None)
if sort:
tm.assert_frame_equal(res,
@@ -1250,8 +1252,10 @@ def test_int64_overflow_issues(self):
out = merge(left, right, how='outer')
self.assertEqual(len(out), len(left))
- assert_series_equal(out['left'], - out['right'])
- assert_series_equal(out['left'], out.iloc[:, :-2].sum(axis=1))
+ assert_series_equal(out['left'], - out['right'], check_names=False)
+ result = out.iloc[:, :-2].sum(axis=1)
+ assert_series_equal(out['left'], result, check_names=False)
+ self.assertTrue(result.name is None)
out.sort(out.columns.tolist(), inplace=True)
out.index = np.arange(len(out))
diff --git a/pandas/tools/tests/test_pivot.py b/pandas/tools/tests/test_pivot.py
index 4618501bed841..bb95234657ec2 100644
--- a/pandas/tools/tests/test_pivot.py
+++ b/pandas/tools/tests/test_pivot.py
@@ -166,8 +166,8 @@ def test_pivot_index_with_nan(self):
result = df.pivot('a','b','c')
expected = DataFrame([[nan,nan,17,nan],[10,nan,nan,nan],
[nan,15,nan,nan],[nan,nan,nan,20]],
- index = Index([nan,'R1','R2','R4'],name='a'),
- columns = Index(['C1','C2','C3','C4'],name='b'))
+ index = Index([nan,'R1','R2','R4'], name='a'),
+ columns = Index(['C1','C2','C3','C4'], name='b'))
tm.assert_frame_equal(result, expected)
tm.assert_frame_equal(df.pivot('b', 'a', 'c'), expected.T)
@@ -227,12 +227,14 @@ def test_margins(self):
def _check_output(res, col, index=['A', 'B'], columns=['C']):
cmarg = res['All'][:-1]
exp = self.data.groupby(index)[col].mean()
- tm.assert_series_equal(cmarg, exp)
+ tm.assert_series_equal(cmarg, exp, check_names=False)
+ self.assertEqual(cmarg.name, 'All')
res = res.sortlevel()
rmarg = res.xs(('All', ''))[:-1]
exp = self.data.groupby(columns)[col].mean()
- tm.assert_series_equal(rmarg, exp)
+ tm.assert_series_equal(rmarg, exp, check_names=False)
+ self.assertEqual(rmarg.name, ('All', ''))
gmarg = res['All']['All', '']
exp = self.data[col].mean()
@@ -679,12 +681,14 @@ def test_crosstab_margins(self):
all_cols = result['All', '']
exp_cols = df.groupby(['a']).size().astype('i8')
exp_cols = exp_cols.append(Series([len(df)], index=['All']))
+ exp_cols.name = ('All', '')
tm.assert_series_equal(all_cols, exp_cols)
all_rows = result.ix['All']
exp_rows = df.groupby(['b', 'c']).size().astype('i8')
exp_rows = exp_rows.append(Series([len(df)], index=[('All', '')]))
+ exp_rows.name = 'All'
exp_rows = exp_rows.reindex(all_rows.index)
exp_rows = exp_rows.fillna(0).astype(np.int64)
diff --git a/pandas/tseries/tests/test_resample.py b/pandas/tseries/tests/test_resample.py
index d7b1256329cc3..202ccb9438db5 100644
--- a/pandas/tseries/tests/test_resample.py
+++ b/pandas/tseries/tests/test_resample.py
@@ -815,7 +815,9 @@ def test_how_lambda_functions(self):
result = ts.resample('M', how={'foo': lambda x: x.mean(),
'bar': lambda x: x.std(ddof=1)})
foo_exp = ts.resample('M', how='mean')
+ foo_exp.name = 'foo'
bar_exp = ts.resample('M', how='std')
+ bar_exp.name = 'bar'
tm.assert_series_equal(result['foo'], foo_exp)
tm.assert_series_equal(result['bar'], bar_exp)
diff --git a/pandas/tseries/tests/test_timeseries.py b/pandas/tseries/tests/test_timeseries.py
index 8412ba8d4aad1..09b2bb24714af 100644
--- a/pandas/tseries/tests/test_timeseries.py
+++ b/pandas/tseries/tests/test_timeseries.py
@@ -248,25 +248,27 @@ def test_indexing(self):
# GH 3070, make sure semantics work on Series/Frame
expected = ts['2001']
+ expected.name = 'A'
df = DataFrame(dict(A = ts))
result = df['2001']['A']
- assert_series_equal(expected,result)
+ assert_series_equal(expected, result)
# setting
ts['2001'] = 1
expected = ts['2001']
+ expected.name = 'A'
df.loc['2001','A'] = 1
result = df['2001']['A']
- assert_series_equal(expected,result)
+ assert_series_equal(expected, result)
# GH3546 (not including times on the last day)
idx = date_range(start='2013-05-31 00:00', end='2013-05-31 23:00', freq='H')
ts = Series(lrange(len(idx)), index=idx)
expected = ts['2013-05']
- assert_series_equal(expected,ts)
+ assert_series_equal(expected, ts)
idx = date_range(start='2013-05-31 00:00', end='2013-05-31 23:59', freq='S')
ts = Series(lrange(len(idx)), index=idx)
@@ -882,10 +884,10 @@ def test_string_na_nat_conversion(self):
else:
expected[i] = to_datetime(x)
- assert_series_equal(result, expected)
+ assert_series_equal(result, expected, check_names=False)
self.assertEqual(result.name, 'foo')
- assert_series_equal(dresult, expected)
+ assert_series_equal(dresult, expected, check_names=False)
self.assertEqual(dresult.name, 'foo')
def test_to_datetime_iso8601(self):
diff --git a/pandas/tseries/tests/test_util.py b/pandas/tseries/tests/test_util.py
index df556cdc77d08..c75fcbdac07c0 100644
--- a/pandas/tseries/tests/test_util.py
+++ b/pandas/tseries/tests/test_util.py
@@ -30,12 +30,15 @@ def test_daily(self):
subset = ts[doy == i]
subset.index = [x.year for x in subset.index]
- tm.assert_series_equal(annual[i].dropna(), subset)
+ result = annual[i].dropna()
+ tm.assert_series_equal(result, subset, check_names=False)
+ self.assertEqual(result.name, i)
# check leap days
leaps = ts[(ts.index.month == 2) & (ts.index.day == 29)]
day = leaps.index.dayofyear[0]
leaps.index = leaps.index.year
+ leaps.name = 60
tm.assert_series_equal(annual[day].dropna(), leaps)
def test_hourly(self):
@@ -57,15 +60,19 @@ def test_hourly(self):
subset = ts_hourly[hoy == i]
subset.index = [x.year for x in subset.index]
- tm.assert_series_equal(annual[i].dropna(), subset)
+ result = annual[i].dropna()
+ tm.assert_series_equal(result, subset, check_names=False)
+ self.assertEqual(result.name, i)
leaps = ts_hourly[(ts_hourly.index.month == 2) &
(ts_hourly.index.day == 29) &
(ts_hourly.index.hour == 0)]
hour = leaps.index.dayofyear[0] * 24 - 23
leaps.index = leaps.index.year
+ leaps.name = 1417
tm.assert_series_equal(annual[hour].dropna(), leaps)
+
def test_weekly(self):
pass
@@ -79,7 +86,9 @@ def test_monthly(self):
for i in range(1, 13):
subset = ts[month == i]
subset.index = [x.year for x in subset.index]
- tm.assert_series_equal(annual[i].dropna(), subset)
+ result = annual[i].dropna()
+ tm.assert_series_equal(result, subset, check_names=False)
+ self.assertEqual(result.name, i)
def test_period_monthly(self):
pass
diff --git a/pandas/util/testing.py b/pandas/util/testing.py
index 55f95b602779f..25f5f84b0b1d9 100644
--- a/pandas/util/testing.py
+++ b/pandas/util/testing.py
@@ -24,7 +24,7 @@
from numpy.testing import assert_array_equal
import pandas as pd
-from pandas.core.common import is_sequence, array_equivalent, is_list_like
+from pandas.core.common import is_sequence, array_equivalent, is_list_like, is_number
import pandas.compat as compat
from pandas.compat import(
filter, map, zip, range, unichr, lrange, lmap, lzip, u, callable, Counter,
@@ -691,6 +691,14 @@ def assert_series_equal(left, right, check_dtype=True,
assert_isinstance(lindex, type(rindex))
assert_attr_equal('dtype', lindex, rindex)
assert_attr_equal('inferred_type', lindex, rindex)
+ if check_names:
+ if is_number(left.name) and np.isnan(left.name):
+ # Series.name can be np.nan in some test cases
+ assert is_number(right.name) and np.isnan(right.name)
+ elif left.name is pd.NaT:
+ assert right.name is pd.NaT
+ else:
+ assert_attr_equal('name', left, right)
# This could be refactored to use the NDFrame.equals method
| Related to #9972. Made `assert_series_equal` to check name attribute.
| https://api.github.com/repos/pandas-dev/pandas/pulls/10276 | 2015-06-04T15:16:12Z | 2015-06-05T22:16:57Z | 2015-06-05T22:16:57Z | 2015-06-05T22:48:55Z |
Fix meantim typo | diff --git a/ci/build_docs.sh b/ci/build_docs.sh
index ad41373f6dd3f..8670ea61dbec2 100755
--- a/ci/build_docs.sh
+++ b/ci/build_docs.sh
@@ -14,7 +14,7 @@ fi
if [ x"$DOC_BUILD" != x"" ]; then
- # we're running network tests, let's build the docs in the meantim
+ # we're running network tests, let's build the docs in the meantime
echo "Will build docs"
conda install sphinx==1.1.3 ipython
| https://api.github.com/repos/pandas-dev/pandas/pulls/10275 | 2015-06-04T14:43:50Z | 2015-06-04T14:49:25Z | 2015-06-04T14:49:25Z | 2015-06-04T14:50:01Z | |
BUG: Unhandled ValueError when Bigquery called through io.gbq returns zero rows #10273 | diff --git a/doc/source/whatsnew/v0.17.0.txt b/doc/source/whatsnew/v0.17.0.txt
index 1079ec52338b9..bd4e02a7617f7 100644
--- a/doc/source/whatsnew/v0.17.0.txt
+++ b/doc/source/whatsnew/v0.17.0.txt
@@ -678,3 +678,4 @@ Bug Fixes
- Bug in ``iloc`` allowing memory outside bounds of a Series to be accessed with negative integers (:issue:`10779`)
- Bug in ``read_msgpack`` where encoding is not respected (:issue:`10580`)
- Bug preventing access to the first index when using ``iloc`` with a list containing the appropriate negative integer (:issue:`10547`, :issue:`10779`)
+- Bug where ``pd.read_gbq`` throws ``ValueError`` when Bigquery returns zero rows (:issue:`10273`)
diff --git a/pandas/io/gbq.py b/pandas/io/gbq.py
index 06ad8827a5642..79706ec0c2990 100644
--- a/pandas/io/gbq.py
+++ b/pandas/io/gbq.py
@@ -279,7 +279,7 @@ def _parse_data(schema, rows):
field_type)
page_array[row_num][col_num] = field_value
- return DataFrame(page_array)
+ return DataFrame(page_array, columns=col_names)
def _parse_entry(field_value, field_type):
if field_value is None or field_value == 'null':
@@ -338,7 +338,10 @@ def read_gbq(query, project_id=None, index_col=None, col_order=None, reauth=Fals
page = pages.pop()
dataframe_list.append(_parse_data(schema, page))
- final_df = concat(dataframe_list, ignore_index = True)
+ if len(dataframe_list)>0:
+ final_df = concat(dataframe_list, ignore_index = True)
+ else:
+ final_df = _parse_data(schema,[])
# Reindex the DataFrame on the provided column
if index_col is not None:
diff --git a/pandas/io/tests/test_gbq.py b/pandas/io/tests/test_gbq.py
index 5417842d3f863..f04eeb03f790e 100644
--- a/pandas/io/tests/test_gbq.py
+++ b/pandas/io/tests/test_gbq.py
@@ -296,6 +296,13 @@ def test_download_dataset_larger_than_200k_rows(self):
df = gbq.read_gbq("SELECT id FROM [publicdata:samples.wikipedia] GROUP EACH BY id ORDER BY id ASC LIMIT 200005", project_id=PROJECT_ID)
self.assertEqual(len(df.drop_duplicates()), 200005)
+ def test_zero_rows(self):
+ # Bug fix for https://github.com/pydata/pandas/issues/10273
+ df = gbq.read_gbq("SELECT title, language FROM [publicdata:samples.wikipedia] where timestamp=-9999999", project_id=PROJECT_ID)
+ expected_result = DataFrame(columns=['title', 'language'])
+ self.assert_frame_equal(df, expected_result)
+
+
class TestToGBQIntegration(tm.TestCase):
# This class requires bq.py to be installed for setup/teardown.
# It will also need to be preconfigured with a default dataset,
| closes #10273
| https://api.github.com/repos/pandas-dev/pandas/pulls/10274 | 2015-06-04T14:30:17Z | 2015-08-29T00:08:16Z | null | 2015-09-02T10:41:49Z |
BUG: bug in cache updating when consolidating #10264 | diff --git a/doc/source/whatsnew/v0.16.2.txt b/doc/source/whatsnew/v0.16.2.txt
index ddfe6fa0b2f74..72fba51797783 100644
--- a/doc/source/whatsnew/v0.16.2.txt
+++ b/doc/source/whatsnew/v0.16.2.txt
@@ -59,6 +59,9 @@ Bug Fixes
- Bug in ``Categorical`` repr with ``display.width`` of ``None`` in Python 3 (:issue:`10087`)
- Bug in groupby.apply aggregation for Categorical not preserving categories (:issue:`10138`)
+
+- Bug in cache updating when consolidating (:issue:`10264`)
+
- Bug in ``mean()`` where integer dtypes can overflow (:issue:`10172`)
- Bug where Panel.from_dict does not set dtype when specified (:issue:`10058`)
- Bug in ``Index.union`` raises ``AttributeError`` when passing array-likes. (:issue:`10149`)
diff --git a/pandas/core/generic.py b/pandas/core/generic.py
index d6c7d87bb25b1..3bf90aaf71849 100644
--- a/pandas/core/generic.py
+++ b/pandas/core/generic.py
@@ -1352,6 +1352,7 @@ def take(self, indices, axis=0, convert=True, is_copy=True):
taken : type of caller
"""
+ self._consolidate_inplace()
new_data = self._data.take(indices,
axis=self._get_block_manager_axis(axis),
convert=True, verify=True)
@@ -2128,8 +2129,10 @@ def _protect_consolidate(self, f):
return result
def _consolidate_inplace(self):
- f = lambda: self._data.consolidate()
- self._data = self._protect_consolidate(f)
+ """ we are inplace consolidating; return None """
+ def f():
+ self._data = self._data.consolidate()
+ self._protect_consolidate(f)
def consolidate(self, inplace=False):
"""
diff --git a/pandas/core/indexing.py b/pandas/core/indexing.py
index e0f06e22c431b..c23b691e0fe3a 100644
--- a/pandas/core/indexing.py
+++ b/pandas/core/indexing.py
@@ -369,6 +369,7 @@ def _setitem_with_indexer(self, indexer, value):
# we can directly set the series here
# as we select a slice indexer on the mi
idx = index._convert_slice_indexer(idx)
+ obj._consolidate_inplace()
obj = obj.copy()
obj._data = obj._data.setitem(indexer=tuple([idx]), value=value)
self.obj[item] = obj
@@ -396,6 +397,7 @@ def setter(item, v):
s = v
else:
# set the item, possibly having a dtype change
+ s._consolidate_inplace()
s = s.copy()
s._data = s._data.setitem(indexer=pi, value=v)
s._maybe_update_cacher(clear=True)
@@ -492,6 +494,7 @@ def can_do_equal_len():
self.obj._check_is_chained_assignment_possible()
# actually do the set
+ self.obj._consolidate_inplace()
self.obj._data = self.obj._data.setitem(indexer=indexer, value=value)
self.obj._maybe_update_cacher(clear=True)
diff --git a/pandas/core/internals.py b/pandas/core/internals.py
index 3395ea360165e..8b37033749c9c 100644
--- a/pandas/core/internals.py
+++ b/pandas/core/internals.py
@@ -2830,13 +2830,13 @@ def consolidate(self):
return self
bm = self.__class__(self.blocks, self.axes)
+ bm._is_consolidated = False
bm._consolidate_inplace()
return bm
def _consolidate_inplace(self):
if not self.is_consolidated():
self.blocks = tuple(_consolidate(self.blocks))
-
self._is_consolidated = True
self._known_consolidated = True
self._rebuild_blknos_and_blklocs()
diff --git a/pandas/tests/test_indexing.py b/pandas/tests/test_indexing.py
index c998ce65791a3..5b60475ffcf33 100644
--- a/pandas/tests/test_indexing.py
+++ b/pandas/tests/test_indexing.py
@@ -3527,6 +3527,18 @@ def test_cache_updating(self):
result = df.loc[(0,0),'z']
self.assertEqual(result, 2)
+ # 10264
+ df = DataFrame(np.zeros((5,5),dtype='int64'),columns=['a','b','c','d','e'],index=range(5))
+ df['f'] = 0
+ df.f.values[3] = 1
+ y = df.iloc[np.arange(2,len(df))]
+ df.f.values[3] = 2
+ expected = DataFrame(np.zeros((5,6),dtype='int64'),columns=['a','b','c','d','e','f'],index=range(5))
+ expected.at[3,'f'] = 2
+ assert_frame_equal(df, expected)
+ expected = Series([0,0,0,2,0],name='f')
+ assert_series_equal(df.f, expected)
+
def test_slice_consolidate_invalidate_item_cache(self):
# this is chained assignment, but will 'work'
| closes #10264
| https://api.github.com/repos/pandas-dev/pandas/pulls/10272 | 2015-06-04T12:10:26Z | 2015-06-05T21:41:05Z | 2015-06-05T21:41:05Z | 2015-06-05T21:41:05Z |
PERF: write basic datetimes faster | diff --git a/doc/source/whatsnew/v0.16.2.txt b/doc/source/whatsnew/v0.16.2.txt
index f1c5b0c854055..1430fa1a309be 100644
--- a/doc/source/whatsnew/v0.16.2.txt
+++ b/doc/source/whatsnew/v0.16.2.txt
@@ -47,6 +47,7 @@ Performance Improvements
~~~~~~~~~~~~~~~~~~~~~~~~
- Improved ``Series.resample`` performance with dtype=datetime64[ns] (:issue:`7754`)
+- Modest improvement in datetime writing speed in to_csv (:issue:`10271`)
.. _whatsnew_0162.bug_fixes:
diff --git a/pandas/tslib.pyx b/pandas/tslib.pyx
index 59eb432844ee3..8fda9bb31061e 100644
--- a/pandas/tslib.pyx
+++ b/pandas/tslib.pyx
@@ -5,6 +5,7 @@ from numpy cimport (int8_t, int32_t, int64_t, import_array, ndarray,
NPY_INT64, NPY_DATETIME, NPY_TIMEDELTA)
import numpy as np
+from cpython.ref cimport PyObject
from cpython cimport (
PyTypeObject,
PyFloat_Check,
@@ -12,13 +13,14 @@ from cpython cimport (
PyObject_RichCompareBool,
PyObject_RichCompare,
PyString_Check,
- Py_GT, Py_GE, Py_EQ, Py_NE, Py_LT, Py_LE
+ Py_GT, Py_GE, Py_EQ, Py_NE, Py_LT, Py_LE,
)
# Cython < 0.17 doesn't have this in cpython
cdef extern from "Python.h":
cdef PyTypeObject *Py_TYPE(object)
int PySlice_Check(object)
+ object PyUnicode_FromFormat(const char*, ...)
cdef extern from "datetime_helper.h":
double total_seconds(object)
@@ -1450,20 +1452,43 @@ def format_array_from_datetime(ndarray[int64_t] values, object tz=None, object f
elif basic_format:
pandas_datetime_to_datetimestruct(val, PANDAS_FR_ns, &dts)
- res = '%d-%.2d-%.2d %.2d:%.2d:%.2d' % (dts.year,
- dts.month,
- dts.day,
- dts.hour,
- dts.min,
- dts.sec)
-
if show_ns:
ns = dts.ps / 1000
- res += '.%.9d' % (ns + 1000 * dts.us)
+ res = PyUnicode_FromFormat('%d-%02d-%02d %02d:%02d:%02d.%09d',
+ dts.year,
+ dts.month,
+ dts.day,
+ dts.hour,
+ dts.min,
+ dts.sec,
+ ns + 1000 * dts.us)
elif show_us:
- res += '.%.6d' % dts.us
+ res = PyUnicode_FromFormat('%d-%02d-%02d %02d:%02d:%02d.%06d',
+ dts.year,
+ dts.month,
+ dts.day,
+ dts.hour,
+ dts.min,
+ dts.sec,
+ dts.us)
+
elif show_ms:
- res += '.%.3d' % (dts.us/1000)
+ res = PyUnicode_FromFormat('%d-%02d-%02d %02d:%02d:%02d.%03d',
+ dts.year,
+ dts.month,
+ dts.day,
+ dts.hour,
+ dts.min,
+ dts.sec,
+ dts.us/1000)
+ else:
+ res = PyUnicode_FromFormat('%d-%02d-%02d %02d:%02d:%02d',
+ dts.year,
+ dts.month,
+ dts.day,
+ dts.hour,
+ dts.min,
+ dts.sec)
result[i] = res
| with PR
```
In [2]: df = DataFrame({'A' : pd.date_range('20130101',periods=100000,freq='s')})
In [3]: %timeit df.to_csv('test.csv',mode='w')
1 loops, best of 3: 282 ms per loop
```
0.16.1
```
In [2]: %timeit df.to_csv('test.csv',mode='w')
1 loops, best of 3: 352 ms per loop
```
| https://api.github.com/repos/pandas-dev/pandas/pulls/10271 | 2015-06-04T12:08:35Z | 2015-06-04T13:27:51Z | 2015-06-04T13:27:51Z | 2015-06-04T13:27:51Z |
TST: fix for bottleneck >= 1.0 nansum behavior, xref #9422 | diff --git a/pandas/core/nanops.py b/pandas/core/nanops.py
index 0df160618b7c3..c64c50f791edf 100644
--- a/pandas/core/nanops.py
+++ b/pandas/core/nanops.py
@@ -16,7 +16,7 @@
ensure_float, _ensure_float64,
_ensure_int64, _ensure_object,
is_float, is_integer, is_complex,
- is_float_dtype, is_floating_dtype,
+ is_float_dtype,
is_complex_dtype, is_integer_dtype,
is_bool_dtype, is_object_dtype,
is_datetime64_dtype, is_timedelta64_dtype,
@@ -373,7 +373,7 @@ def nansem(values, axis=None, skipna=True, ddof=1):
var = nanvar(values, axis, skipna, ddof=ddof)
mask = isnull(values)
- if not is_floating_dtype(values):
+ if not is_float_dtype(values.dtype):
values = values.astype('f8')
count, _ = _get_counts_nanvar(mask, axis, ddof)
@@ -467,7 +467,7 @@ def nanargmin(values, axis=None, skipna=True):
def nanskew(values, axis=None, skipna=True):
mask = isnull(values)
- if not is_floating_dtype(values):
+ if not is_float_dtype(values.dtype):
values = values.astype('f8')
count = _get_counts(mask, axis)
@@ -502,7 +502,7 @@ def nanskew(values, axis=None, skipna=True):
def nankurt(values, axis=None, skipna=True):
mask = isnull(values)
- if not is_floating_dtype(values):
+ if not is_float_dtype(values.dtype):
values = values.astype('f8')
count = _get_counts(mask, axis)
diff --git a/pandas/tests/test_series.py b/pandas/tests/test_series.py
index bbe942e607faf..eb583f17f3ace 100644
--- a/pandas/tests/test_series.py
+++ b/pandas/tests/test_series.py
@@ -2316,7 +2316,7 @@ def test_iteritems(self):
self.assertFalse(hasattr(self.series.iteritems(), 'reverse'))
def test_sum(self):
- self._check_stat_op('sum', np.sum)
+ self._check_stat_op('sum', np.sum, check_allna=True)
def test_sum_inf(self):
import pandas.core.nanops as nanops
@@ -2629,7 +2629,7 @@ def test_npdiff(self):
r = np.diff(s)
assert_series_equal(Series([nan, 0, 0, 0, nan]), r)
- def _check_stat_op(self, name, alternate, check_objects=False):
+ def _check_stat_op(self, name, alternate, check_objects=False, check_allna=False):
import pandas.core.nanops as nanops
def testit():
@@ -2653,7 +2653,17 @@ def testit():
assert_almost_equal(f(self.series), alternate(nona.values))
allna = self.series * nan
- self.assertTrue(np.isnan(f(allna)))
+
+ if check_allna:
+ # xref 9422
+ # bottleneck >= 1.0 give 0.0 for an allna Series sum
+ try:
+ self.assertTrue(nanops._USE_BOTTLENECK)
+ import bottleneck as bn
+ self.assertTrue(bn.__version__ >= LooseVersion('1.0'))
+ self.assertEqual(f(allna),0.0)
+ except:
+ self.assertTrue(np.isnan(f(allna)))
# dtype=object with None, it works!
s = Series([1, 2, 3, None, 5])
| https://api.github.com/repos/pandas-dev/pandas/pulls/10270 | 2015-06-04T10:57:29Z | 2015-06-04T12:06:05Z | 2015-06-04T12:06:05Z | 2015-06-04T12:06:05Z | |
BUG: GH10160 in DataFrame construction from dict with datetime64 index | diff --git a/doc/source/whatsnew/v0.16.2.txt b/doc/source/whatsnew/v0.16.2.txt
index e9ecdd60d7eed..62030b276523c 100644
--- a/doc/source/whatsnew/v0.16.2.txt
+++ b/doc/source/whatsnew/v0.16.2.txt
@@ -160,4 +160,10 @@ Bug Fixes
- Bug where infer_freq infers timerule (WOM-5XXX) unsupported by to_offset (:issue:`9425`)
- Bug in ``DataFrame.to_hdf()`` where table format would raise a seemingly unrelated error for invalid (non-string) column names. This is now explicitly forbidden. (:issue:`9057`)
- Bug to handle masking empty ``DataFrame``(:issue:`10126`)
+
- Bug where MySQL interface could not handle numeric table/column names (:issue:`10255`)
+
+- Bug in ``DataFrame`` construction from nested ``dict`` with ``datetime64`` (:issue:`10160`)
+
+- Bug in ``Series`` construction from ``dict`` with ``datetime64`` keys (:issue:`9456`)
+
diff --git a/pandas/core/common.py b/pandas/core/common.py
index 1c9326c047a79..c6393abb2758b 100644
--- a/pandas/core/common.py
+++ b/pandas/core/common.py
@@ -19,7 +19,7 @@
import pandas.lib as lib
import pandas.tslib as tslib
from pandas import compat
-from pandas.compat import StringIO, BytesIO, range, long, u, zip, map, string_types
+from pandas.compat import StringIO, BytesIO, range, long, u, zip, map, string_types, iteritems
from pandas.core.config import get_option
@@ -3361,3 +3361,17 @@ def _random_state(state=None):
return np.random.RandomState()
else:
raise ValueError("random_state must be an integer, a numpy RandomState, or None")
+
+def _dict_compat(d):
+ """
+ Helper function to convert datetimelike-keyed dicts to Timestamp-keyed dict
+
+ Parameters
+ ----------
+ d: dict like object
+
+ Returns
+ __________
+ dict
+ """
+ return dict((_maybe_box_datetimelike(key), value) for key, value in iteritems(d))
\ No newline at end of file
diff --git a/pandas/core/frame.py b/pandas/core/frame.py
index 2b434c98d8482..346b518428d47 100644
--- a/pandas/core/frame.py
+++ b/pandas/core/frame.py
@@ -28,7 +28,7 @@
_infer_dtype_from_scalar, _values_from_object,
is_list_like, _maybe_box_datetimelike,
is_categorical_dtype, is_object_dtype,
- _possibly_infer_to_datetimelike)
+ _possibly_infer_to_datetimelike, _dict_compat)
from pandas.core.generic import NDFrame, _shared_docs
from pandas.core.index import Index, MultiIndex, _ensure_index
from pandas.core.indexing import (maybe_droplevels,
@@ -5099,14 +5099,9 @@ def _homogenize(data, index, dtype=None):
v = v.reindex(index, copy=False)
else:
if isinstance(v, dict):
- if oindex is None:
- oindex = index.astype('O')
- if type(v) == dict:
- # fast cython method
- v = lib.fast_multiget(v, oindex.values, default=NA)
- else:
- v = lib.map_infer(oindex.values, v.get)
-
+ v = _dict_compat(v)
+ oindex = index.astype('O')
+ v = lib.fast_multiget(v, oindex.values, default=NA)
v = _sanitize_array(v, index, dtype=dtype, copy=False,
raise_cast_failure=False)
diff --git a/pandas/core/series.py b/pandas/core/series.py
index c54bd96f64c73..dfbc5dbf84572 100644
--- a/pandas/core/series.py
+++ b/pandas/core/series.py
@@ -21,7 +21,8 @@
_possibly_convert_platform, _try_sort,
ABCSparseArray, _maybe_match_name,
_coerce_to_dtype, SettingWithCopyError,
- _maybe_box_datetimelike, ABCDataFrame)
+ _maybe_box_datetimelike, ABCDataFrame,
+ _dict_compat)
from pandas.core.index import (Index, MultiIndex, InvalidIndexError,
_ensure_index)
from pandas.core.indexing import check_bool_indexer, maybe_convert_indices
@@ -168,6 +169,7 @@ def __init__(self, data=None, index=None, dtype=None, name=None,
try:
if isinstance(index, DatetimeIndex):
# coerce back to datetime objects for lookup
+ data = _dict_compat(data)
data = lib.fast_multiget(data, index.astype('O'),
default=np.nan)
elif isinstance(index, PeriodIndex):
diff --git a/pandas/tests/test_common.py b/pandas/tests/test_common.py
index c3d39fcdf906f..9ac7083289461 100644
--- a/pandas/tests/test_common.py
+++ b/pandas/tests/test_common.py
@@ -1018,6 +1018,16 @@ def test_maybe_convert_string_to_array(self):
self.assertTrue(result.dtype == object)
+def test_dict_compat():
+ data_datetime64 = {np.datetime64('1990-03-15'): 1,
+ np.datetime64('2015-03-15'): 2}
+ data_unchanged = {1: 2, 3: 4, 5: 6}
+ expected = {Timestamp('1990-3-15'): 1, Timestamp('2015-03-15'): 2}
+ assert(com._dict_compat(data_datetime64) == expected)
+ assert(com._dict_compat(expected) == expected)
+ assert(com._dict_compat(data_unchanged) == data_unchanged)
+
+
if __name__ == '__main__':
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
exit=False)
diff --git a/pandas/tests/test_frame.py b/pandas/tests/test_frame.py
index e6571e83cc21b..4b1954a3be64e 100644
--- a/pandas/tests/test_frame.py
+++ b/pandas/tests/test_frame.py
@@ -2960,6 +2960,31 @@ def test_constructor_dict_multiindex(self):
df = df.reindex(columns=expected.columns, index=expected.index)
check(df, expected)
+ def test_constructor_dict_datetime64_index(self):
+ # GH 10160
+ dates_as_str = ['1984-02-19', '1988-11-06', '1989-12-03', '1990-03-15']
+
+ def create_data(constructor):
+ return dict((i, {constructor(s): 2*i}) for i, s in enumerate(dates_as_str))
+
+ data_datetime64 = create_data(np.datetime64)
+ data_datetime = create_data(lambda x: datetime.strptime(x, '%Y-%m-%d'))
+ data_Timestamp = create_data(Timestamp)
+
+ expected = DataFrame([{0: 0, 1: None, 2: None, 3: None},
+ {0: None, 1: 2, 2: None, 3: None},
+ {0: None, 1: None, 2: 4, 3: None},
+ {0: None, 1: None, 2: None, 3: 6}],
+ index=[Timestamp(dt) for dt in dates_as_str])
+
+ result_datetime64 = DataFrame(data_datetime64)
+ result_datetime = DataFrame(data_datetime)
+ result_Timestamp = DataFrame(data_Timestamp)
+ assert_frame_equal(result_datetime64, expected)
+ assert_frame_equal(result_datetime, expected)
+ assert_frame_equal(result_Timestamp, expected)
+
+
def _check_basic_constructor(self, empty):
"mat: 2d matrix with shpae (3, 2) to input. empty - makes sized objects"
mat = empty((2, 3), dtype=float)
diff --git a/pandas/tests/test_series.py b/pandas/tests/test_series.py
index c7a8379c15da6..ff0d5739588f2 100644
--- a/pandas/tests/test_series.py
+++ b/pandas/tests/test_series.py
@@ -980,6 +980,29 @@ def test_constructor_subclass_dict(self):
refseries = Series(dict(compat.iteritems(data)))
assert_series_equal(refseries, series)
+ def test_constructor_dict_datetime64_index(self):
+ # GH 9456
+
+ dates_as_str = ['1984-02-19', '1988-11-06', '1989-12-03', '1990-03-15']
+ values = [42544017.198965244, 1234565, 40512335.181958228, -1]
+
+ def create_data(constructor):
+ return dict(zip((constructor(x) for x in dates_as_str), values))
+
+ data_datetime64 = create_data(np.datetime64)
+ data_datetime = create_data(lambda x: datetime.strptime(x, '%Y-%m-%d'))
+ data_Timestamp = create_data(Timestamp)
+
+ expected = Series(values, (Timestamp(x) for x in dates_as_str))
+
+ result_datetime64 = Series(data_datetime64)
+ result_datetime = Series(data_datetime)
+ result_Timestamp = Series(data_Timestamp)
+
+ assert_series_equal(result_datetime64, expected)
+ assert_series_equal(result_datetime, expected)
+ assert_series_equal(result_Timestamp, expected)
+
def test_orderedDict_ctor(self):
# GH3283
import pandas
| closes #10160
closes #9456
where `DataFrame/Series` construction from nested `dict` with `datetime64` index returns a `DataFrame\Series` of `NaN`s.
| https://api.github.com/repos/pandas-dev/pandas/pulls/10269 | 2015-06-04T04:06:49Z | 2015-06-10T20:01:04Z | null | 2015-06-10T20:01:05Z |
ENH: allow as_blocks to take a copy argument (#9607) | diff --git a/pandas/core/generic.py b/pandas/core/generic.py
index d6c7d87bb25b1..30ce072c32caa 100644
--- a/pandas/core/generic.py
+++ b/pandas/core/generic.py
@@ -2290,7 +2290,7 @@ def ftypes(self):
return Series(self._data.get_ftypes(), index=self._info_axis,
dtype=np.object_)
- def as_blocks(self):
+ def as_blocks(self, copy=True):
"""
Convert the frame to a dict of dtype -> Constructor Types that each has
a homogeneous dtype.
@@ -2298,6 +2298,10 @@ def as_blocks(self):
NOTE: the dtypes of the blocks WILL BE PRESERVED HERE (unlike in
as_matrix)
+ Parameters
+ ----------
+ copy : boolean, default True
+
Returns
-------
values : a dict of dtype -> Constructor Types
@@ -2312,7 +2316,7 @@ def as_blocks(self):
for dtype, blocks in bd.items():
# Must combine even after consolidation, because there may be
# sparse items which are never consolidated into one block.
- combined = self._data.combine(blocks, copy=True)
+ combined = self._data.combine(blocks, copy=copy)
result[dtype] = self._constructor(combined).__finalize__(self)
return result
diff --git a/pandas/tests/test_frame.py b/pandas/tests/test_frame.py
index f74cb07557342..5fc12f14618dd 100644
--- a/pandas/tests/test_frame.py
+++ b/pandas/tests/test_frame.py
@@ -6101,6 +6101,34 @@ def test_equals_different_blocks(self):
self.assertTrue(df0.equals(df1))
self.assertTrue(df1.equals(df0))
+ def test_copy_blocks(self):
+ # API/ENH 9607
+ df = DataFrame(self.frame, copy=True)
+ column = df.columns[0]
+
+ # use the default copy=True, change a column
+ blocks = df.as_blocks()
+ for dtype, _df in blocks.items():
+ if column in _df:
+ _df.ix[:, column] = _df[column] + 1
+
+ # make sure we did not change the original DataFrame
+ self.assertFalse(_df[column].equals(df[column]))
+
+ def test_no_copy_blocks(self):
+ # API/ENH 9607
+ df = DataFrame(self.frame, copy=True)
+ column = df.columns[0]
+
+ # use the copy=False, change a column
+ blocks = df.as_blocks(copy=False)
+ for dtype, _df in blocks.items():
+ if column in _df:
+ _df.ix[:, column] = _df[column] + 1
+
+ # make sure we did change the original DataFrame
+ self.assertTrue(_df[column].equals(df[column]))
+
def test_to_csv_from_csv(self):
pname = '__tmp_to_csv_from_csv__'
| closes #9607
Added copy argument in as_blocks. Defaults to True as per the original code.
Wrote test cases to check the copy=True and copy=False cases work.
| https://api.github.com/repos/pandas-dev/pandas/pulls/10268 | 2015-06-04T03:36:08Z | 2015-06-26T23:27:14Z | null | 2015-06-26T23:29:38Z |
BUG: GH10160 DataFrame construction from nested dict | diff --git a/doc/source/whatsnew/v0.17.0.txt b/doc/source/whatsnew/v0.17.0.txt
index f96a2954f98a2..4b5cfabfdedd4 100644
--- a/doc/source/whatsnew/v0.17.0.txt
+++ b/doc/source/whatsnew/v0.17.0.txt
@@ -95,3 +95,5 @@ Bug Fixes
- Bug where infer_freq infers timerule (WOM-5XXX) unsupported by to_offset (:issue:`9425`)
+
+- Bug in DataFrame constructor from nested ``dict`` type where the index is ``datatime64`` (:issue:`10160`)
diff --git a/pandas/core/frame.py b/pandas/core/frame.py
index f36108262432d..623a36503ac38 100644
--- a/pandas/core/frame.py
+++ b/pandas/core/frame.py
@@ -5095,8 +5095,9 @@ def _homogenize(data, index, dtype=None):
v = v.reindex(index, copy=False)
else:
if isinstance(v, dict):
- if oindex is None:
- oindex = index.astype('O')
+ if lib.infer_dtype(v) in ['datetime64']:
+ v = dict((lib.Timestamp(key), v[key]) for key in v)
+ oindex = index.astype('O')
if type(v) == dict:
# fast cython method
v = lib.fast_multiget(v, oindex.values, default=NA)
diff --git a/pandas/tests/test_frame.py b/pandas/tests/test_frame.py
index 4964d13f7ac28..8bde06dc45704 100644
--- a/pandas/tests/test_frame.py
+++ b/pandas/tests/test_frame.py
@@ -2941,6 +2941,21 @@ def test_constructor_dict_multiindex(self):
df = df.reindex(columns=expected.columns, index=expected.index)
check(df, expected)
+ def test_constructor_dict_datetime64_index(self):
+ # GH 10160
+ data = {1: {np.datetime64('1990-03-15'): 1},
+ 2: {np.datetime64('1989-12-03'): 3},
+ 3: {np.datetime64('1988-11-06'): 5},
+ 4: {np.datetime64('1984-02-19'): 7}}
+ data_expected = {1: {Timestamp('1990-03-15'): 1},
+ 2: {Timestamp('1989-12-03'): 3},
+ 3: {Timestamp('1988-11-06'): 5},
+ 4: {Timestamp('1984-02-19'): 7}}
+ result = DataFrame(data)
+ expected = DataFrame(data_expected)
+ assert_frame_equal(result, expected)
+
+
def _check_basic_constructor(self, empty):
"mat: 2d matrix with shpae (3, 2) to input. empty - makes sized objects"
mat = empty((2, 3), dtype=float)
| This is to fix #10160, where `DataFrame` construction from nested `dict` with `datetime64` index returns a `DataFrame` of `NaN`s or `None`s.
| https://api.github.com/repos/pandas-dev/pandas/pulls/10267 | 2015-06-04T02:40:26Z | 2015-06-04T02:52:25Z | null | 2015-06-04T02:52:25Z |
ENH: Initial pass at implementing DataFrame.asof, GH 2941 | diff --git a/pandas/core/frame.py b/pandas/core/frame.py
index c2a705ea12608..f47f20b631a25 100644
--- a/pandas/core/frame.py
+++ b/pandas/core/frame.py
@@ -34,7 +34,7 @@
from pandas.core.indexing import (maybe_droplevels,
convert_to_index_sliceable,
check_bool_indexer)
-from pandas.core.internals import (BlockManager,
+from pandas.core.internals import (BlockManager, make_block,
create_block_manager_from_arrays,
create_block_manager_from_blocks)
from pandas.core.series import Series
@@ -2737,6 +2737,69 @@ def _maybe_casted_values(index, labels=None):
#----------------------------------------------------------------------
# Reindex-based selection methods
+ def asof(self, where, skipna='percolumn'):
+ """
+ Return last good (non-null) value for each column of DataFrame for the
+ request dates. Definition of 'good' value controlled by skipna argument.
+
+ If there is no good value, NaN is returned.
+
+ Parameters
+ ----------
+ where : date or sequence of dates
+ skipna : {'any', 'all', 'none', 'percolumn'}, default 'percolumn'
+ * any: Ignore/skip rows where any of the columns are null.
+ * all: Ignore/skip rows where all of the columns are null.
+ * none: Don't ignore/skip any rows.
+ * percolumn: Ignore/skip null rows for each column seperately.
+ Equivalent to df.apply(lambda s: s.asof(where)).
+
+ Notes
+ -----
+ Dates are assumed to be sorted
+
+ Returns
+ -------
+ Series if where is a date, DataFrame if where is a sequence of dates.
+ """
+ if isinstance(where, compat.string_types):
+ where = datetools.to_datetime(where)
+
+ if skipna == 'percolumn':
+ return self.apply(lambda s: s.asof(where))
+ elif skipna == 'none':
+ row_mask = np.ones((self.shape[0],), dtype=np.bool)
+ elif skipna == 'any':
+ row_mask = ~(self.isnull().any(axis=1).values)
+ elif skipna == 'all':
+ row_mask = ~(self.isnull().all(axis=1).values)
+ else:
+ raise ValueError("skipna must be one of percolumn, none, any, all.")
+
+ if not hasattr(where, '__iter__'):
+ loc = self.index.asof_locs(Index([where]), row_mask)[0]
+ if loc == -1:
+ return Series(index=self.columns, data=np.nan)
+
+ s = self.iloc[loc, :].copy()
+ s.name = None
+ return s
+
+ locs = self.index.asof_locs(where, row_mask)
+
+ new_blocks = []
+ for block in self._data.blocks:
+ new_values = com.take_2d_multi(block.values, [None, locs])
+ # can we use make_block_same_Class? not sure how that interacts with
+ # needing to cast an int to a float once you get missings
+ #b = block.make_block_same_class(new_values, block.mgr_locs)
+ new_block = make_block(new_values, block.mgr_locs)
+ new_blocks.append(new_block)
+ new_mgr = create_block_manager_from_blocks(new_blocks,
+ [self._data.axes[0], where])
+ new_df = self._constructor(new_mgr)
+ return new_df
+
def dropna(self, axis=0, how='any', thresh=None, subset=None,
inplace=False):
"""
diff --git a/pandas/tests/test_frame.py b/pandas/tests/test_frame.py
index 4b1954a3be64e..928a2b93faa77 100644
--- a/pandas/tests/test_frame.py
+++ b/pandas/tests/test_frame.py
@@ -2270,6 +2270,83 @@ def test_get_axis(self):
assertRaisesRegexp(ValueError, 'No axis.*None', f._get_axis_name, None)
assertRaisesRegexp(ValueError, 'No axis named', f._get_axis_number, None)
+ def test_asof(self):
+ dates = date_range('2014/01/02', periods=4, freq='3D')
+ df = pd.DataFrame(data={'a': ["a", None, "b", "c"],
+ 'b': [1, None, 2, 3],
+ 'c': [1, None, None, 3],
+ 'd': [None, None, 2, 3]},
+ index=dates)
+
+ test_dates = date_range('2014/01/01', periods=5, freq='3D')
+
+ # test using skipna = none, the simplest case
+ result_skipna_none = df.asof(test_dates, skipna='none')
+ # make sure the index matches
+ self.assertTrue((result_skipna_none.index == test_dates).all())
+ # compare with the expected frame
+ expected_result = pd.DataFrame(data={'a': [None, "a", None, "b", "c"],
+ 'b': [None, 1, None, 2, 3],
+ 'c': [None, 1, None, None, 3],
+ 'd': [None, None, None, 2, 3]},
+ index=test_dates)
+ assert_frame_equal(result_skipna_none, expected_result)
+
+ # test using skipna=any
+ result_skipna_any = df.asof(test_dates, skipna='any')
+ # compare with the expected result
+ expected_result = pd.DataFrame(data={'a': [None, None, None, None, "c"],
+ 'b': [None, None, None, None, 3],
+ 'c': [None, None, None, None, 3],
+ 'd': [None, None, None, None, 3]},
+ index=test_dates)
+ assert_frame_equal(result_skipna_any, expected_result)
+
+ result_skipna_all = df.asof(test_dates, skipna='all')
+ # compare with expected result
+ expected_result = pd.DataFrame(data={'a': [None, "a", "a", "b", "c"],
+ 'b': [None, 1, 1, 2, 3],
+ 'c': [None, 1, 1, None, 3],
+ 'd': [None, None, None, 2, 3]},
+ index=test_dates)
+ assert_frame_equal(result_skipna_all, expected_result)
+
+ # finally the most complicated case, skipna=percolumn
+ result_skipna_percolumn = df.asof(test_dates, skipna='percolumn')
+ # compare with expected result
+ expected_result = pd.DataFrame(data={'a': [None, "a", "a", "b", "c"],
+ 'b': [None, 1, 1, 2, 3],
+ 'c': [None, 1, 1, 1, 3],
+ 'd': [None, None, None, 2, 3]},
+ index=test_dates)
+ assert_frame_equal(result_skipna_percolumn, expected_result)
+
+ # test calling with scalar values
+ s1 = df.asof(test_dates[0], skipna='none')
+ self.assertIsNone(s1.name)
+ self.assertTrue(isnull(s1).all())
+
+ s2 = df.asof(test_dates[2], skipna='none')
+ self.assertIsNone(s2.name)
+ s2_expected = result_skipna_none.iloc[2, :]
+ s2_expected.name = None
+ assert_series_equal(s2_expected, s2)
+
+ s3 = df.asof(test_dates[2], skipna='any')
+ self.assertIsNone(s3.name)
+ self.assertTrue(isnull(s3).all())
+
+ s4 = df.asof(test_dates[2], skipna='all')
+ self.assertIsNone(s4.name)
+ s4_expected = result_skipna_all.iloc[2, :]
+ s4_expected.name = None
+ assert_series_equal(s4_expected, s4)
+
+ s5 = df.asof(test_dates[2], skipna='percolumn')
+ self.assertIsNone(s5.name)
+ s5_expected = df.apply(lambda s: s.asof(test_dates[2]))
+ assert_series_equal(s5_expected, s5)
+
def test_set_index(self):
idx = Index(np.arange(len(self.mixed_frame)))
| Fixes #2941
This can almost certainly be made quicker, still digging into the
internals to understand the various underlying indexers.
There are 4 distinct logics you can apply to how to deal with the
missings (as opposed to the Series asof, wheres theres just two,
either skipna or dont skipna). The default is to be equivalent to
`df.apply(lambda s: s.asof(where))`.
Likely not ready to actually be merged, but at a stage where I could
use some feedback on both the logic and implementation.
| https://api.github.com/repos/pandas-dev/pandas/pulls/10266 | 2015-06-04T02:37:01Z | 2015-06-12T22:23:59Z | null | 2015-06-12T23:39:57Z |
BUG: Ensure 'coerce' actually coerces datatypes | diff --git a/doc/source/basics.rst b/doc/source/basics.rst
index 349e7e25fdafb..f739d89295ac1 100644
--- a/doc/source/basics.rst
+++ b/doc/source/basics.rst
@@ -1522,23 +1522,31 @@ then the more *general* one will be used as the result of the operation.
object conversion
~~~~~~~~~~~~~~~~~
-:meth:`~DataFrame.convert_objects` is a method to try to force conversion of types from the ``object`` dtype to other types.
-To force conversion of specific types that are *number like*, e.g. could be a string that represents a number,
-pass ``convert_numeric=True``. This will force strings and numbers alike to be numbers if possible, otherwise
-they will be set to ``np.nan``.
+.. note::
+
+ The syntax of :meth:`~DataFrame.convert_objects` changed in 0.17.0. See
+ :ref:`API changes <whatsnew_0170.api_breaking.convert_objects>`
+ for more details.
+
+:meth:`~DataFrame.convert_objects` is a method to try to force conversion of
+types from the ``object`` dtype to other types. To try converting specific
+types that are *number like*, e.g. could be a string that represents a number,
+pass ``numeric=True``. To force the conversion, add the keyword argument
+``coerce=True``. This will force strings and number-like objects to be numbers if
+possible, otherwise they will be set to ``np.nan``.
.. ipython:: python
df3['D'] = '1.'
df3['E'] = '1'
- df3.convert_objects(convert_numeric=True).dtypes
+ df3.convert_objects(numeric=True).dtypes
# same, but specific dtype conversion
df3['D'] = df3['D'].astype('float16')
df3['E'] = df3['E'].astype('int32')
df3.dtypes
-To force conversion to ``datetime64[ns]``, pass ``convert_dates='coerce'``.
+To force conversion to ``datetime64[ns]``, pass ``datetime=True`` and ``coerce=True``.
This will convert any datetime-like object to dates, forcing other values to ``NaT``.
This might be useful if you are reading in data which is mostly dates,
but occasionally has non-dates intermixed and you want to represent as missing.
@@ -1550,10 +1558,15 @@ but occasionally has non-dates intermixed and you want to represent as missing.
'foo', 1.0, 1, pd.Timestamp('20010104'),
'20010105'], dtype='O')
s
- s.convert_objects(convert_dates='coerce')
+ s.convert_objects(datetime=True, coerce=True)
-In addition, :meth:`~DataFrame.convert_objects` will attempt the *soft* conversion of any *object* dtypes, meaning that if all
+Without passing ``coerce=True``, :meth:`~DataFrame.convert_objects` will attempt
+*soft* conversion of any *object* dtypes, meaning that if all
the objects in a Series are of the same type, the Series will have that dtype.
+Note that setting ``coerce=True`` does not *convert* arbitrary types to either
+``datetime64[ns]`` or ``timedelta64[ns]``. For example, a series containing string
+dates will not be converted to a series of datetimes. To convert between types,
+see :ref:`converting to timestamps <timeseries.converting>`.
gotchas
~~~~~~~
diff --git a/doc/source/whatsnew/v0.17.0.txt b/doc/source/whatsnew/v0.17.0.txt
index a3ec13439fe76..5abdd272b442b 100644
--- a/doc/source/whatsnew/v0.17.0.txt
+++ b/doc/source/whatsnew/v0.17.0.txt
@@ -48,6 +48,71 @@ Backwards incompatible API changes
.. _whatsnew_0170.api_breaking.other:
+.. _whatsnew_0170.api_breaking.convert_objects:
+Changes to convert_objects
+^^^^^^^^^^^^^^^^^^^^^^^^^^
+- ``DataFrame.convert_objects`` keyword arguments have been shortened. (:issue:`10265`)
+
+===================== =============
+Old New
+===================== =============
+``convert_dates`` ``datetime``
+``convert_numeric`` ``numeric``
+``convert_timedelta`` ``timedelta``
+===================== =============
+
+- Coercing types with ``DataFrame.convert_objects`` is now implemented using the
+keyword argument ``coerce=True``. Previously types were coerced by setting a
+keyword argument to ``'coerce'`` instead of ``True``, as in ``convert_dates='coerce'``.
+
+ .. ipython:: python
+
+ df = pd.DataFrame({'i': ['1','2'],
+ 'f': ['apple', '4.2'],
+ 's': ['apple','banana']})
+ df
+
+ The old usage of ``DataFrame.convert_objects`` used `'coerce'` along with the
+ type.
+
+ .. code-block:: python
+
+ In [2]: df.convert_objects(convert_numeric='coerce')
+
+ Now the ``coerce`` keyword must be explicitly used.
+
+ .. ipython:: python
+
+ df.convert_objects(numeric=True, coerce=True)
+
+- In earlier versions of pandas, ``DataFrame.convert_objects`` would not coerce
+numeric types when there were no values convertible to a numeric type. For example,
+
+ .. code-block:: python
+
+ In [1]: df = pd.DataFrame({'s': ['a','b']})
+ In [2]: df.convert_objects(convert_numeric='coerce')
+ Out[2]:
+ s
+ 0 a
+ 1 b
+
+returns the original DataFrame with no conversion. This change alters
+this behavior so that
+
+ .. ipython:: python
+
+ pd.DataFrame({'s': ['a','b']})
+ df.convert_objects(numeric=True, coerce=True)
+
+converts all non-number-like strings to ``NaN``.
+
+- In earlier versions of pandas, the default behavior was to try and convert
+datetimes and timestamps. The new default is for ``DataFrame.convert_objects``
+to do nothing, and so it is necessary to pass at least one conversion target
+in the method call.
+
+
Other API Changes
^^^^^^^^^^^^^^^^^
- Enable writing Excel files in :ref:`memory <_io.excel_writing_buffer>` using StringIO/BytesIO (:issue:`7074`)
@@ -55,6 +120,7 @@ Other API Changes
- Allow passing `kwargs` to the interpolation methods (:issue:`10378`).
- Serialize metadata properties of subclasses of pandas objects (:issue:`10553`).
+
.. _whatsnew_0170.deprecations:
Deprecations
diff --git a/pandas/core/common.py b/pandas/core/common.py
index 773ecea8f2712..33a2fc0aea732 100644
--- a/pandas/core/common.py
+++ b/pandas/core/common.py
@@ -1887,65 +1887,68 @@ def _maybe_box_datetimelike(value):
_values_from_object = lib.values_from_object
-def _possibly_convert_objects(values, convert_dates=True,
- convert_numeric=True,
- convert_timedeltas=True):
+
+def _possibly_convert_objects(values,
+ datetime=True,
+ numeric=True,
+ timedelta=True,
+ coerce=False,
+ copy=True):
""" if we have an object dtype, try to coerce dates and/or numbers """
- # if we have passed in a list or scalar
+ conversion_count = sum((datetime, numeric, timedelta))
+ if conversion_count == 0:
+ import warnings
+ warnings.warn('Must explicitly pass type for conversion. Defaulting to '
+ 'pre-0.17 behavior where datetime=True, numeric=True, '
+ 'timedelta=True and coerce=False', DeprecationWarning)
+ datetime = numeric = timedelta = True
+ coerce = False
+
if isinstance(values, (list, tuple)):
+ # List or scalar
values = np.array(values, dtype=np.object_)
- if not hasattr(values, 'dtype'):
+ elif not hasattr(values, 'dtype'):
values = np.array([values], dtype=np.object_)
-
- # convert dates
- if convert_dates and values.dtype == np.object_:
-
- # we take an aggressive stance and convert to datetime64[ns]
- if convert_dates == 'coerce':
- new_values = _possibly_cast_to_datetime(
- values, 'M8[ns]', coerce=True)
-
- # if we are all nans then leave me alone
- if not isnull(new_values).all():
- values = new_values
-
- else:
- values = lib.maybe_convert_objects(
- values, convert_datetime=convert_dates)
-
- # convert timedeltas
- if convert_timedeltas and values.dtype == np.object_:
-
- if convert_timedeltas == 'coerce':
- from pandas.tseries.timedeltas import to_timedelta
- values = to_timedelta(values, coerce=True)
-
- # if we are all nans then leave me alone
- if not isnull(new_values).all():
- values = new_values
-
- else:
- values = lib.maybe_convert_objects(
- values, convert_timedelta=convert_timedeltas)
-
- # convert to numeric
- if values.dtype == np.object_:
- if convert_numeric:
- try:
- new_values = lib.maybe_convert_numeric(
- values, set(), coerce_numeric=True)
-
- # if we are all nans then leave me alone
- if not isnull(new_values).all():
- values = new_values
-
- except:
- pass
- else:
-
- # soft-conversion
- values = lib.maybe_convert_objects(values)
+ elif not is_object_dtype(values.dtype):
+ # If not object, do not attempt conversion
+ values = values.copy() if copy else values
+ return values
+
+ # If 1 flag is coerce, ensure 2 others are False
+ if coerce:
+ if conversion_count > 1:
+ raise ValueError("Only one of 'datetime', 'numeric' or "
+ "'timedelta' can be True when when coerce=True.")
+
+ # Immediate return if coerce
+ if datetime:
+ return pd.to_datetime(values, coerce=True, box=False)
+ elif timedelta:
+ return pd.to_timedelta(values, coerce=True, box=False)
+ elif numeric:
+ return lib.maybe_convert_numeric(values, set(), coerce_numeric=True)
+
+ # Soft conversions
+ if datetime:
+ values = lib.maybe_convert_objects(values,
+ convert_datetime=datetime)
+
+ if timedelta and is_object_dtype(values.dtype):
+ # Object check to ensure only run if previous did not convert
+ values = lib.maybe_convert_objects(values,
+ convert_timedelta=timedelta)
+
+ if numeric and is_object_dtype(values.dtype):
+ try:
+ converted = lib.maybe_convert_numeric(values,
+ set(),
+ coerce_numeric=True)
+ # If all NaNs, then do not-alter
+ values = converted if not isnull(converted).all() else values
+ values = values.copy() if copy else values
+ except:
+ pass
return values
diff --git a/pandas/core/frame.py b/pandas/core/frame.py
index bb192aeca5b6d..a7ecb74a67485 100644
--- a/pandas/core/frame.py
+++ b/pandas/core/frame.py
@@ -3351,7 +3351,7 @@ def combine(self, other, func, fill_value=None, overwrite=True):
return self._constructor(result,
index=new_index,
columns=new_columns).convert_objects(
- convert_dates=True,
+ datetime=True,
copy=False)
def combine_first(self, other):
@@ -3830,7 +3830,9 @@ def _apply_standard(self, func, axis, ignore_failures=False, reduce=True):
if axis == 1:
result = result.T
- result = result.convert_objects(copy=False)
+ result = result.convert_objects(datetime=True,
+ timedelta=True,
+ copy=False)
else:
@@ -3958,7 +3960,10 @@ def append(self, other, ignore_index=False, verify_integrity=False):
combined_columns = self.columns.tolist() + self.columns.union(other.index).difference(self.columns).tolist()
other = other.reindex(combined_columns, copy=False)
other = DataFrame(other.values.reshape((1, len(other))),
- index=index, columns=combined_columns).convert_objects()
+ index=index,
+ columns=combined_columns)
+ other = other.convert_objects(datetime=True, timedelta=True)
+
if not self.columns.equals(combined_columns):
self = self.reindex(columns=combined_columns)
elif isinstance(other, list) and not isinstance(other[0], DataFrame):
diff --git a/pandas/core/generic.py b/pandas/core/generic.py
index f39e953284f26..1656b306a0ddb 100644
--- a/pandas/core/generic.py
+++ b/pandas/core/generic.py
@@ -2433,22 +2433,26 @@ def copy(self, deep=True):
data = self._data.copy(deep=deep)
return self._constructor(data).__finalize__(self)
- def convert_objects(self, convert_dates=True, convert_numeric=False,
- convert_timedeltas=True, copy=True):
+ @deprecate_kwarg(old_arg_name='convert_dates', new_arg_name='datetime')
+ @deprecate_kwarg(old_arg_name='convert_numeric', new_arg_name='numeric')
+ @deprecate_kwarg(old_arg_name='convert_timedeltas', new_arg_name='timedelta')
+ def convert_objects(self, datetime=False, numeric=False,
+ timedelta=False, coerce=False, copy=True):
"""
Attempt to infer better dtype for object columns
Parameters
----------
- convert_dates : boolean, default True
- If True, convert to date where possible. If 'coerce', force
- conversion, with unconvertible values becoming NaT.
- convert_numeric : boolean, default False
- If True, attempt to coerce to numbers (including strings), with
+ datetime : boolean, default False
+ If True, convert to date where possible.
+ numeric : boolean, default False
+ If True, attempt to convert to numbers (including strings), with
unconvertible values becoming NaN.
- convert_timedeltas : boolean, default True
- If True, convert to timedelta where possible. If 'coerce', force
- conversion, with unconvertible values becoming NaT.
+ timedelta : boolean, default False
+ If True, convert to timedelta where possible.
+ coerce : boolean, default False
+ If True, force conversion with unconvertible values converted to
+ nulls (NaN or NaT)
copy : boolean, default True
If True, return a copy even if no copy is necessary (e.g. no
conversion was done). Note: This is meant for internal use, and
@@ -2459,9 +2463,10 @@ def convert_objects(self, convert_dates=True, convert_numeric=False,
converted : same as input object
"""
return self._constructor(
- self._data.convert(convert_dates=convert_dates,
- convert_numeric=convert_numeric,
- convert_timedeltas=convert_timedeltas,
+ self._data.convert(datetime=datetime,
+ numeric=numeric,
+ timedelta=timedelta,
+ coerce=coerce,
copy=copy)).__finalize__(self)
#----------------------------------------------------------------------
@@ -2859,7 +2864,7 @@ def replace(self, to_replace=None, value=None, inplace=False, limit=None,
'{0!r}').format(type(to_replace).__name__)
raise TypeError(msg) # pragma: no cover
- new_data = new_data.convert(copy=not inplace, convert_numeric=False)
+ new_data = new_data.convert(copy=not inplace, numeric=False)
if inplace:
self._update_inplace(new_data)
diff --git a/pandas/core/groupby.py b/pandas/core/groupby.py
index 4abdd1112c721..df788f806eda6 100644
--- a/pandas/core/groupby.py
+++ b/pandas/core/groupby.py
@@ -111,7 +111,7 @@ def f(self):
except Exception:
result = self.aggregate(lambda x: npfunc(x, axis=self.axis))
if _convert:
- result = result.convert_objects()
+ result = result.convert_objects(datetime=True)
return result
f.__doc__ = "Compute %s of group values" % name
@@ -2700,7 +2700,7 @@ def aggregate(self, arg, *args, **kwargs):
self._insert_inaxis_grouper_inplace(result)
result.index = np.arange(len(result))
- return result.convert_objects()
+ return result.convert_objects(datetime=True)
def _aggregate_multiple_funcs(self, arg):
from pandas.tools.merge import concat
@@ -2939,18 +2939,25 @@ def _wrap_applied_output(self, keys, values, not_indexed_same=False):
# if we have date/time like in the original, then coerce dates
# as we are stacking can easily have object dtypes here
- if (self._selected_obj.ndim == 2
- and self._selected_obj.dtypes.isin(_DATELIKE_DTYPES).any()):
- cd = 'coerce'
+ if (self._selected_obj.ndim == 2 and
+ self._selected_obj.dtypes.isin(_DATELIKE_DTYPES).any()):
+ result = result.convert_objects(numeric=True)
+ date_cols = self._selected_obj.select_dtypes(
+ include=list(_DATELIKE_DTYPES)).columns
+ result[date_cols] = (result[date_cols]
+ .convert_objects(datetime=True,
+ coerce=True))
else:
- cd = True
- result = result.convert_objects(convert_dates=cd)
+ result = result.convert_objects(datetime=True)
+
return self._reindex_output(result)
else:
# only coerce dates if we find at least 1 datetime
- cd = 'coerce' if any([ isinstance(v,Timestamp) for v in values ]) else False
- return Series(values, index=key_index).convert_objects(convert_dates=cd)
+ coerce = True if any([ isinstance(v,Timestamp) for v in values ]) else False
+ return (Series(values, index=key_index)
+ .convert_objects(datetime=True,
+ coerce=coerce))
else:
# Handle cases like BinGrouper
@@ -3053,7 +3060,8 @@ def transform(self, func, *args, **kwargs):
if any(counts == 0):
results = self._try_cast(results, obj[result.columns])
- return DataFrame(results,columns=result.columns,index=obj.index).convert_objects()
+ return (DataFrame(results,columns=result.columns,index=obj.index)
+ .convert_objects(datetime=True))
def _define_paths(self, func, *args, **kwargs):
if isinstance(func, compat.string_types):
@@ -3246,7 +3254,7 @@ def _wrap_aggregated_output(self, output, names=None):
if self.axis == 1:
result = result.T
- return self._reindex_output(result).convert_objects()
+ return self._reindex_output(result).convert_objects(datetime=True)
def _wrap_agged_blocks(self, items, blocks):
if not self.as_index:
@@ -3264,7 +3272,7 @@ def _wrap_agged_blocks(self, items, blocks):
if self.axis == 1:
result = result.T
- return self._reindex_output(result).convert_objects()
+ return self._reindex_output(result).convert_objects(datetime=True)
def _reindex_output(self, result):
"""
diff --git a/pandas/core/internals.py b/pandas/core/internals.py
index 42d7163e7f741..6b7909086403e 100644
--- a/pandas/core/internals.py
+++ b/pandas/core/internals.py
@@ -622,7 +622,7 @@ def _is_empty_indexer(indexer):
# may have to soft convert_objects here
if block.is_object and not self.is_object:
- block = block.convert(convert_numeric=False)
+ block = block.convert(numeric=False)
return block
except (ValueError, TypeError) as detail:
@@ -1455,7 +1455,7 @@ def is_bool(self):
"""
return lib.is_bool_array(self.values.ravel())
- def convert(self, convert_dates=True, convert_numeric=True, convert_timedeltas=True,
+ def convert(self, datetime=True, numeric=True, timedelta=True, coerce=False,
copy=True, by_item=True):
""" attempt to coerce any object types to better types
return a copy of the block (if copy = True)
@@ -1472,9 +1472,12 @@ def convert(self, convert_dates=True, convert_numeric=True, convert_timedeltas=T
values = self.iget(i)
values = com._possibly_convert_objects(
- values.ravel(), convert_dates=convert_dates,
- convert_numeric=convert_numeric,
- convert_timedeltas=convert_timedeltas,
+ values.ravel(),
+ datetime=datetime,
+ numeric=numeric,
+ timedelta=timedelta,
+ coerce=coerce,
+ copy=copy
).reshape(values.shape)
values = _block_shape(values, ndim=self.ndim)
newb = make_block(values,
@@ -1484,8 +1487,12 @@ def convert(self, convert_dates=True, convert_numeric=True, convert_timedeltas=T
else:
values = com._possibly_convert_objects(
- self.values.ravel(), convert_dates=convert_dates,
- convert_numeric=convert_numeric
+ self.values.ravel(),
+ datetime=datetime,
+ numeric=numeric,
+ timedelta=timedelta,
+ coerce=coerce,
+ copy=copy
).reshape(self.values.shape)
blocks.append(make_block(values,
ndim=self.ndim, placement=self.mgr_locs))
@@ -1529,8 +1536,8 @@ def _maybe_downcast(self, blocks, downcast=None):
# split and convert the blocks
result_blocks = []
for blk in blocks:
- result_blocks.extend(blk.convert(convert_dates=True,
- convert_numeric=False))
+ result_blocks.extend(blk.convert(datetime=True,
+ numeric=False))
return result_blocks
def _can_hold_element(self, element):
diff --git a/pandas/io/tests/test_html.py b/pandas/io/tests/test_html.py
index fca9e1c4e47ca..9093df9f0bf62 100644
--- a/pandas/io/tests/test_html.py
+++ b/pandas/io/tests/test_html.py
@@ -540,9 +540,11 @@ def try_remove_ws(x):
'Hamilton Bank, NA', 'The Citizens Savings Bank']
dfnew = df.applymap(try_remove_ws).replace(old, new)
gtnew = ground_truth.applymap(try_remove_ws)
- converted = dfnew.convert_objects(convert_numeric=True)
- tm.assert_frame_equal(converted.convert_objects(convert_dates='coerce'),
- gtnew)
+ converted = dfnew.convert_objects(datetime=True, numeric=True)
+ date_cols = ['Closing Date','Updated Date']
+ converted[date_cols] = converted[date_cols].convert_objects(datetime=True,
+ coerce=True)
+ tm.assert_frame_equal(converted,gtnew)
@slow
def test_gold_canyon(self):
diff --git a/pandas/io/tests/test_pytables.py b/pandas/io/tests/test_pytables.py
index 1b932fb3759e5..ea30fb14251f4 100644
--- a/pandas/io/tests/test_pytables.py
+++ b/pandas/io/tests/test_pytables.py
@@ -403,7 +403,7 @@ def test_repr(self):
df['datetime1'] = datetime.datetime(2001,1,2,0,0)
df['datetime2'] = datetime.datetime(2001,1,3,0,0)
df.ix[3:6,['obj1']] = np.nan
- df = df.consolidate().convert_objects()
+ df = df.consolidate().convert_objects(datetime=True)
warnings.filterwarnings('ignore', category=PerformanceWarning)
store['df'] = df
@@ -728,7 +728,7 @@ def test_put_mixed_type(self):
df['datetime1'] = datetime.datetime(2001, 1, 2, 0, 0)
df['datetime2'] = datetime.datetime(2001, 1, 3, 0, 0)
df.ix[3:6, ['obj1']] = np.nan
- df = df.consolidate().convert_objects()
+ df = df.consolidate().convert_objects(datetime=True)
with ensure_clean_store(self.path) as store:
_maybe_remove(store, 'df')
@@ -1381,7 +1381,7 @@ def check_col(key,name,size):
df_dc.ix[7:9, 'string'] = 'bar'
df_dc['string2'] = 'cool'
df_dc['datetime'] = Timestamp('20010102')
- df_dc = df_dc.convert_objects()
+ df_dc = df_dc.convert_objects(datetime=True)
df_dc.ix[3:5, ['A', 'B', 'datetime']] = np.nan
_maybe_remove(store, 'df_dc')
@@ -1843,7 +1843,7 @@ def test_table_mixed_dtypes(self):
df['datetime1'] = datetime.datetime(2001, 1, 2, 0, 0)
df['datetime2'] = datetime.datetime(2001, 1, 3, 0, 0)
df.ix[3:6, ['obj1']] = np.nan
- df = df.consolidate().convert_objects()
+ df = df.consolidate().convert_objects(datetime=True)
with ensure_clean_store(self.path) as store:
store.append('df1_mixed', df)
@@ -1899,7 +1899,7 @@ def test_unimplemented_dtypes_table_columns(self):
df['obj1'] = 'foo'
df['obj2'] = 'bar'
df['datetime1'] = datetime.date(2001, 1, 2)
- df = df.consolidate().convert_objects()
+ df = df.consolidate().convert_objects(datetime=True)
with ensure_clean_store(self.path) as store:
# this fails because we have a date in the object block......
diff --git a/pandas/io/tests/test_stata.py b/pandas/io/tests/test_stata.py
index 97bbfb0edf92c..8eb60b13fcc81 100644
--- a/pandas/io/tests/test_stata.py
+++ b/pandas/io/tests/test_stata.py
@@ -383,7 +383,7 @@ def test_read_write_reread_dta14(self):
expected = self.read_csv(self.csv14)
cols = ['byte_', 'int_', 'long_', 'float_', 'double_']
for col in cols:
- expected[col] = expected[col].convert_objects(convert_numeric=True)
+ expected[col] = expected[col].convert_objects(datetime=True, numeric=True)
expected['float_'] = expected['float_'].astype(np.float32)
expected['date_td'] = pd.to_datetime(expected['date_td'], coerce=True)
diff --git a/pandas/io/wb.py b/pandas/io/wb.py
index 7a9443c4b9ac6..fba4c72a51376 100644
--- a/pandas/io/wb.py
+++ b/pandas/io/wb.py
@@ -155,7 +155,7 @@ def download(country=['MX', 'CA', 'US'], indicator=['NY.GDP.MKTP.CD', 'NY.GNS.IC
out = reduce(lambda x, y: x.merge(y, how='outer'), data)
out = out.drop('iso_code', axis=1)
out = out.set_index(['country', 'year'])
- out = out.convert_objects(convert_numeric=True)
+ out = out.convert_objects(datetime=True, numeric=True)
return out
else:
msg = "No indicators returned data."
diff --git a/pandas/tests/test_common.py b/pandas/tests/test_common.py
index f7121fa54a5b1..94f151efbe2a6 100644
--- a/pandas/tests/test_common.py
+++ b/pandas/tests/test_common.py
@@ -4,7 +4,7 @@
import re
import nose
-from nose.tools import assert_equal
+from nose.tools import assert_equal, assert_true
import numpy as np
from pandas.tslib import iNaT, NaT
from pandas import Series, DataFrame, date_range, DatetimeIndex, Timestamp, Float64Index
@@ -1026,6 +1026,22 @@ def test_dict_compat():
assert(com._dict_compat(expected) == expected)
assert(com._dict_compat(data_unchanged) == data_unchanged)
+def test_possibly_convert_objects_copy():
+ values = np.array([1, 2])
+
+ out = com._possibly_convert_objects(values, copy=False)
+ assert_true(values is out)
+
+ out = com._possibly_convert_objects(values, copy=True)
+ assert_true(values is not out)
+
+ values = np.array(['apply','banana'])
+ out = com._possibly_convert_objects(values, copy=False)
+ assert_true(values is out)
+
+ out = com._possibly_convert_objects(values, copy=True)
+ assert_true(values is not out)
+
if __name__ == '__main__':
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
diff --git a/pandas/tests/test_frame.py b/pandas/tests/test_frame.py
index 4dea73a3a73a1..cc807aae2be49 100644
--- a/pandas/tests/test_frame.py
+++ b/pandas/tests/test_frame.py
@@ -6434,7 +6434,8 @@ def make_dtnat_arr(n,nnat=None):
with ensure_clean('.csv') as pth:
df=DataFrame(dict(a=s1,b=s2))
df.to_csv(pth,chunksize=chunksize)
- recons = DataFrame.from_csv(pth).convert_objects('coerce')
+ recons = DataFrame.from_csv(pth).convert_objects(datetime=True,
+ coerce=True)
assert_frame_equal(df, recons,check_names=False,check_less_precise=True)
for ncols in [4]:
@@ -7144,7 +7145,7 @@ def test_dtypes(self):
def test_convert_objects(self):
oops = self.mixed_frame.T.T
- converted = oops.convert_objects()
+ converted = oops.convert_objects(datetime=True)
assert_frame_equal(converted, self.mixed_frame)
self.assertEqual(converted['A'].dtype, np.float64)
@@ -7157,7 +7158,8 @@ def test_convert_objects(self):
self.mixed_frame['J'] = '1.'
self.mixed_frame['K'] = '1'
self.mixed_frame.ix[0:5,['J','K']] = 'garbled'
- converted = self.mixed_frame.convert_objects(convert_numeric=True)
+ converted = self.mixed_frame.convert_objects(datetime=True,
+ numeric=True)
self.assertEqual(converted['H'].dtype, 'float64')
self.assertEqual(converted['I'].dtype, 'int64')
self.assertEqual(converted['J'].dtype, 'float64')
@@ -7179,14 +7181,14 @@ def test_convert_objects(self):
# mixed in a single column
df = DataFrame(dict(s = Series([1, 'na', 3 ,4])))
- result = df.convert_objects(convert_numeric=True)
+ result = df.convert_objects(datetime=True, numeric=True)
expected = DataFrame(dict(s = Series([1, np.nan, 3 ,4])))
assert_frame_equal(result, expected)
def test_convert_objects_no_conversion(self):
mixed1 = DataFrame(
{'a': [1, 2, 3], 'b': [4.0, 5, 6], 'c': ['x', 'y', 'z']})
- mixed2 = mixed1.convert_objects()
+ mixed2 = mixed1.convert_objects(datetime=True)
assert_frame_equal(mixed1, mixed2)
def test_append_series_dict(self):
@@ -10698,7 +10700,7 @@ def test_apply_convert_objects(self):
'F': np.random.randn(11)})
result = data.apply(lambda x: x, axis=1)
- assert_frame_equal(result.convert_objects(), data)
+ assert_frame_equal(result.convert_objects(datetime=True), data)
def test_apply_attach_name(self):
result = self.frame.apply(lambda x: x.name)
diff --git a/pandas/tests/test_groupby.py b/pandas/tests/test_groupby.py
index e2a447207db82..91902aae3c835 100644
--- a/pandas/tests/test_groupby.py
+++ b/pandas/tests/test_groupby.py
@@ -601,7 +601,7 @@ def f(grp):
return grp.iloc[0]
result = df.groupby('A').apply(f)[['C']]
e = df.groupby('A').first()[['C']]
- e.loc['Pony'] = np.nan
+ e.loc['Pony'] = pd.NaT
assert_frame_equal(result,e)
# scalar outputs
diff --git a/pandas/tests/test_indexing.py b/pandas/tests/test_indexing.py
index b666fba274b70..624fa11ac908a 100644
--- a/pandas/tests/test_indexing.py
+++ b/pandas/tests/test_indexing.py
@@ -3060,7 +3060,8 @@ def test_astype_assignment(self):
assert_frame_equal(df,expected)
df = df_orig.copy()
- df.iloc[:,0:2] = df.iloc[:,0:2].convert_objects(convert_numeric=True)
+ df.iloc[:,0:2] = df.iloc[:,0:2].convert_objects(datetime=True,
+ numeric=True)
expected = DataFrame([[1,2,'3','.4',5,6.,'foo']],columns=list('ABCDEFG'))
assert_frame_equal(df,expected)
diff --git a/pandas/tests/test_internals.py b/pandas/tests/test_internals.py
index 36585abd1b98f..ef05b40827dfd 100644
--- a/pandas/tests/test_internals.py
+++ b/pandas/tests/test_internals.py
@@ -554,7 +554,7 @@ def _compare(old_mgr, new_mgr):
mgr.set('a', np.array(['1'] * N, dtype=np.object_))
mgr.set('b', np.array(['2.'] * N, dtype=np.object_))
mgr.set('foo', np.array(['foo.'] * N, dtype=np.object_))
- new_mgr = mgr.convert(convert_numeric=True)
+ new_mgr = mgr.convert(numeric=True)
self.assertEqual(new_mgr.get('a').dtype, np.int64)
self.assertEqual(new_mgr.get('b').dtype, np.float64)
self.assertEqual(new_mgr.get('foo').dtype, np.object_)
@@ -566,7 +566,7 @@ def _compare(old_mgr, new_mgr):
mgr.set('a', np.array(['1'] * N, dtype=np.object_))
mgr.set('b', np.array(['2.'] * N, dtype=np.object_))
mgr.set('foo', np.array(['foo.'] * N, dtype=np.object_))
- new_mgr = mgr.convert(convert_numeric=True)
+ new_mgr = mgr.convert(numeric=True)
self.assertEqual(new_mgr.get('a').dtype, np.int64)
self.assertEqual(new_mgr.get('b').dtype, np.float64)
self.assertEqual(new_mgr.get('foo').dtype, np.object_)
diff --git a/pandas/tests/test_panel.py b/pandas/tests/test_panel.py
index bc0aaee1b10b6..9cdc769dd7d74 100644
--- a/pandas/tests/test_panel.py
+++ b/pandas/tests/test_panel.py
@@ -1119,7 +1119,7 @@ def test_convert_objects(self):
# GH 4937
p = Panel(dict(A = dict(a = ['1','1.0'])))
expected = Panel(dict(A = dict(a = [1,1.0])))
- result = p.convert_objects(convert_numeric='force')
+ result = p.convert_objects(numeric=True, coerce=True)
assert_panel_equal(result, expected)
def test_dtypes(self):
diff --git a/pandas/tests/test_series.py b/pandas/tests/test_series.py
index 075362e006206..7326d7a9d811d 100644
--- a/pandas/tests/test_series.py
+++ b/pandas/tests/test_series.py
@@ -8,6 +8,7 @@
from inspect import getargspec
from itertools import product, starmap
from distutils.version import LooseVersion
+import warnings
import nose
@@ -5912,39 +5913,105 @@ def test_apply_dont_convert_dtype(self):
result = s.apply(f, convert_dtype=False)
self.assertEqual(result.dtype, object)
+ # GH 10265
def test_convert_objects(self):
+ # Tests: All to nans, coerce, true
+ # Test coercion returns correct type
+ s = Series(['a', 'b', 'c'])
+ results = s.convert_objects(datetime=True, coerce=True)
+ expected = Series([lib.NaT] * 3)
+ assert_series_equal(results, expected)
+
+ results = s.convert_objects(numeric=True, coerce=True)
+ expected = Series([np.nan] * 3)
+ assert_series_equal(results, expected)
+
+ expected = Series([lib.NaT] * 3, dtype=np.dtype('m8[ns]'))
+ results = s.convert_objects(timedelta=True, coerce=True)
+ assert_series_equal(results, expected)
+
+ dt = datetime(2001, 1, 1, 0, 0)
+ td = dt - datetime(2000, 1, 1, 0, 0)
+
+ # Test coercion with mixed types
+ s = Series(['a', '3.1415', dt, td])
+ results = s.convert_objects(datetime=True, coerce=True)
+ expected = Series([lib.NaT, lib.NaT, dt, lib.NaT])
+ assert_series_equal(results, expected)
+
+ results = s.convert_objects(numeric=True, coerce=True)
+ expected = Series([nan, 3.1415, nan, nan])
+ assert_series_equal(results, expected)
+
+ results = s.convert_objects(timedelta=True, coerce=True)
+ expected = Series([lib.NaT, lib.NaT, lib.NaT, td],
+ dtype=np.dtype('m8[ns]'))
+ assert_series_equal(results, expected)
+
+ # Test standard conversion returns original
+ results = s.convert_objects(datetime=True)
+ assert_series_equal(results, s)
+ results = s.convert_objects(numeric=True)
+ expected = Series([nan, 3.1415, nan, nan])
+ assert_series_equal(results, expected)
+ results = s.convert_objects(timedelta=True)
+ assert_series_equal(results, s)
+
+ # test pass-through and non-conversion when other types selected
+ s = Series(['1.0','2.0','3.0'])
+ results = s.convert_objects(datetime=True, numeric=True, timedelta=True)
+ expected = Series([1.0,2.0,3.0])
+ assert_series_equal(results, expected)
+ results = s.convert_objects(True,False,True)
+ assert_series_equal(results, s)
+
+ s = Series([datetime(2001, 1, 1, 0, 0),datetime(2001, 1, 1, 0, 0)],
+ dtype='O')
+ results = s.convert_objects(datetime=True, numeric=True, timedelta=True)
+ expected = Series([datetime(2001, 1, 1, 0, 0),datetime(2001, 1, 1, 0, 0)])
+ assert_series_equal(results, expected)
+ results = s.convert_objects(datetime=False,numeric=True,timedelta=True)
+ assert_series_equal(results, s)
+
+ td = datetime(2001, 1, 1, 0, 0) - datetime(2000, 1, 1, 0, 0)
+ s = Series([td, td], dtype='O')
+ results = s.convert_objects(datetime=True, numeric=True, timedelta=True)
+ expected = Series([td, td])
+ assert_series_equal(results, expected)
+ results = s.convert_objects(True,True,False)
+ assert_series_equal(results, s)
+
s = Series([1., 2, 3], index=['a', 'b', 'c'])
- result = s.convert_objects(convert_dates=False, convert_numeric=True)
+ result = s.convert_objects(numeric=True)
assert_series_equal(result, s)
# force numeric conversion
r = s.copy().astype('O')
r['a'] = '1'
- result = r.convert_objects(convert_dates=False, convert_numeric=True)
+ result = r.convert_objects(numeric=True)
assert_series_equal(result, s)
r = s.copy().astype('O')
r['a'] = '1.'
- result = r.convert_objects(convert_dates=False, convert_numeric=True)
+ result = r.convert_objects(numeric=True)
assert_series_equal(result, s)
r = s.copy().astype('O')
r['a'] = 'garbled'
+ result = r.convert_objects(numeric=True)
expected = s.copy()
- expected['a'] = np.nan
- result = r.convert_objects(convert_dates=False, convert_numeric=True)
+ expected['a'] = nan
assert_series_equal(result, expected)
# GH 4119, not converting a mixed type (e.g.floats and object)
s = Series([1, 'na', 3, 4])
- result = s.convert_objects(convert_numeric=True)
- expected = Series([1, np.nan, 3, 4])
+ result = s.convert_objects(datetime=True, numeric=True)
+ expected = Series([1, nan, 3, 4])
assert_series_equal(result, expected)
s = Series([1, '', 3, 4])
- result = s.convert_objects(convert_numeric=True)
- expected = Series([1, np.nan, 3, 4])
+ result = s.convert_objects(datetime=True, numeric=True)
assert_series_equal(result, expected)
# dates
@@ -5953,38 +6020,34 @@ def test_convert_objects(self):
s2 = Series([datetime(2001, 1, 1, 0, 0), datetime(2001, 1, 2, 0, 0), datetime(
2001, 1, 3, 0, 0), 'foo', 1.0, 1, Timestamp('20010104'), '20010105'], dtype='O')
- result = s.convert_objects(convert_dates=True, convert_numeric=False)
+ result = s.convert_objects(datetime=True)
expected = Series(
[Timestamp('20010101'), Timestamp('20010102'), Timestamp('20010103')], dtype='M8[ns]')
assert_series_equal(result, expected)
- result = s.convert_objects(
- convert_dates='coerce', convert_numeric=False)
- result = s.convert_objects(
- convert_dates='coerce', convert_numeric=True)
+ result = s.convert_objects(datetime=True, coerce=True)
assert_series_equal(result, expected)
expected = Series(
[Timestamp(
'20010101'), Timestamp('20010102'), Timestamp('20010103'),
lib.NaT, lib.NaT, lib.NaT, Timestamp('20010104'), Timestamp('20010105')], dtype='M8[ns]')
- result = s2.convert_objects(
- convert_dates='coerce', convert_numeric=False)
+ result = s2.convert_objects(datetime=True,
+ numeric=False,
+ timedelta=False,
+ coerce=True)
assert_series_equal(result, expected)
- result = s2.convert_objects(
- convert_dates='coerce', convert_numeric=True)
+ result = s2.convert_objects(datetime=True, coerce=True)
assert_series_equal(result, expected)
- # preserver all-nans (if convert_dates='coerce')
s = Series(['foo', 'bar', 1, 1.0], dtype='O')
- result = s.convert_objects(
- convert_dates='coerce', convert_numeric=False)
- assert_series_equal(result, s)
+ result = s.convert_objects(datetime=True, coerce=True)
+ expected = Series([lib.NaT]*4)
+ assert_series_equal(result, expected)
# preserver if non-object
s = Series([1], dtype='float32')
- result = s.convert_objects(
- convert_dates='coerce', convert_numeric=False)
+ result = s.convert_objects(datetime=True, coerce=True)
assert_series_equal(result, s)
#r = s.copy()
@@ -5993,23 +6056,31 @@ def test_convert_objects(self):
#self.assertEqual(result.dtype, 'M8[ns]')
# dateutil parses some single letters into today's value as a date
+ expected = Series([lib.NaT])
for x in 'abcdefghijklmnopqrstuvwxyz':
s = Series([x])
- result = s.convert_objects(convert_dates='coerce')
- assert_series_equal(result, s)
+ result = s.convert_objects(datetime=True, coerce=True)
+ assert_series_equal(result, expected)
s = Series([x.upper()])
- result = s.convert_objects(convert_dates='coerce')
- assert_series_equal(result, s)
+ result = s.convert_objects(datetime=True, coerce=True)
+ assert_series_equal(result, expected)
+
+ def test_convert_objects_no_arg_warning(self):
+ s = Series(['1.0','2'])
+ with warnings.catch_warnings(record=True) as w:
+ warnings.simplefilter('always', DeprecationWarning)
+ s.convert_objects()
+ self.assertEqual(len(w), 1)
def test_convert_objects_preserve_bool(self):
s = Series([1, True, 3, 5], dtype=object)
- r = s.convert_objects(convert_numeric=True)
+ r = s.convert_objects(datetime=True, numeric=True)
e = Series([1, 1, 3, 5], dtype='i8')
tm.assert_series_equal(r, e)
def test_convert_objects_preserve_all_bool(self):
s = Series([False, True, False, False], dtype=object)
- r = s.convert_objects(convert_numeric=True)
+ r = s.convert_objects(datetime=True, numeric=True)
e = Series([False, True, False, False], dtype=bool)
tm.assert_series_equal(r, e)
diff --git a/pandas/tools/plotting.py b/pandas/tools/plotting.py
index 07d7ced02e6ba..54298e8434a1b 100644
--- a/pandas/tools/plotting.py
+++ b/pandas/tools/plotting.py
@@ -1030,7 +1030,7 @@ def _compute_plot_data(self):
label = 'None'
data = data.to_frame(name=label)
- numeric_data = data.convert_objects()._get_numeric_data()
+ numeric_data = data.convert_objects(datetime=True)._get_numeric_data()
try:
is_empty = numeric_data.empty
@@ -1960,7 +1960,8 @@ def __init__(self, data, bins=10, bottom=0, **kwargs):
def _args_adjust(self):
if com.is_integer(self.bins):
# create common bin edge
- values = self.data.convert_objects()._get_numeric_data()
+ values = (self.data.convert_objects(datetime=True)
+ ._get_numeric_data())
values = np.ravel(values)
values = values[~com.isnull(values)]
diff --git a/pandas/tslib.pyx b/pandas/tslib.pyx
index 27cd5e89220a9..9bb7d7261a8df 100644
--- a/pandas/tslib.pyx
+++ b/pandas/tslib.pyx
@@ -2416,6 +2416,8 @@ cdef inline parse_timedelta_string(object ts, coerce=False):
elif have_dot:
if (len(number) or len(frac)) and not len(unit) and current_unit is None:
+ if coerce:
+ return iNaT
raise ValueError("no units specified")
if len(frac) > 0 and len(frac) <= 3:
| Changes behavior of convert objects so that passing 'coerce' will
ensure that data of the correct type is returned, even if all
values are null-types (NaN or NaT).
closes #9589
| https://api.github.com/repos/pandas-dev/pandas/pulls/10265 | 2015-06-03T21:53:02Z | 2015-07-14T12:47:25Z | 2015-07-14T12:47:25Z | 2015-07-15T21:14:39Z |
BUG: Should allow numeric mysql table/column names | diff --git a/doc/source/whatsnew/v0.16.2.txt b/doc/source/whatsnew/v0.16.2.txt
index ddfe6fa0b2f74..c1bf3b9252428 100644
--- a/doc/source/whatsnew/v0.16.2.txt
+++ b/doc/source/whatsnew/v0.16.2.txt
@@ -88,3 +88,5 @@ Bug Fixes
- Bug where infer_freq infers timerule (WOM-5XXX) unsupported by to_offset (:issue:`9425`)
- Bug to handle masking empty ``DataFrame``(:issue:`10126`)
+- Bug where MySQL interface could not handle numeric table/column names (:issue:`10255`)
+
diff --git a/pandas/io/sql.py b/pandas/io/sql.py
index ad88d74a5aa91..b4e8c7de2b4e1 100644
--- a/pandas/io/sql.py
+++ b/pandas/io/sql.py
@@ -1283,8 +1283,6 @@ def _get_valid_mysql_name(name):
if not re.match(basere, c):
if not (0x80 < ord(c) < 0xFFFF):
raise ValueError("Invalid MySQL identifier '%s'" % uname)
- if not re.match(r'[^0-9]', uname):
- raise ValueError('MySQL identifier cannot be entirely numeric')
return '`' + uname + '`'
diff --git a/pandas/io/tests/test_sql.py b/pandas/io/tests/test_sql.py
index 9576f80696350..a848917196e62 100644
--- a/pandas/io/tests/test_sql.py
+++ b/pandas/io/tests/test_sql.py
@@ -1738,7 +1738,8 @@ def test_illegal_names(self):
for ndx, weird_name in enumerate(['test_weird_name]','test_weird_name[',
'test_weird_name`','test_weird_name"', 'test_weird_name\'',
- '_b.test_weird_name_01-30', '"_b.test_weird_name_01-30"']):
+ '_b.test_weird_name_01-30', '"_b.test_weird_name_01-30"',
+ '12345','12345blah']):
df.to_sql(weird_name, self.conn, flavor=self.flavor)
sql.table_exists(weird_name, self.conn)
@@ -1839,16 +1840,30 @@ def test_to_sql_save_index(self):
self._to_sql_save_index()
def test_illegal_names(self):
+ df = DataFrame([[1, 2], [3, 4]], columns=['a', 'b'])
+
+ # These tables and columns should be ok
+ for ndx, ok_name in enumerate(['99beginswithnumber','12345']):
+ df.to_sql(ok_name, self.conn, flavor=self.flavor, index=False,
+ if_exists='replace')
+ self.conn.cursor().execute("DROP TABLE `%s`" % ok_name)
+ self.conn.commit()
+ df2 = DataFrame([[1, 2], [3, 4]], columns=['a', ok_name])
+ c_tbl = 'test_ok_col_name%d'%ndx
+ df2.to_sql(c_tbl, self.conn, flavor=self.flavor, index=False,
+ if_exists='replace')
+ self.conn.cursor().execute("DROP TABLE `%s`" % c_tbl)
+ self.conn.commit()
+
# For MySQL, these should raise ValueError
for ndx, illegal_name in enumerate(['test_illegal_name]','test_illegal_name[',
'test_illegal_name`','test_illegal_name"', 'test_illegal_name\'', '']):
- df = DataFrame([[1, 2], [3, 4]], columns=['a', 'b'])
self.assertRaises(ValueError, df.to_sql, illegal_name, self.conn,
flavor=self.flavor, index=False)
df2 = DataFrame([[1, 2], [3, 4]], columns=['a', illegal_name])
c_tbl = 'test_illegal_col_name%d'%ndx
- self.assertRaises(ValueError, df2.to_sql, 'test_illegal_col_name',
+ self.assertRaises(ValueError, df2.to_sql, c_tbl,
self.conn, flavor=self.flavor, index=False)
| Closes #10255 , alternative to #10262 .
| https://api.github.com/repos/pandas-dev/pandas/pulls/10263 | 2015-06-03T20:57:06Z | 2015-06-05T09:11:25Z | 2015-06-05T09:11:25Z | 2015-06-05T09:11:32Z |
TST: test_sql: properly drop tables with names that need to be quoted | diff --git a/pandas/io/tests/test_sql.py b/pandas/io/tests/test_sql.py
index ba951c7cb513d..d95babff2653b 100644
--- a/pandas/io/tests/test_sql.py
+++ b/pandas/io/tests/test_sql.py
@@ -165,15 +165,64 @@
}
+class MixInBase(object):
+ def tearDown(self):
+ for tbl in self._get_all_tables():
+ self.drop_table(tbl)
+ self._close_conn()
+
+
+class MySQLMixIn(MixInBase):
+ def drop_table(self, table_name):
+ cur = self.conn.cursor()
+ cur.execute("DROP TABLE IF EXISTS %s" % sql._get_valid_mysql_name(table_name))
+ self.conn.commit()
+
+ def _get_all_tables(self):
+ cur = self.conn.cursor()
+ cur.execute('SHOW TABLES')
+ return [table[0] for table in cur.fetchall()]
+
+ def _close_conn(self):
+ from pymysql.err import Error
+ try:
+ self.conn.close()
+ except Error:
+ pass
+
+
+class SQLiteMixIn(MixInBase):
+ def drop_table(self, table_name):
+ self.conn.execute("DROP TABLE IF EXISTS %s" % sql._get_valid_sqlite_name(table_name))
+ self.conn.commit()
+
+ def _get_all_tables(self):
+ c = self.conn.execute("SELECT name FROM sqlite_master WHERE type='table'")
+ return [table[0] for table in c.fetchall()]
+
+ def _close_conn(self):
+ self.conn.close()
+
+
+class SQLAlchemyMixIn(MixInBase):
+ def drop_table(self, table_name):
+ sql.SQLDatabase(self.conn).drop_table(table_name)
+
+ def _get_all_tables(self):
+ meta = sqlalchemy.schema.MetaData(bind=self.conn)
+ meta.reflect()
+ table_list = meta.tables.keys()
+ return table_list
+
+ def _close_conn(self):
+ pass
+
class PandasSQLTest(unittest.TestCase):
"""
Base class with common private methods for SQLAlchemy and fallback cases.
"""
- def drop_table(self, table_name):
- self._get_exec().execute("DROP TABLE IF EXISTS %s" % table_name)
-
def _get_exec(self):
if hasattr(self.conn, 'execute'):
return self.conn
@@ -768,7 +817,7 @@ def test_categorical(self):
tm.assert_frame_equal(res, df)
-class TestSQLApi(_TestSQLApi):
+class TestSQLApi(SQLAlchemyMixIn, _TestSQLApi):
"""
Test the public API as it would be used directly
@@ -889,13 +938,14 @@ def tearDown(self):
self.conn.close()
self.conn = self.__engine
self.pandasSQL = sql.SQLDatabase(self.__engine)
+ super(_EngineToConnMixin, self).tearDown()
class TestSQLApiConn(_EngineToConnMixin, TestSQLApi):
pass
-class TestSQLiteFallbackApi(_TestSQLApi):
+class TestSQLiteFallbackApi(SQLiteMixIn, _TestSQLApi):
"""
Test the public sqlite connection fallback API
@@ -978,7 +1028,7 @@ def test_sqlite_type_mapping(self):
#--- Database flavor specific tests
-class _TestSQLAlchemy(PandasSQLTest):
+class _TestSQLAlchemy(SQLAlchemyMixIn, PandasSQLTest):
"""
Base class for testing the sqlalchemy backend.
@@ -1451,10 +1501,6 @@ def setup_driver(cls):
# sqlite3 is built-in
cls.driver = None
- def tearDown(self):
- super(_TestSQLiteAlchemy, self).tearDown()
- # in memory so tables should not be removed explicitly
-
def test_default_type_conversion(self):
df = sql.read_sql_table("types_test_data", self.conn)
@@ -1511,12 +1557,6 @@ def setup_driver(cls):
except ImportError:
raise nose.SkipTest('pymysql not installed')
- def tearDown(self):
- super(_TestMySQLAlchemy, self).tearDown()
- c = self.conn.execute('SHOW TABLES')
- for table in c.fetchall():
- self.conn.execute('DROP TABLE %s' % table[0])
-
def test_default_type_conversion(self):
df = sql.read_sql_table("types_test_data", self.conn)
@@ -1586,14 +1626,6 @@ def setup_driver(cls):
except ImportError:
raise nose.SkipTest('psycopg2 not installed')
- def tearDown(self):
- super(_TestPostgreSQLAlchemy, self).tearDown()
- c = self.conn.execute(
- "SELECT table_name FROM information_schema.tables"
- " WHERE table_schema = 'public'")
- for table in c.fetchall():
- self.conn.execute("DROP TABLE %s" % table[0])
-
def test_schema_support(self):
# only test this for postgresql (schema's not supported in mysql/sqlite)
df = DataFrame({'col1':[1, 2], 'col2':[0.1, 0.2], 'col3':['a', 'n']})
@@ -1694,7 +1726,7 @@ class TestSQLiteAlchemyConn(_TestSQLiteAlchemy, _TestSQLAlchemyConn):
#------------------------------------------------------------------------------
#--- Test Sqlite / MySQL fallback
-class TestSQLiteFallback(PandasSQLTest):
+class TestSQLiteFallback(SQLiteMixIn, PandasSQLTest):
"""
Test the fallback mode against an in-memory sqlite database.
@@ -1705,11 +1737,6 @@ class TestSQLiteFallback(PandasSQLTest):
def connect(cls):
return sqlite3.connect(':memory:')
- def drop_table(self, table_name):
- cur = self.conn.cursor()
- cur.execute("DROP TABLE IF EXISTS %s" % table_name)
- self.conn.commit()
-
def setUp(self):
self.conn = self.connect()
self.pandasSQL = sql.SQLiteDatabase(self.conn, 'sqlite')
@@ -1856,7 +1883,7 @@ def test_illegal_names(self):
for ndx, weird_name in enumerate(['test_weird_name]','test_weird_name[',
'test_weird_name`','test_weird_name"', 'test_weird_name\'',
'_b.test_weird_name_01-30', '"_b.test_weird_name_01-30"',
- '12345','12345blah']):
+ '99beginswithnumber', '12345']):
df.to_sql(weird_name, self.conn, flavor=self.flavor)
sql.table_exists(weird_name, self.conn)
@@ -1866,7 +1893,7 @@ def test_illegal_names(self):
sql.table_exists(c_tbl, self.conn)
-class TestMySQLLegacy(TestSQLiteFallback):
+class TestMySQLLegacy(MySQLMixIn, TestSQLiteFallback):
"""
Test the legacy mode against a MySQL database.
@@ -1895,11 +1922,6 @@ def setup_driver(cls):
def connect(cls):
return cls.driver.connect(host='127.0.0.1', user='root', passwd='', db='pandas_nosetest')
- def drop_table(self, table_name):
- cur = self.conn.cursor()
- cur.execute("DROP TABLE IF EXISTS %s" % table_name)
- self.conn.commit()
-
def _count_rows(self, table_name):
cur = self._get_exec()
cur.execute(
@@ -1918,14 +1940,6 @@ def setUp(self):
self._load_iris_data()
self._load_test1_data()
- def tearDown(self):
- c = self.conn.cursor()
- c.execute('SHOW TABLES')
- for table in c.fetchall():
- c.execute('DROP TABLE %s' % table[0])
- self.conn.commit()
- self.conn.close()
-
def test_a_deprecation(self):
with tm.assert_produces_warning(FutureWarning):
sql.to_sql(self.test_frame1, 'test_frame1', self.conn,
@@ -1963,14 +1977,10 @@ def test_illegal_names(self):
for ndx, ok_name in enumerate(['99beginswithnumber','12345']):
df.to_sql(ok_name, self.conn, flavor=self.flavor, index=False,
if_exists='replace')
- self.conn.cursor().execute("DROP TABLE `%s`" % ok_name)
- self.conn.commit()
df2 = DataFrame([[1, 2], [3, 4]], columns=['a', ok_name])
- c_tbl = 'test_ok_col_name%d'%ndx
- df2.to_sql(c_tbl, self.conn, flavor=self.flavor, index=False,
+
+ df2.to_sql('test_ok_col_name', self.conn, flavor=self.flavor, index=False,
if_exists='replace')
- self.conn.cursor().execute("DROP TABLE `%s`" % c_tbl)
- self.conn.commit()
# For MySQL, these should raise ValueError
for ndx, illegal_name in enumerate(['test_illegal_name]','test_illegal_name[',
@@ -1979,8 +1989,7 @@ def test_illegal_names(self):
flavor=self.flavor, index=False)
df2 = DataFrame([[1, 2], [3, 4]], columns=['a', illegal_name])
- c_tbl = 'test_illegal_col_name%d'%ndx
- self.assertRaises(ValueError, df2.to_sql, c_tbl,
+ self.assertRaises(ValueError, df2.to_sql, 'test_illegal_col_name%d'%ndx,
self.conn, flavor=self.flavor, index=False)
@@ -2022,10 +2031,10 @@ def _skip_if_no_pymysql():
raise nose.SkipTest('pymysql not installed, skipping')
-class TestXSQLite(tm.TestCase):
+class TestXSQLite(SQLiteMixIn, tm.TestCase):
def setUp(self):
- self.db = sqlite3.connect(':memory:')
+ self.conn = sqlite3.connect(':memory:')
def test_basic(self):
frame = tm.makeTimeDataFrame()
@@ -2036,34 +2045,34 @@ def test_write_row_by_row(self):
frame = tm.makeTimeDataFrame()
frame.ix[0, 0] = np.nan
create_sql = sql.get_schema(frame, 'test', 'sqlite')
- cur = self.db.cursor()
+ cur = self.conn.cursor()
cur.execute(create_sql)
- cur = self.db.cursor()
+ cur = self.conn.cursor()
ins = "INSERT INTO test VALUES (%s, %s, %s, %s)"
for idx, row in frame.iterrows():
fmt_sql = format_query(ins, *row)
sql.tquery(fmt_sql, cur=cur)
- self.db.commit()
+ self.conn.commit()
- result = sql.read_frame("select * from test", con=self.db)
+ result = sql.read_frame("select * from test", con=self.conn)
result.index = frame.index
tm.assert_frame_equal(result, frame)
def test_execute(self):
frame = tm.makeTimeDataFrame()
create_sql = sql.get_schema(frame, 'test', 'sqlite')
- cur = self.db.cursor()
+ cur = self.conn.cursor()
cur.execute(create_sql)
ins = "INSERT INTO test VALUES (?, ?, ?, ?)"
row = frame.ix[0]
- sql.execute(ins, self.db, params=tuple(row))
- self.db.commit()
+ sql.execute(ins, self.conn, params=tuple(row))
+ self.conn.commit()
- result = sql.read_frame("select * from test", self.db)
+ result = sql.read_frame("select * from test", self.conn)
result.index = frame.index[:1]
tm.assert_frame_equal(result, frame[:1])
@@ -2080,7 +2089,7 @@ def test_schema(self):
create_sql = sql.get_schema(frame, 'test', 'sqlite', keys=['A', 'B'],)
lines = create_sql.splitlines()
self.assertTrue('PRIMARY KEY ("A", "B")' in create_sql)
- cur = self.db.cursor()
+ cur = self.conn.cursor()
cur.execute(create_sql)
def test_execute_fail(self):
@@ -2093,17 +2102,17 @@ def test_execute_fail(self):
PRIMARY KEY (a, b)
);
"""
- cur = self.db.cursor()
+ cur = self.conn.cursor()
cur.execute(create_sql)
- sql.execute('INSERT INTO test VALUES("foo", "bar", 1.234)', self.db)
- sql.execute('INSERT INTO test VALUES("foo", "baz", 2.567)', self.db)
+ sql.execute('INSERT INTO test VALUES("foo", "bar", 1.234)', self.conn)
+ sql.execute('INSERT INTO test VALUES("foo", "baz", 2.567)', self.conn)
try:
sys.stdout = StringIO()
self.assertRaises(Exception, sql.execute,
'INSERT INTO test VALUES("foo", "bar", 7)',
- self.db)
+ self.conn)
finally:
sys.stdout = sys.__stdout__
@@ -2117,24 +2126,27 @@ def test_execute_closed_connection(self):
PRIMARY KEY (a, b)
);
"""
- cur = self.db.cursor()
+ cur = self.conn.cursor()
cur.execute(create_sql)
- sql.execute('INSERT INTO test VALUES("foo", "bar", 1.234)', self.db)
- self.db.close()
+ sql.execute('INSERT INTO test VALUES("foo", "bar", 1.234)', self.conn)
+ self.conn.close()
try:
sys.stdout = StringIO()
self.assertRaises(Exception, sql.tquery, "select * from test",
- con=self.db)
+ con=self.conn)
finally:
sys.stdout = sys.__stdout__
+ # Initialize connection again (needed for tearDown)
+ self.setUp()
+
def test_na_roundtrip(self):
pass
def _check_roundtrip(self, frame):
- sql.write_frame(frame, name='test_table', con=self.db)
- result = sql.read_frame("select * from test_table", self.db)
+ sql.write_frame(frame, name='test_table', con=self.conn)
+ result = sql.read_frame("select * from test_table", self.conn)
# HACK! Change this once indexes are handled properly.
result.index = frame.index
@@ -2145,8 +2157,8 @@ def _check_roundtrip(self, frame):
frame['txt'] = ['a'] * len(frame)
frame2 = frame.copy()
frame2['Idx'] = Index(lrange(len(frame2))) + 10
- sql.write_frame(frame2, name='test_table2', con=self.db)
- result = sql.read_frame("select * from test_table2", self.db,
+ sql.write_frame(frame2, name='test_table2', con=self.conn)
+ result = sql.read_frame("select * from test_table2", self.conn,
index_col='Idx')
expected = frame.copy()
expected.index = Index(lrange(len(frame2))) + 10
@@ -2155,8 +2167,8 @@ def _check_roundtrip(self, frame):
def test_tquery(self):
frame = tm.makeTimeDataFrame()
- sql.write_frame(frame, name='test_table', con=self.db)
- result = sql.tquery("select A from test_table", self.db)
+ sql.write_frame(frame, name='test_table', con=self.conn)
+ result = sql.tquery("select A from test_table", self.conn)
expected = Series(frame.A.values, frame.index) # not to have name
result = Series(result, frame.index)
tm.assert_series_equal(result, expected)
@@ -2164,27 +2176,27 @@ def test_tquery(self):
try:
sys.stdout = StringIO()
self.assertRaises(sql.DatabaseError, sql.tquery,
- 'select * from blah', con=self.db)
+ 'select * from blah', con=self.conn)
self.assertRaises(sql.DatabaseError, sql.tquery,
- 'select * from blah', con=self.db, retry=True)
+ 'select * from blah', con=self.conn, retry=True)
finally:
sys.stdout = sys.__stdout__
def test_uquery(self):
frame = tm.makeTimeDataFrame()
- sql.write_frame(frame, name='test_table', con=self.db)
+ sql.write_frame(frame, name='test_table', con=self.conn)
stmt = 'INSERT INTO test_table VALUES(2.314, -123.1, 1.234, 2.3)'
- self.assertEqual(sql.uquery(stmt, con=self.db), 1)
+ self.assertEqual(sql.uquery(stmt, con=self.conn), 1)
try:
sys.stdout = StringIO()
self.assertRaises(sql.DatabaseError, sql.tquery,
- 'insert into blah values (1)', con=self.db)
+ 'insert into blah values (1)', con=self.conn)
self.assertRaises(sql.DatabaseError, sql.tquery,
- 'insert into blah values (1)', con=self.db,
+ 'insert into blah values (1)', con=self.conn,
retry=True)
finally:
sys.stdout = sys.__stdout__
@@ -2193,16 +2205,16 @@ def test_keyword_as_column_names(self):
'''
'''
df = DataFrame({'From':np.ones(5)})
- sql.write_frame(df, con = self.db, name = 'testkeywords')
+ sql.write_frame(df, con = self.conn, name = 'testkeywords')
def test_onecolumn_of_integer(self):
# GH 3628
# a column_of_integers dataframe should transfer well to sql
mono_df=DataFrame([1 , 2], columns=['c0'])
- sql.write_frame(mono_df, con = self.db, name = 'mono_df')
+ sql.write_frame(mono_df, con = self.conn, name = 'mono_df')
# computing the sum via sql
- con_x=self.db
+ con_x=self.conn
the_sum=sum([my_c0[0] for my_c0 in con_x.execute("select * from mono_df")])
# it should not fail, and gives 3 ( Issue #3628 )
self.assertEqual(the_sum , 3)
@@ -2221,56 +2233,53 @@ def clean_up(test_table_to_drop):
Drops tables created from individual tests
so no dependencies arise from sequential tests
"""
- if sql.table_exists(test_table_to_drop, self.db, flavor='sqlite'):
- cur = self.db.cursor()
- cur.execute("DROP TABLE %s" % test_table_to_drop)
- cur.close()
+ self.drop_table(test_table_to_drop)
# test if invalid value for if_exists raises appropriate error
self.assertRaises(ValueError,
sql.write_frame,
frame=df_if_exists_1,
- con=self.db,
+ con=self.conn,
name=table_name,
flavor='sqlite',
if_exists='notvalidvalue')
clean_up(table_name)
# test if_exists='fail'
- sql.write_frame(frame=df_if_exists_1, con=self.db, name=table_name,
+ sql.write_frame(frame=df_if_exists_1, con=self.conn, name=table_name,
flavor='sqlite', if_exists='fail')
self.assertRaises(ValueError,
sql.write_frame,
frame=df_if_exists_1,
- con=self.db,
+ con=self.conn,
name=table_name,
flavor='sqlite',
if_exists='fail')
# test if_exists='replace'
- sql.write_frame(frame=df_if_exists_1, con=self.db, name=table_name,
+ sql.write_frame(frame=df_if_exists_1, con=self.conn, name=table_name,
flavor='sqlite', if_exists='replace')
- self.assertEqual(sql.tquery(sql_select, con=self.db),
+ self.assertEqual(sql.tquery(sql_select, con=self.conn),
[(1, 'A'), (2, 'B')])
- sql.write_frame(frame=df_if_exists_2, con=self.db, name=table_name,
+ sql.write_frame(frame=df_if_exists_2, con=self.conn, name=table_name,
flavor='sqlite', if_exists='replace')
- self.assertEqual(sql.tquery(sql_select, con=self.db),
+ self.assertEqual(sql.tquery(sql_select, con=self.conn),
[(3, 'C'), (4, 'D'), (5, 'E')])
clean_up(table_name)
# test if_exists='append'
- sql.write_frame(frame=df_if_exists_1, con=self.db, name=table_name,
+ sql.write_frame(frame=df_if_exists_1, con=self.conn, name=table_name,
flavor='sqlite', if_exists='fail')
- self.assertEqual(sql.tquery(sql_select, con=self.db),
+ self.assertEqual(sql.tquery(sql_select, con=self.conn),
[(1, 'A'), (2, 'B')])
- sql.write_frame(frame=df_if_exists_2, con=self.db, name=table_name,
+ sql.write_frame(frame=df_if_exists_2, con=self.conn, name=table_name,
flavor='sqlite', if_exists='append')
- self.assertEqual(sql.tquery(sql_select, con=self.db),
+ self.assertEqual(sql.tquery(sql_select, con=self.conn),
[(1, 'A'), (2, 'B'), (3, 'C'), (4, 'D'), (5, 'E')])
clean_up(table_name)
-class TestXMySQL(tm.TestCase):
+class TestXMySQL(MySQLMixIn, tm.TestCase):
@classmethod
def setUpClass(cls):
@@ -2307,14 +2316,14 @@ def setUp(self):
try:
# Try Travis defaults.
# No real user should allow root access with a blank password.
- self.db = pymysql.connect(host='localhost', user='root', passwd='',
+ self.conn = pymysql.connect(host='localhost', user='root', passwd='',
db='pandas_nosetest')
except:
pass
else:
return
try:
- self.db = pymysql.connect(read_default_group='pandas')
+ self.conn = pymysql.connect(read_default_group='pandas')
except pymysql.ProgrammingError as e:
raise nose.SkipTest(
"Create a group of connection parameters under the heading "
@@ -2327,12 +2336,6 @@ def setUp(self):
"[pandas] in your system's mysql default file, "
"typically located at ~/.my.cnf or /etc/.my.cnf. ")
- def tearDown(self):
- from pymysql.err import Error
- try:
- self.db.close()
- except Error:
- pass
def test_basic(self):
_skip_if_no_pymysql()
@@ -2346,7 +2349,7 @@ def test_write_row_by_row(self):
frame.ix[0, 0] = np.nan
drop_sql = "DROP TABLE IF EXISTS test"
create_sql = sql.get_schema(frame, 'test', 'mysql')
- cur = self.db.cursor()
+ cur = self.conn.cursor()
cur.execute(drop_sql)
cur.execute(create_sql)
ins = "INSERT INTO test VALUES (%s, %s, %s, %s)"
@@ -2354,9 +2357,9 @@ def test_write_row_by_row(self):
fmt_sql = format_query(ins, *row)
sql.tquery(fmt_sql, cur=cur)
- self.db.commit()
+ self.conn.commit()
- result = sql.read_frame("select * from test", con=self.db)
+ result = sql.read_frame("select * from test", con=self.conn)
result.index = frame.index
tm.assert_frame_equal(result, frame)
@@ -2365,7 +2368,7 @@ def test_execute(self):
frame = tm.makeTimeDataFrame()
drop_sql = "DROP TABLE IF EXISTS test"
create_sql = sql.get_schema(frame, 'test', 'mysql')
- cur = self.db.cursor()
+ cur = self.conn.cursor()
with warnings.catch_warnings():
warnings.filterwarnings("ignore", "Unknown table.*")
cur.execute(drop_sql)
@@ -2373,10 +2376,10 @@ def test_execute(self):
ins = "INSERT INTO test VALUES (%s, %s, %s, %s)"
row = frame.ix[0].values.tolist()
- sql.execute(ins, self.db, params=tuple(row))
- self.db.commit()
+ sql.execute(ins, self.conn, params=tuple(row))
+ self.conn.commit()
- result = sql.read_frame("select * from test", self.db)
+ result = sql.read_frame("select * from test", self.conn)
result.index = frame.index[:1]
tm.assert_frame_equal(result, frame[:1])
@@ -2395,7 +2398,7 @@ def test_schema(self):
create_sql = sql.get_schema(frame, 'test', 'mysql', keys=['A', 'B'],)
lines = create_sql.splitlines()
self.assertTrue('PRIMARY KEY (`A`, `B`)' in create_sql)
- cur = self.db.cursor()
+ cur = self.conn.cursor()
cur.execute(drop_sql)
cur.execute(create_sql)
@@ -2411,18 +2414,18 @@ def test_execute_fail(self):
PRIMARY KEY (a(5), b(5))
);
"""
- cur = self.db.cursor()
+ cur = self.conn.cursor()
cur.execute(drop_sql)
cur.execute(create_sql)
- sql.execute('INSERT INTO test VALUES("foo", "bar", 1.234)', self.db)
- sql.execute('INSERT INTO test VALUES("foo", "baz", 2.567)', self.db)
+ sql.execute('INSERT INTO test VALUES("foo", "bar", 1.234)', self.conn)
+ sql.execute('INSERT INTO test VALUES("foo", "baz", 2.567)', self.conn)
try:
sys.stdout = StringIO()
self.assertRaises(Exception, sql.execute,
'INSERT INTO test VALUES("foo", "bar", 7)',
- self.db)
+ self.conn)
finally:
sys.stdout = sys.__stdout__
@@ -2438,19 +2441,23 @@ def test_execute_closed_connection(self):
PRIMARY KEY (a(5), b(5))
);
"""
- cur = self.db.cursor()
+ cur = self.conn.cursor()
cur.execute(drop_sql)
cur.execute(create_sql)
- sql.execute('INSERT INTO test VALUES("foo", "bar", 1.234)', self.db)
- self.db.close()
+ sql.execute('INSERT INTO test VALUES("foo", "bar", 1.234)', self.conn)
+ self.conn.close()
try:
sys.stdout = StringIO()
self.assertRaises(Exception, sql.tquery, "select * from test",
- con=self.db)
+ con=self.conn)
finally:
sys.stdout = sys.__stdout__
+ # Initialize connection again (needed for tearDown)
+ self.setUp()
+
+
def test_na_roundtrip(self):
_skip_if_no_pymysql()
pass
@@ -2458,12 +2465,12 @@ def test_na_roundtrip(self):
def _check_roundtrip(self, frame):
_skip_if_no_pymysql()
drop_sql = "DROP TABLE IF EXISTS test_table"
- cur = self.db.cursor()
+ cur = self.conn.cursor()
with warnings.catch_warnings():
warnings.filterwarnings("ignore", "Unknown table.*")
cur.execute(drop_sql)
- sql.write_frame(frame, name='test_table', con=self.db, flavor='mysql')
- result = sql.read_frame("select * from test_table", self.db)
+ sql.write_frame(frame, name='test_table', con=self.conn, flavor='mysql')
+ result = sql.read_frame("select * from test_table", self.conn)
# HACK! Change this once indexes are handled properly.
result.index = frame.index
@@ -2477,12 +2484,12 @@ def _check_roundtrip(self, frame):
index = Index(lrange(len(frame2))) + 10
frame2['Idx'] = index
drop_sql = "DROP TABLE IF EXISTS test_table2"
- cur = self.db.cursor()
+ cur = self.conn.cursor()
with warnings.catch_warnings():
warnings.filterwarnings("ignore", "Unknown table.*")
cur.execute(drop_sql)
- sql.write_frame(frame2, name='test_table2', con=self.db, flavor='mysql')
- result = sql.read_frame("select * from test_table2", self.db,
+ sql.write_frame(frame2, name='test_table2', con=self.conn, flavor='mysql')
+ result = sql.read_frame("select * from test_table2", self.conn,
index_col='Idx')
expected = frame.copy()
@@ -2498,10 +2505,10 @@ def test_tquery(self):
raise nose.SkipTest("no pymysql")
frame = tm.makeTimeDataFrame()
drop_sql = "DROP TABLE IF EXISTS test_table"
- cur = self.db.cursor()
+ cur = self.conn.cursor()
cur.execute(drop_sql)
- sql.write_frame(frame, name='test_table', con=self.db, flavor='mysql')
- result = sql.tquery("select A from test_table", self.db)
+ sql.write_frame(frame, name='test_table', con=self.conn, flavor='mysql')
+ result = sql.tquery("select A from test_table", self.conn)
expected = Series(frame.A.values, frame.index) # not to have name
result = Series(result, frame.index)
tm.assert_series_equal(result, expected)
@@ -2509,10 +2516,10 @@ def test_tquery(self):
try:
sys.stdout = StringIO()
self.assertRaises(sql.DatabaseError, sql.tquery,
- 'select * from blah', con=self.db)
+ 'select * from blah', con=self.conn)
self.assertRaises(sql.DatabaseError, sql.tquery,
- 'select * from blah', con=self.db, retry=True)
+ 'select * from blah', con=self.conn, retry=True)
finally:
sys.stdout = sys.__stdout__
@@ -2523,20 +2530,20 @@ def test_uquery(self):
raise nose.SkipTest("no pymysql")
frame = tm.makeTimeDataFrame()
drop_sql = "DROP TABLE IF EXISTS test_table"
- cur = self.db.cursor()
+ cur = self.conn.cursor()
cur.execute(drop_sql)
- sql.write_frame(frame, name='test_table', con=self.db, flavor='mysql')
+ sql.write_frame(frame, name='test_table', con=self.conn, flavor='mysql')
stmt = 'INSERT INTO test_table VALUES(2.314, -123.1, 1.234, 2.3)'
- self.assertEqual(sql.uquery(stmt, con=self.db), 1)
+ self.assertEqual(sql.uquery(stmt, con=self.conn), 1)
try:
sys.stdout = StringIO()
self.assertRaises(sql.DatabaseError, sql.tquery,
- 'insert into blah values (1)', con=self.db)
+ 'insert into blah values (1)', con=self.conn)
self.assertRaises(sql.DatabaseError, sql.tquery,
- 'insert into blah values (1)', con=self.db,
+ 'insert into blah values (1)', con=self.conn,
retry=True)
finally:
sys.stdout = sys.__stdout__
@@ -2546,7 +2553,7 @@ def test_keyword_as_column_names(self):
'''
_skip_if_no_pymysql()
df = DataFrame({'From':np.ones(5)})
- sql.write_frame(df, con = self.db, name = 'testkeywords',
+ sql.write_frame(df, con = self.conn, name = 'testkeywords',
if_exists='replace', flavor='mysql')
def test_if_exists(self):
@@ -2561,51 +2568,48 @@ def clean_up(test_table_to_drop):
Drops tables created from individual tests
so no dependencies arise from sequential tests
"""
- if sql.table_exists(test_table_to_drop, self.db, flavor='mysql'):
- cur = self.db.cursor()
- cur.execute("DROP TABLE %s" % test_table_to_drop)
- cur.close()
+ self.drop_table(test_table_to_drop)
# test if invalid value for if_exists raises appropriate error
self.assertRaises(ValueError,
sql.write_frame,
frame=df_if_exists_1,
- con=self.db,
+ con=self.conn,
name=table_name,
flavor='mysql',
if_exists='notvalidvalue')
clean_up(table_name)
# test if_exists='fail'
- sql.write_frame(frame=df_if_exists_1, con=self.db, name=table_name,
+ sql.write_frame(frame=df_if_exists_1, con=self.conn, name=table_name,
flavor='mysql', if_exists='fail')
self.assertRaises(ValueError,
sql.write_frame,
frame=df_if_exists_1,
- con=self.db,
+ con=self.conn,
name=table_name,
flavor='mysql',
if_exists='fail')
# test if_exists='replace'
- sql.write_frame(frame=df_if_exists_1, con=self.db, name=table_name,
+ sql.write_frame(frame=df_if_exists_1, con=self.conn, name=table_name,
flavor='mysql', if_exists='replace')
- self.assertEqual(sql.tquery(sql_select, con=self.db),
+ self.assertEqual(sql.tquery(sql_select, con=self.conn),
[(1, 'A'), (2, 'B')])
- sql.write_frame(frame=df_if_exists_2, con=self.db, name=table_name,
+ sql.write_frame(frame=df_if_exists_2, con=self.conn, name=table_name,
flavor='mysql', if_exists='replace')
- self.assertEqual(sql.tquery(sql_select, con=self.db),
+ self.assertEqual(sql.tquery(sql_select, con=self.conn),
[(3, 'C'), (4, 'D'), (5, 'E')])
clean_up(table_name)
# test if_exists='append'
- sql.write_frame(frame=df_if_exists_1, con=self.db, name=table_name,
+ sql.write_frame(frame=df_if_exists_1, con=self.conn, name=table_name,
flavor='mysql', if_exists='fail')
- self.assertEqual(sql.tquery(sql_select, con=self.db),
+ self.assertEqual(sql.tquery(sql_select, con=self.conn),
[(1, 'A'), (2, 'B')])
- sql.write_frame(frame=df_if_exists_2, con=self.db, name=table_name,
+ sql.write_frame(frame=df_if_exists_2, con=self.conn, name=table_name,
flavor='mysql', if_exists='append')
- self.assertEqual(sql.tquery(sql_select, con=self.db),
+ self.assertEqual(sql.tquery(sql_select, con=self.conn),
[(1, 'A'), (2, 'B'), (3, 'C'), (4, 'D'), (5, 'E')])
clean_up(table_name)
| Closes #10255 .
Rewrote some of the code in `test_sql.py` so that it now properly drops tables with names that need to be quoted.
| https://api.github.com/repos/pandas-dev/pandas/pulls/10262 | 2015-06-03T19:38:14Z | 2015-07-10T23:17:52Z | 2015-07-10T23:17:52Z | 2015-07-10T23:17:58Z |
BUG: SparseSeries constructor ignores input data name | diff --git a/doc/source/whatsnew/v0.16.2.txt b/doc/source/whatsnew/v0.16.2.txt
index b571aab0b19a5..8e30e90087bcb 100644
--- a/doc/source/whatsnew/v0.16.2.txt
+++ b/doc/source/whatsnew/v0.16.2.txt
@@ -80,6 +80,6 @@ Bug Fixes
- Bug in GroupBy.get_group raises ValueError when group key contains NaT (:issue:`6992`)
-
+- Bug in ``SparseSeries`` constructor ignores input data name (:issue:`10258`)
- Bug where infer_freq infers timerule (WOM-5XXX) unsupported by to_offset (:issue:`9425`)
diff --git a/pandas/sparse/series.py b/pandas/sparse/series.py
index f53cc66bee961..24d06970f4741 100644
--- a/pandas/sparse/series.py
+++ b/pandas/sparse/series.py
@@ -121,6 +121,9 @@ def __init__(self, data=None, index=None, sparse_index=None, kind='block',
if data is None:
data = []
+ if isinstance(data, Series) and name is None:
+ name = data.name
+
is_sparse_array = isinstance(data, SparseArray)
if fill_value is None:
if is_sparse_array:
diff --git a/pandas/sparse/tests/test_sparse.py b/pandas/sparse/tests/test_sparse.py
index a7a78ba226a0b..96e5ff87fbb0c 100644
--- a/pandas/sparse/tests/test_sparse.py
+++ b/pandas/sparse/tests/test_sparse.py
@@ -128,14 +128,15 @@ def setUp(self):
date_index = bdate_range('1/1/2011', periods=len(index))
- self.bseries = SparseSeries(arr, index=index, kind='block')
- self.bseries.name = 'bseries'
+ self.bseries = SparseSeries(arr, index=index, kind='block',
+ name='bseries')
self.ts = self.bseries
self.btseries = SparseSeries(arr, index=date_index, kind='block')
- self.iseries = SparseSeries(arr, index=index, kind='integer')
+ self.iseries = SparseSeries(arr, index=index, kind='integer',
+ name='iseries')
arr, index = _test_data2()
self.bseries2 = SparseSeries(arr, index=index, kind='block')
@@ -143,7 +144,7 @@ def setUp(self):
arr, index = _test_data1_zero()
self.zbseries = SparseSeries(arr, index=index, kind='block',
- fill_value=0)
+ fill_value=0, name='zbseries')
self.ziseries = SparseSeries(arr, index=index, kind='integer',
fill_value=0)
@@ -234,12 +235,21 @@ def test_constructor(self):
self.bseries.to_dense().fillna(0).values)
# pass SparseSeries
- s2 = SparseSeries(self.bseries)
- s3 = SparseSeries(self.iseries)
- s4 = SparseSeries(self.zbseries)
- assert_sp_series_equal(s2, self.bseries)
- assert_sp_series_equal(s3, self.iseries)
- assert_sp_series_equal(s4, self.zbseries)
+ def _check_const(sparse, name):
+ # use passed series name
+ result = SparseSeries(sparse)
+ assert_sp_series_equal(result, sparse)
+ self.assertEqual(sparse.name, name)
+ self.assertEqual(result.name, name)
+
+ # use passed name
+ result = SparseSeries(sparse, name='x')
+ assert_sp_series_equal(result, sparse)
+ self.assertEqual(result.name, 'x')
+
+ _check_const(self.bseries, 'bseries')
+ _check_const(self.iseries, 'iseries')
+ _check_const(self.zbseries, 'zbseries')
# Sparse time series works
date_index = bdate_range('1/1/2000', periods=len(self.bseries))
| When constructing `Series` from `Series`, name attribute is preserved otherwise specified.
```
import pandas as pd
s = pd.Series([1, 2, 3], name='a')
pd.Series(s)
#0 1
#1 2
#2 3
# Name: a, dtype: int64
pd.Series(s, name='x')
#0 1
#1 2
#2 3
# Name: x, dtype: int64
```
But `SparseSeries` doesn't preserve its name.
```
s = pd.SparseSeries([1, 2, 3], name='a')
pd.SparseSeries(s)
#0 1
#1 2
#2 3
# dtype: int64
# BlockIndex
# Block locations: array([0], dtype=int32)
# Block lengths: array([3], dtype=int32)
```
| https://api.github.com/repos/pandas-dev/pandas/pulls/10258 | 2015-06-03T12:07:26Z | 2015-06-03T21:21:22Z | 2015-06-03T21:21:22Z | 2015-06-04T13:16:14Z |
add numba example to enhancingperf.rst | diff --git a/doc/source/enhancingperf.rst b/doc/source/enhancingperf.rst
index d007446a5b922..54fd0a2131861 100644
--- a/doc/source/enhancingperf.rst
+++ b/doc/source/enhancingperf.rst
@@ -7,7 +7,7 @@
import os
import csv
- from pandas import DataFrame
+ from pandas import DataFrame, Series
import pandas as pd
pd.options.display.max_rows=15
@@ -68,9 +68,10 @@ Here's the function in pure python:
We achieve our result by using ``apply`` (row-wise):
-.. ipython:: python
+.. code-block:: python
- %timeit df.apply(lambda x: integrate_f(x['a'], x['b'], x['N']), axis=1)
+ In [7]: %timeit df.apply(lambda x: integrate_f(x['a'], x['b'], x['N']), axis=1)
+ 10 loops, best of 3: 174 ms per loop
But clearly this isn't fast enough for us. Let's take a look and see where the
time is spent during this operation (limited to the most time consuming
@@ -97,7 +98,7 @@ First we're going to need to import the cython magic function to ipython:
.. ipython:: python
- %load_ext cythonmagic
+ %load_ext Cython
Now, let's simply copy our functions over to cython as is (the suffix
@@ -122,9 +123,10 @@ is here to distinguish between function versions):
to be using bleeding edge ipython for paste to play well with cell magics.
-.. ipython:: python
+.. code-block:: python
- %timeit df.apply(lambda x: integrate_f_plain(x['a'], x['b'], x['N']), axis=1)
+ In [4]: %timeit df.apply(lambda x: integrate_f_plain(x['a'], x['b'], x['N']), axis=1)
+ 10 loops, best of 3: 85.5 ms per loop
Already this has shaved a third off, not too bad for a simple copy and paste.
@@ -150,9 +152,10 @@ We get another huge improvement simply by providing type information:
...: return s * dx
...:
-.. ipython:: python
+.. code-block:: python
- %timeit df.apply(lambda x: integrate_f_typed(x['a'], x['b'], x['N']), axis=1)
+ In [4]: %timeit df.apply(lambda x: integrate_f_typed(x['a'], x['b'], x['N']), axis=1)
+ 10 loops, best of 3: 20.3 ms per loop
Now, we're talking! It's now over ten times faster than the original python
implementation, and we haven't *really* modified the code. Let's have another
@@ -229,9 +232,10 @@ the rows, applying our ``integrate_f_typed``, and putting this in the zeros arra
Loops like this would be *extremely* slow in python, but in Cython looping
over numpy arrays is *fast*.
-.. ipython:: python
+.. code-block:: python
- %timeit apply_integrate_f(df['a'].values, df['b'].values, df['N'].values)
+ In [4]: %timeit apply_integrate_f(df['a'].values, df['b'].values, df['N'].values)
+ 1000 loops, best of 3: 1.25 ms per loop
We've gotten another big improvement. Let's check again where the time is spent:
@@ -278,20 +282,70 @@ advanced cython techniques:
...: return res
...:
-.. ipython:: python
+.. code-block:: python
- %timeit apply_integrate_f_wrap(df['a'].values, df['b'].values, df['N'].values)
+ In [4]: %timeit apply_integrate_f_wrap(df['a'].values, df['b'].values, df['N'].values)
+ 1000 loops, best of 3: 987 us per loop
Even faster, with the caveat that a bug in our cython code (an off-by-one error,
for example) might cause a segfault because memory access isn't checked.
-Further topics
-~~~~~~~~~~~~~~
+.. _enhancingperf.numba:
+
+Using numba
+-----------
+
+A recent alternative to statically compiling cython code, is to use a *dynamic jit-compiler*, ``numba``.
+
+Numba gives you the power to speed up your applications with high performance functions written directly in Python. With a few annotations, array-oriented and math-heavy Python code can be just-in-time compiled to native machine instructions, similar in performance to C, C++ and Fortran, without having to switch languages or Python interpreters.
+
+Numba works by generating optimized machine code using the LLVM compiler infrastructure at import time, runtime, or statically (using the included pycc tool). Numba supports compilation of Python to run on either CPU or GPU hardware, and is designed to integrate with the Python scientific software stack.
+
+.. note::
+
+ You will need to install ``numba``. This is easy with ``conda``, by using: ``conda install numba``, see :ref:`installing using miniconda<install.miniconda>`.
+
+We simply take the plain python code from above and annotate with the ``@jit`` decorator.
+
+.. code-block:: python
+
+ import numba
+
+ @numba.jit
+ def f_plain(x):
+ return x * (x - 1)
+
+ @numba.jit
+ def integrate_f_numba(a, b, N):
+ s = 0
+ dx = (b - a) / N
+ for i in range(N):
+ s += f_plain(a + i * dx)
+ return s * dx
+
+ @numba.jit
+ def apply_integrate_f_numba(col_a, col_b, col_N):
+ n = len(col_N)
+ result = np.empty(n, dtype='float64')
+ assert len(col_a) == len(col_b) == n
+ for i in range(n):
+ result[i] = integrate_f_numba(col_a[i], col_b[i], col_N[i])
+ return result
+
+ def compute_numba(df):
+ result = apply_integrate_f_numba(df['a'].values, df['b'].values, df['N'].values)
+ return Series(result, index=df.index, name='result')
+
+Similar to above, we directly pass ``numpy`` arrays directly to the numba function. Further
+we are wrapping the results to provide a nice interface by passing/returning pandas objects.
+
+.. code-block:: python
-- Loading C modules into cython.
+ In [4]: %timeit compute_numba(df)
+ 1000 loops, best of 3: 798 us per loop
-Read more in the `cython docs <http://docs.cython.org/>`__.
+Read more in the `numba docs <http://numba.pydata.org/>`__.
.. _enhancingperf.eval:
diff --git a/doc/source/whatsnew/v0.16.2.txt b/doc/source/whatsnew/v0.16.2.txt
index b571aab0b19a5..aede460766922 100644
--- a/doc/source/whatsnew/v0.16.2.txt
+++ b/doc/source/whatsnew/v0.16.2.txt
@@ -9,6 +9,8 @@ We recommend that all users upgrade to this version.
Highlights include:
+- Documentation on how to use ``numba`` with *pandas*, see :ref:`here <enhancingperf.numba>`
+
Check the :ref:`API Changes <whatsnew_0162.api>` before updating.
.. contents:: What's new in v0.16.2
| 
| https://api.github.com/repos/pandas-dev/pandas/pulls/10257 | 2015-06-03T11:57:09Z | 2015-06-03T19:10:10Z | 2015-06-03T19:10:10Z | 2015-06-03T19:10:23Z |
ENH: Add pipe method | diff --git a/doc/source/basics.rst b/doc/source/basics.rst
index d16feb3a6c448..349e7e25fdafb 100644
--- a/doc/source/basics.rst
+++ b/doc/source/basics.rst
@@ -624,6 +624,77 @@ We can also pass infinite values to define the bins:
Function application
--------------------
+To apply your own or another library's functions to pandas objects,
+you should be aware of the three methods below. The appropriate
+method to use depends on whether your function expects to operate
+on an entire ``DataFrame`` or ``Series``, row- or column-wise, or elementwise.
+
+1. `Tablewise Function Application`_: :meth:`~DataFrame.pipe`
+2. `Row or Column-wise Function Application`_: :meth:`~DataFrame.apply`
+3. Elementwise_ function application: :meth:`~DataFrame.applymap`
+
+.. _basics.pipe:
+
+Tablewise Function Application
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. versionadded:: 0.16.2
+
+``DataFrames`` and ``Series`` can of course just be passed into functions.
+However, if the function needs to be called in a chain, consider using the :meth:`~DataFrame.pipe` method.
+Compare the following
+
+.. code-block:: python
+
+ # f, g, and h are functions taking and returning ``DataFrames``
+ >>> f(g(h(df), arg1=1), arg2=2, arg3=3)
+
+with the equivalent
+
+.. code-block:: python
+
+ >>> (df.pipe(h)
+ .pipe(g, arg1=1)
+ .pipe(f, arg2=2, arg3=3)
+ )
+
+Pandas encourages the second style, which is known as method chaining.
+``pipe`` makes it easy to use your own or another library's functions
+in method chains, alongside pandas' methods.
+
+In the example above, the functions ``f``, ``g``, and ``h`` each expected the ``DataFrame`` as the first positional argument.
+What if the function you wish to apply takes its data as, say, the second argument?
+In this case, provide ``pipe`` with a tuple of ``(callable, data_keyword)``.
+``.pipe`` will route the ``DataFrame`` to the argument specified in the tuple.
+
+For example, we can fit a regression using statsmodels. Their API expects a formula first and a ``DataFrame`` as the second argument, ``data``. We pass in the function, keyword pair ``(sm.poisson, 'data')`` to ``pipe``:
+
+.. ipython:: python
+
+ import statsmodels.formula.api as sm
+
+ bb = pd.read_csv('data/baseball.csv', index_col='id')
+
+ (bb.query('h > 0')
+ .assign(ln_h = lambda df: np.log(df.h))
+ .pipe((sm.poisson, 'data'), 'hr ~ ln_h + year + g + C(lg)')
+ .fit()
+ .summary()
+ )
+
+The pipe method is inspired by unix pipes and more recently dplyr_ and magrittr_, which
+have introduced the popular ``(%>%)`` (read pipe) operator for R_.
+The implementation of ``pipe`` here is quite clean and feels right at home in python.
+We encourage you to view the source code (``pd.DataFrame.pipe??`` in IPython).
+
+.. _dplyr: https://github.com/hadley/dplyr
+.. _magrittr: https://github.com/smbache/magrittr
+.. _R: http://www.r-project.org
+
+
+Row or Column-wise Function Application
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
Arbitrary functions can be applied along the axes of a DataFrame or Panel
using the :meth:`~DataFrame.apply` method, which, like the descriptive
statistics methods, take an optional ``axis`` argument:
@@ -678,6 +749,7 @@ Series operation on each column or row:
tsdf
tsdf.apply(pd.Series.interpolate)
+
Finally, :meth:`~DataFrame.apply` takes an argument ``raw`` which is False by default, which
converts each row or column into a Series before applying the function. When
set to True, the passed function will instead receive an ndarray object, which
@@ -690,6 +762,8 @@ functionality.
functionality for grouping by some criterion, applying, and combining the
results into a Series, DataFrame, etc.
+.. _Elementwise:
+
Applying elementwise Python functions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/doc/source/faq.rst b/doc/source/faq.rst
index 1fc8488e92fde..32290839ad71d 100644
--- a/doc/source/faq.rst
+++ b/doc/source/faq.rst
@@ -89,46 +89,6 @@ representation; i.e., 1KB = 1024 bytes).
See also :ref:`Categorical Memory Usage <categorical.memory>`.
-.. _ref-monkey-patching:
-
-Adding Features to your pandas Installation
--------------------------------------------
-
-pandas is a powerful tool and already has a plethora of data manipulation
-operations implemented, most of them are very fast as well.
-It's very possible however that certain functionality that would make your
-life easier is missing. In that case you have several options:
-
-1) Open an issue on `Github <https://github.com/pydata/pandas/issues/>`__ , explain your need and the sort of functionality you would like to see implemented.
-2) Fork the repo, Implement the functionality yourself and open a PR
- on Github.
-3) Write a method that performs the operation you are interested in and
- Monkey-patch the pandas class as part of your IPython profile startup
- or PYTHONSTARTUP file.
-
- For example, here is an example of adding an ``just_foo_cols()``
- method to the dataframe class:
-
-::
-
- import pandas as pd
- def just_foo_cols(self):
- """Get a list of column names containing the string 'foo'
-
- """
- return [x for x in self.columns if 'foo' in x]
-
- pd.DataFrame.just_foo_cols = just_foo_cols # monkey-patch the DataFrame class
- df = pd.DataFrame([list(range(4))], columns=["A","foo","foozball","bar"])
- df.just_foo_cols()
- del pd.DataFrame.just_foo_cols # you can also remove the new method
-
-
-Monkey-patching is usually frowned upon because it makes your code
-less portable and can cause subtle bugs in some circumstances.
-Monkey-patching existing methods is usually a bad idea in that respect.
-When used with proper care, however, it's a very useful tool to have.
-
.. _ref-scikits-migration:
diff --git a/doc/source/internals.rst b/doc/source/internals.rst
index 17be04cd64d27..8b4f7360fc235 100644
--- a/doc/source/internals.rst
+++ b/doc/source/internals.rst
@@ -101,7 +101,7 @@ Subclassing pandas Data Structures
.. warning:: There are some easier alternatives before considering subclassing ``pandas`` data structures.
- 1. Monkey-patching: See :ref:`Adding Features to your pandas Installation <ref-monkey-patching>`.
+ 1. Extensible method chains with :ref:`pipe <basics.pipe>`
2. Use *composition*. See `here <http://en.wikipedia.org/wiki/Composition_over_inheritance>`_.
diff --git a/doc/source/whatsnew/v0.16.2.txt b/doc/source/whatsnew/v0.16.2.txt
index 627c79f7289b7..9421ab0f841ac 100644
--- a/doc/source/whatsnew/v0.16.2.txt
+++ b/doc/source/whatsnew/v0.16.2.txt
@@ -10,6 +10,7 @@ We recommend that all users upgrade to this version.
Highlights include:
- Documentation on how to use ``numba`` with *pandas*, see :ref:`here <enhancingperf.numba>`
+- A new ``pipe`` method, see :ref:`here <whatsnew_0162.enhancements.pipe>`
Check the :ref:`API Changes <whatsnew_0162.api>` before updating.
@@ -22,6 +23,62 @@ Check the :ref:`API Changes <whatsnew_0162.api>` before updating.
New features
~~~~~~~~~~~~
+.. _whatsnew_0162.enhancements.pipe:
+
+Pipe
+^^^^
+
+We've introduced a new method :meth:`DataFrame.pipe`. As suggested by the name, ``pipe``
+should be used to pipe data through a chain of function calls.
+The goal is to avoid confusing nested function calls like
+
+ .. code-block:: python
+
+ # df is a DataFrame
+ # f, g, and h are functions that take and return DataFrames
+ f(g(h(df), arg1=1), arg2=2, arg3=3)
+
+The logic flows from inside out, and function names are separated from their keyword arguments.
+This can be rewritten as
+
+ .. code-block:: python
+
+ (df.pipe(h)
+ .pipe(g, arg1=1)
+ .pipe(f, arg2=2)
+ )
+
+Now both the code and the logic flow from top to bottom. Keyword arguments are next to
+their functions. Overall the code is much more readable.
+
+In the example above, the functions ``f``, ``g``, and ``h`` each expected the DataFrame as the first positional argument.
+When the function you wish to apply takes its data anywhere other than the first argument, pass a tuple
+of ``(function, keyword)`` indicating where the DataFrame should flow. For example:
+
+.. ipython:: python
+
+ import statsmodels.formula.api as sm
+
+ bb = pd.read_csv('data/baseball.csv', index_col='id')
+
+ # sm.poisson takes (formula, data)
+ (bb.query('h > 0')
+ .assign(ln_h = lambda df: np.log(df.h))
+ .pipe((sm.poisson, 'data'), 'hr ~ ln_h + year + g + C(lg)')
+ .fit()
+ .summary()
+ )
+
+The pipe method is inspired by unix pipes, which stream text through
+processes. More recently dplyr_ and magrittr_ have introduced the
+popular ``(%>%)`` pipe operator for R_.
+
+See the :ref:`documentation <basics.pipe>` for more. (:issue:`10129`)
+
+.. _dplyr: https://github.com/hadley/dplyr
+.. _magrittr: https://github.com/smbache/magrittr
+.. _R: http://www.r-project.org
+
.. _whatsnew_0162.enhancements.other:
Other enhancements
diff --git a/doc/source/whatsnew/v0.17.0.txt b/doc/source/whatsnew/v0.17.0.txt
index 87a9d197bd0d1..164ab73def894 100644
--- a/doc/source/whatsnew/v0.17.0.txt
+++ b/doc/source/whatsnew/v0.17.0.txt
@@ -21,6 +21,7 @@ Check the :ref:`API Changes <whatsnew_0170.api>` and :ref:`deprecations <whatsne
New features
~~~~~~~~~~~~
+
.. _whatsnew_0170.enhancements.other:
Other enhancements
diff --git a/pandas/__init__.py b/pandas/__init__.py
index 2a142a6ff2072..0e7bc628fdb6a 100644
--- a/pandas/__init__.py
+++ b/pandas/__init__.py
@@ -57,4 +57,3 @@
from pandas.util.print_versions import show_versions
import pandas.util.testing
-
diff --git a/pandas/core/generic.py b/pandas/core/generic.py
index 3bf90aaf71849..0b6476950333e 100644
--- a/pandas/core/generic.py
+++ b/pandas/core/generic.py
@@ -2045,6 +2045,68 @@ def sample(self, n=None, frac=None, replace=False, weights=None, random_state=No
locs = rs.choice(axis_length, size=n, replace=replace, p=weights)
return self.take(locs, axis=axis)
+ _shared_docs['pipe'] = ("""
+ Apply func(self, *args, **kwargs)
+
+ .. versionadded:: 0.16.2
+
+ Parameters
+ ----------
+ func : function
+ function to apply to the %(klass)s.
+ ``args``, and ``kwargs`` are passed into ``func``.
+ Alternatively a ``(callable, data_keyword)`` tuple where
+ ``data_keyword`` is a string indicating the keyword of
+ ``callable`` that expects the %(klass)s.
+ args : positional arguments passed into ``func``.
+ kwargs : a dictionary of keyword arguments passed into ``func``.
+
+ Returns
+ -------
+ object : the return type of ``func``.
+
+ Notes
+ -----
+
+ Use ``.pipe`` when chaining together functions that expect
+ on Series or DataFrames. Instead of writing
+
+ >>> f(g(h(df), arg1=a), arg2=b, arg3=c)
+
+ You can write
+
+ >>> (df.pipe(h)
+ ... .pipe(g, arg1=a)
+ ... .pipe(f, arg2=b, arg3=c)
+ ... )
+
+ If you have a function that takes the data as (say) the second
+ argument, pass a tuple indicating which keyword expects the
+ data. For example, suppose ``f`` takes its data as ``arg2``:
+
+ >>> (df.pipe(h)
+ ... .pipe(g, arg1=a)
+ ... .pipe((f, 'arg2'), arg1=a, arg3=c)
+ ... )
+
+ See Also
+ --------
+ pandas.DataFrame.apply
+ pandas.DataFrame.applymap
+ pandas.Series.map
+ """
+ )
+ @Appender(_shared_docs['pipe'] % _shared_doc_kwargs)
+ def pipe(self, func, *args, **kwargs):
+ if isinstance(func, tuple):
+ func, target = func
+ if target in kwargs:
+ msg = '%s is both the pipe target and a keyword argument' % target
+ raise ValueError(msg)
+ kwargs[target] = self
+ return func(*args, **kwargs)
+ else:
+ return func(self, *args, **kwargs)
#----------------------------------------------------------------------
# Attribute access
diff --git a/pandas/tests/test_generic.py b/pandas/tests/test_generic.py
index a03fe3c2241a3..44f7791b7f8ba 100644
--- a/pandas/tests/test_generic.py
+++ b/pandas/tests/test_generic.py
@@ -1649,6 +1649,48 @@ def test_describe_raises(self):
with tm.assertRaises(NotImplementedError):
tm.makePanel().describe()
+ def test_pipe(self):
+ df = DataFrame({'A': [1, 2, 3]})
+ f = lambda x, y: x ** y
+ result = df.pipe(f, 2)
+ expected = DataFrame({'A': [1, 4, 9]})
+ self.assert_frame_equal(result, expected)
+
+ result = df.A.pipe(f, 2)
+ self.assert_series_equal(result, expected.A)
+
+ def test_pipe_tuple(self):
+ df = DataFrame({'A': [1, 2, 3]})
+ f = lambda x, y: y
+ result = df.pipe((f, 'y'), 0)
+ self.assert_frame_equal(result, df)
+
+ result = df.A.pipe((f, 'y'), 0)
+ self.assert_series_equal(result, df.A)
+
+ def test_pipe_tuple_error(self):
+ df = DataFrame({"A": [1, 2, 3]})
+ f = lambda x, y: y
+ with tm.assertRaises(ValueError):
+ result = df.pipe((f, 'y'), x=1, y=0)
+
+ with tm.assertRaises(ValueError):
+ result = df.A.pipe((f, 'y'), x=1, y=0)
+
+ def test_pipe_panel(self):
+ wp = Panel({'r1': DataFrame({"A": [1, 2, 3]})})
+ f = lambda x, y: x + y
+ result = wp.pipe(f, 2)
+ expected = wp + 2
+ assert_panel_equal(result, expected)
+
+ result = wp.pipe((f, 'y'), x=1)
+ expected = wp + 1
+ assert_panel_equal(result, expected)
+
+ with tm.assertRaises(ValueError):
+ result = wp.pipe((f, 'y'), x=1, y=1)
+
if __name__ == '__main__':
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
exit=False)
| Closes https://github.com/pydata/pandas/issues/10129
In the dev meeting, we settled on the following:
- `.pipe` will **not** include a check for `__pipe_func__` on the function passed in.
- To avoid messiness with lambdas when a function takes the DataFrame other than in the first position, users can pass in a `(callable, data_keyword)` argument to `.pipe` (thanks @mwaskom)
``` python
import statsmodels.formula.api as sm
bb = pd.read_csv('data/baseball.csv', index_col='id')
(bb.query('h > 0')
.assign(ln_h = lambda df: np.log(df.h))
# sm.possion expects `formula, data`
.pipe((sm.poisson, 'data'), 'hr ~ ln_h + year + g + C(lg)')
.fit()
.summary()
)
## -- End pasted text --
Optimization terminated successfully.
Current function value: 2.116284
Iterations 24
Out[1]:
<class 'statsmodels.iolib.summary.Summary'>
"""
Poisson Regression Results
==============================================================================
Dep. Variable: hr No. Observations: 68
Model: Poisson Df Residuals: 63
Method: MLE Df Model: 4
Date: Tue, 02 Jun 2015 Pseudo R-squ.: 0.6878
Time: 20:57:27 Log-Likelihood: -143.91
converged: True LL-Null: -460.91
LLR p-value: 6.774e-136
===============================================================================
coef std err z P>|z| [95.0% Conf. Int.]
-------------------------------------------------------------------------------
Intercept -1267.3636 457.867 -2.768 0.006 -2164.767 -369.960
C(lg)[T.NL] -0.2057 0.101 -2.044 0.041 -0.403 -0.008
ln_h 0.9280 0.191 4.866 0.000 0.554 1.302
year 0.6301 0.228 2.762 0.006 0.183 1.077
g 0.0099 0.004 2.754 0.006 0.003 0.017
===============================================================================
"""
```
Thanks everyone for the input in the issue.
---
This is mostly ready. What's a good name for the argument to `pipe`? I have `func` right now, @shoyer you had `target` in the issue thread. I've been using `target` as the keyword expecting the data, i.e. where the DataFrame should be pipe to.
The tests are extremely minimal... but so is the implementation. Am I missing any obvious edge-cases?
We'll see how this goes. I don't think I push `.pipe` as a protocol at all in the documentation, though we can change that in the future. We should be forwards-compatible if we do ever go down the `__pipe_func__` route.
| https://api.github.com/repos/pandas-dev/pandas/pulls/10253 | 2015-06-03T02:26:03Z | 2015-06-06T03:14:27Z | 2015-06-06T03:14:27Z | 2015-08-19T17:19:06Z |
REGR: ensure passed binlabels to pd.cut have a compat dtype on output (#10140) | diff --git a/doc/source/groupby.rst b/doc/source/groupby.rst
index c9e18b585c764..54e35a489d6ba 100644
--- a/doc/source/groupby.rst
+++ b/doc/source/groupby.rst
@@ -792,6 +792,8 @@ excluded. So there will never be an "NA group" or "NaT group". This was not the
versions of pandas, but users were generally discarding the NA group anyway
(and supporting it was an implementation headache).
+.. _groupby.categorical:
+
Grouping with ordered factors
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -801,9 +803,14 @@ can be used as group keys. If so, the order of the levels will be preserved:
.. ipython:: python
data = Series(np.random.randn(100))
-
factor = qcut(data, [0, .25, .5, .75, 1.])
+ data.groupby(factor).mean()
+
+Further, one can name the bins to produce a custom-labeled binner.
+
+.. ipython:: python
+ factor = qcut(data, [0, .25, .5, .75, 1.], labels=['small','medium','large','x-large'])
data.groupby(factor).mean()
.. _groupby.specify:
diff --git a/doc/source/reshaping.rst b/doc/source/reshaping.rst
index 26aaf9c2be69d..625613f0a5739 100644
--- a/doc/source/reshaping.rst
+++ b/doc/source/reshaping.rst
@@ -417,7 +417,8 @@ Tiling
The ``cut`` function computes groupings for the values of the input array and
is often used to transform continuous variables to discrete or categorical
-variables:
+variables. These will result in a ``Categorical`` dtype, where the categories
+are the bins.
.. ipython:: python
@@ -433,6 +434,13 @@ Alternatively we can specify custom bin-edges:
pd.cut(ages, bins=[0, 18, 35, 70])
+Furthermore, one can specify ``labels`` to have custom labels.
+
+.. ipython:: python
+
+ pd.cut(ages, bins=[0, 18, 35, 70], labels=['child','adult','senior'])
+
+``cut/qcut`` are often used as groupers, see the :ref:`grouping with ordered factors<groupby.categorical>` for more.
.. _reshaping.dummies:
diff --git a/doc/source/whatsnew/v0.16.2.txt b/doc/source/whatsnew/v0.16.2.txt
index b571aab0b19a5..31636068e43f8 100644
--- a/doc/source/whatsnew/v0.16.2.txt
+++ b/doc/source/whatsnew/v0.16.2.txt
@@ -69,6 +69,7 @@ Bug Fixes
- Bung in ``Series`` arithmetic methods may incorrectly hold names (:issue:`10068`)
- Bug in ``DatetimeIndex`` and ``TimedeltaIndex`` names are lost after timedelta arithmetics ( :issue:`9926`)
+- Regression in ``pd.cut` to ensure passed ``binlabels`` have a compat dtype on output (:issue:`10140`)
- Bug in `Series.plot(label="LABEL")` not correctly setting the label (:issue:`10119`)
diff --git a/pandas/tools/tests/test_tile.py b/pandas/tools/tests/test_tile.py
index 4a0218bef6001..788cebad4c244 100644
--- a/pandas/tools/tests/test_tile.py
+++ b/pandas/tools/tests/test_tile.py
@@ -4,7 +4,8 @@
import numpy as np
from pandas.compat import zip
-from pandas import DataFrame, Series, unique
+from pandas import (DataFrame, Series, unique, Index, Categorical, CategoricalIndex,
+ DatetimeIndex, TimedeltaIndex)
import pandas.util.testing as tm
from pandas.util.testing import assertRaisesRegexp
import pandas.core.common as com
@@ -97,6 +98,45 @@ def test_label_precision(self):
'(0.54, 0.72]']
self.assert_numpy_array_equal(result.categories, ex_levels)
+ def test_label_coercion(self):
+ # GH10140
+
+ df = DataFrame({'x' : 100 * np.random.random(100)})
+ df['y'] = df.x**2
+
+ binedges = np.arange(0,110,10)
+ binlabels = np.arange(5,105,10)
+
+ # passing in an index
+ for bl, expected in [(Index(binlabels), np.dtype('int64')),
+ (DatetimeIndex(['20130101']*len(binlabels))+TimedeltaIndex(binlabels,unit='D'),np.dtype('M8[ns]')),
+ (TimedeltaIndex(binlabels,unit='D'),np.dtype('m8[ns]')),
+ (Categorical(binlabels), 'category'),
+ (Index(Index(binlabels).map(str)), 'category')]:
+ result = cut(df.x, bins=binedges, labels=bl)
+ self.assertEqual(result.dtype, expected)
+ z = df.groupby(result).y.mean()
+ self.assertEqual(z.index.dtype, expected)
+
+ # passing in a list-like
+ for bl, expected in [(Index(binlabels), np.dtype('int64')),
+ (Index(Index(binlabels).map(str)), 'category')]:
+ bl = np.asarray(bl)
+ result = cut(df.x, bins=binedges, labels=bl)
+ self.assertEqual(result.dtype, expected)
+ z = df.groupby(result).y.mean()
+ self.assertEqual(z.index.dtype, expected)
+
+ # reversed categories
+ bl = Categorical(binlabels,categories=binlabels[::-1],ordered=True)
+ expected = Index(bl).dtype
+ result = cut(df.x, bins=binedges, labels=bl)
+ self.assertEqual(result.dtype, expected)
+ z = df.groupby(result).y.mean()
+ self.assertEqual(z.index.dtype, expected)
+ tm.assert_index_equal(z.index,
+ CategoricalIndex(Categorical.from_codes(np.arange(len(bl)),categories=bl.categories,ordered=True),name='x'))
+
def test_na_handling(self):
arr = np.arange(0, 0.75, 0.01)
arr[::3] = np.nan
diff --git a/pandas/tools/tile.py b/pandas/tools/tile.py
index 6830919d9c09f..519eaaebf6f3e 100644
--- a/pandas/tools/tile.py
+++ b/pandas/tools/tile.py
@@ -2,7 +2,7 @@
Quantilization functions and related stuff
"""
-from pandas.core.api import DataFrame, Series
+from pandas.core.api import DataFrame, Series, Index
from pandas.core.categorical import Categorical
from pandas.core.index import _ensure_index
import pandas.core.algorithms as algos
@@ -195,6 +195,14 @@ def _bins_to_cuts(x, bins, right=True, labels=None, retbins=False,
has_nas = na_mask.any()
if labels is not False:
+
+ def to_categorical(levels):
+ if com.is_categorical_dtype(levels):
+ levels = levels.categories
+ np.putmask(ids, na_mask, 0)
+ fac = Categorical(ids - 1, levels, ordered=True, name=name, fastpath=True)
+ return fac
+
if labels is None:
increases = 0
while True:
@@ -209,15 +217,21 @@ def _bins_to_cuts(x, bins, right=True, labels=None, retbins=False,
else:
break
+ fac = to_categorical(levels)
+
else:
if len(labels) != len(bins) - 1:
raise ValueError('Bin labels must be one fewer than '
'the number of bin edges')
- levels = labels
- levels = np.asarray(levels, dtype=object)
- np.putmask(ids, na_mask, 0)
- fac = Categorical(ids - 1, levels, ordered=True, name=name, fastpath=True)
+ # we want to coerce the resultant Categorical to the binlabels type if supplied
+ # if we are passed a Categorical in the binlabels, then use this dtype
+ # 10140
+ labels = _ensure_index(labels)
+ fac = to_categorical(labels)
+ if not (com.is_object_dtype(labels) or com.is_categorical_dtype(labels)):
+ fac = type(labels)(np.asarray(fac))
+
else:
fac = ids - 1
if has_nas:
| From the original issue, closes #10140
```
In [1]: df = pd.DataFrame()
In [2]: df['x'] = 100 * np.random.random(100)
In [3]: df['y'] = df.x**2
In [4]: binedges = np.arange(0,110,10)
In [5]: binlabels = np.arange(5,105,10)
```
This now yields an `Int64Index`
```
In [6]: df.groupby(pd.cut(df.x,bins=binedges ,labels=binlabels )).y.mean()
Out[6]:
5 43.485680
15 227.648305
25 680.165208
35 1244.704812
45 1977.675209
55 3159.067969
65 4435.735803
75 5649.164598
85 7027.956570
95 8997.975423
Name: y, dtype: float64
In [7]: df.groupby(pd.cut(df.x,bins=binedges ,labels=binlabels )).y.mean().index
Out[7]: Int64Index([5, 15, 25, 35, 45, 55, 65, 75, 85, 95], dtype='int64')
```
If you pass an index in, then you will get that out, specifically a `Categorical` will preserve the categories (note the 2nd example has reversed labels - why anyone would do this, don't know.......)
```
In [8]: df.groupby(pd.cut(df.x,bins=binedges ,labels=pd.Categorical(binlabels) )).y.mean().index
Out[8]: CategoricalIndex([5, 15, 25, 35, 45, 55, 65, 75, 85, 95], categories=[5, 15, 25, 35, 45, 55, 65, 75, ...], ordered=True, name=u'x', dtype='category')
In [9]: df.groupby(pd.cut(df.x,bins=binedges ,labels=pd.Categorical(binlabels,categories=binlabels[::-1]) )).y.mean().index
Out[9]: CategoricalIndex([95, 85, 75, 65, 55, 45, 35, 25, 15, 5], categories=[95, 85, 75, 65, 55, 45, 35, 25, ...], ordered=True, name=u'x', dtype='category')
In [10]: df.groupby(pd.cut(df.x,bins=binedges ,labels=pd.Categorical(binlabels,categories=binlabels[::-1]) )).y.mean()
Out[10]:
x
95 43.485680
85 227.648305
75 680.165208
65 1244.704812
55 1977.675209
45 3159.067969
35 4435.735803
25 5649.164598
15 7027.956570
5 8997.975423
Name: y, dtype: float64
```
| https://api.github.com/repos/pandas-dev/pandas/pulls/10252 | 2015-06-02T22:33:49Z | 2015-06-20T12:47:00Z | null | 2015-06-20T12:47:00Z |
ENH: make sure return dtypes for nan funcs are consistent | diff --git a/doc/source/whatsnew/v0.16.2.txt b/doc/source/whatsnew/v0.16.2.txt
index ddfe6fa0b2f74..c59f2317431d5 100644
--- a/doc/source/whatsnew/v0.16.2.txt
+++ b/doc/source/whatsnew/v0.16.2.txt
@@ -57,7 +57,7 @@ Bug Fixes
- Bug where read_hdf store.select modifies the passed columns list when
multi-indexed (:issue:`7212`)
- Bug in ``Categorical`` repr with ``display.width`` of ``None`` in Python 3 (:issue:`10087`)
-
+- Bug where some of the nan funcs do not have consistent return dtypes (:issue:`10251`)
- Bug in groupby.apply aggregation for Categorical not preserving categories (:issue:`10138`)
- Bug in ``mean()`` where integer dtypes can overflow (:issue:`10172`)
- Bug where Panel.from_dict does not set dtype when specified (:issue:`10058`)
diff --git a/pandas/core/nanops.py b/pandas/core/nanops.py
index c64c50f791edf..c70fb6339517d 100644
--- a/pandas/core/nanops.py
+++ b/pandas/core/nanops.py
@@ -244,7 +244,10 @@ def nanall(values, axis=None, skipna=True):
@bottleneck_switch(zero_value=0)
def nansum(values, axis=None, skipna=True):
values, mask, dtype, dtype_max = _get_values(values, skipna, 0)
- the_sum = values.sum(axis, dtype=dtype_max)
+ dtype_sum = dtype_max
+ if is_float_dtype(dtype):
+ dtype_sum = dtype
+ the_sum = values.sum(axis, dtype=dtype_sum)
the_sum = _maybe_null_out(the_sum, axis, mask)
return _wrap_results(the_sum, dtype)
@@ -288,7 +291,7 @@ def get_median(x):
return np.nan
return algos.median(_values_from_object(x[mask]))
- if values.dtype != np.float64:
+ if not is_float_dtype(values):
values = values.astype('f8')
values[mask] = np.nan
@@ -317,10 +320,10 @@ def get_median(x):
return _wrap_results(get_median(values) if notempty else np.nan, dtype)
-def _get_counts_nanvar(mask, axis, ddof):
- count = _get_counts(mask, axis)
-
- d = count-ddof
+def _get_counts_nanvar(mask, axis, ddof, dtype=float):
+ dtype = _get_dtype(dtype)
+ count = _get_counts(mask, axis, dtype=dtype)
+ d = count - dtype.type(ddof)
# always return NaN, never inf
if np.isscalar(count):
@@ -341,7 +344,10 @@ def _nanvar(values, axis=None, skipna=True, ddof=1):
if is_any_int_dtype(values):
values = values.astype('f8')
- count, d = _get_counts_nanvar(mask, axis, ddof)
+ if is_float_dtype(values):
+ count, d = _get_counts_nanvar(mask, axis, ddof, values.dtype)
+ else:
+ count, d = _get_counts_nanvar(mask, axis, ddof)
if skipna:
values = values.copy()
@@ -349,7 +355,8 @@ def _nanvar(values, axis=None, skipna=True, ddof=1):
X = _ensure_numeric(values.sum(axis))
XX = _ensure_numeric((values ** 2).sum(axis))
- return np.fabs((XX - X ** 2 / count) / d)
+ result = np.fabs((XX - X * X / count) / d)
+ return result
@disallow('M8')
@bottleneck_switch(ddof=1)
@@ -375,9 +382,9 @@ def nansem(values, axis=None, skipna=True, ddof=1):
mask = isnull(values)
if not is_float_dtype(values.dtype):
values = values.astype('f8')
- count, _ = _get_counts_nanvar(mask, axis, ddof)
+ count, _ = _get_counts_nanvar(mask, axis, ddof, values.dtype)
- return np.sqrt(var)/np.sqrt(count)
+ return np.sqrt(var) / np.sqrt(count)
@bottleneck_switch()
@@ -469,23 +476,25 @@ def nanskew(values, axis=None, skipna=True):
mask = isnull(values)
if not is_float_dtype(values.dtype):
values = values.astype('f8')
-
- count = _get_counts(mask, axis)
+ count = _get_counts(mask, axis)
+ else:
+ count = _get_counts(mask, axis, dtype=values.dtype)
if skipna:
values = values.copy()
np.putmask(values, mask, 0)
+ typ = values.dtype.type
A = values.sum(axis) / count
- B = (values ** 2).sum(axis) / count - A ** 2
- C = (values ** 3).sum(axis) / count - A ** 3 - 3 * A * B
+ B = (values ** 2).sum(axis) / count - A ** typ(2)
+ C = (values ** 3).sum(axis) / count - A ** typ(3) - typ(3) * A * B
# floating point error
B = _zero_out_fperr(B)
C = _zero_out_fperr(C)
- result = ((np.sqrt((count ** 2 - count)) * C) /
- ((count - 2) * np.sqrt(B) ** 3))
+ result = ((np.sqrt(count * count - count) * C) /
+ ((count - typ(2)) * np.sqrt(B) ** typ(3)))
if isinstance(result, np.ndarray):
result = np.where(B == 0, 0, result)
@@ -504,17 +513,19 @@ def nankurt(values, axis=None, skipna=True):
mask = isnull(values)
if not is_float_dtype(values.dtype):
values = values.astype('f8')
-
- count = _get_counts(mask, axis)
+ count = _get_counts(mask, axis)
+ else:
+ count = _get_counts(mask, axis, dtype=values.dtype)
if skipna:
values = values.copy()
np.putmask(values, mask, 0)
+ typ = values.dtype.type
A = values.sum(axis) / count
- B = (values ** 2).sum(axis) / count - A ** 2
- C = (values ** 3).sum(axis) / count - A ** 3 - 3 * A * B
- D = (values ** 4).sum(axis) / count - A ** 4 - 6 * B * A * A - 4 * C * A
+ B = (values ** 2).sum(axis) / count - A ** typ(2)
+ C = (values ** 3).sum(axis) / count - A ** typ(3) - typ(3) * A * B
+ D = (values ** 4).sum(axis) / count - A ** typ(4) - typ(6) * B * A * A - typ(4) * C * A
B = _zero_out_fperr(B)
D = _zero_out_fperr(D)
@@ -526,8 +537,8 @@ def nankurt(values, axis=None, skipna=True):
if B == 0:
return 0
- result = (((count * count - 1.) * D / (B * B) - 3 * ((count - 1.) ** 2)) /
- ((count - 2.) * (count - 3.)))
+ result = (((count * count - typ(1)) * D / (B * B) - typ(3) * ((count - typ(1)) ** typ(2))) /
+ ((count - typ(2)) * (count - typ(3))))
if isinstance(result, np.ndarray):
result = np.where(B == 0, 0, result)
@@ -598,7 +609,7 @@ def _zero_out_fperr(arg):
if isinstance(arg, np.ndarray):
return np.where(np.abs(arg) < 1e-14, 0, arg)
else:
- return 0 if np.abs(arg) < 1e-14 else arg
+ return arg.dtype.type(0) if np.abs(arg) < 1e-14 else arg
@disallow('M8','m8')
diff --git a/pandas/tests/test_nanops.py b/pandas/tests/test_nanops.py
index 1adb8a5d9217c..951a693d22280 100644
--- a/pandas/tests/test_nanops.py
+++ b/pandas/tests/test_nanops.py
@@ -4,7 +4,7 @@
from functools import partial
import numpy as np
-
+from pandas import Series
from pandas.core.common import isnull, is_integer_dtype
import pandas.core.nanops as nanops
import pandas.util.testing as tm
@@ -327,7 +327,6 @@ def test_nanmean_overflow(self):
# GH 10155
# In the previous implementation mean can overflow for int dtypes, it
# is now consistent with numpy
- from pandas import Series
# numpy < 1.9.0 is not computing this correctly
from distutils.version import LooseVersion
@@ -340,14 +339,19 @@ def test_nanmean_overflow(self):
self.assertEqual(result, np_result)
self.assertTrue(result.dtype == np.float64)
- # check returned dtype
- for dtype in [np.int16, np.int32, np.int64, np.float16, np.float32, np.float64]:
+ def test_returned_dtype(self):
+ for dtype in [np.int16, np.int32, np.int64, np.float32, np.float64, np.float128]:
s = Series(range(10), dtype=dtype)
- result = s.mean()
- if is_integer_dtype(dtype):
- self.assertTrue(result.dtype == np.float64)
- else:
- self.assertTrue(result.dtype == dtype)
+ group_a = ['mean', 'std', 'var', 'skew', 'kurt']
+ group_b = ['min', 'max']
+ for method in group_a + group_b:
+ result = getattr(s, method)()
+ if is_integer_dtype(dtype) and method in group_a:
+ self.assertTrue(result.dtype == np.float64,
+ "return dtype expected from %s is np.float64, got %s instead" % (method, result.dtype))
+ else:
+ self.assertTrue(result.dtype == dtype,
+ "return dtype expected from %s is %s, got %s instead" % (method, dtype, result.dtype))
def test_nanmedian(self):
self.check_funs(nanops.nanmedian, np.median,
diff --git a/pandas/tests/test_series.py b/pandas/tests/test_series.py
index eb583f17f3ace..b2591c7537ad1 100644
--- a/pandas/tests/test_series.py
+++ b/pandas/tests/test_series.py
@@ -528,7 +528,6 @@ def test_nansum_buglet(self):
assert_almost_equal(result, 1)
def test_overflow(self):
-
# GH 6915
# overflowing on the smaller int dtypes
for dtype in ['int32','int64']:
@@ -551,25 +550,25 @@ def test_overflow(self):
result = s.max()
self.assertEqual(int(result),v[-1])
- for dtype in ['float32','float64']:
- v = np.arange(5000000,dtype=dtype)
+ for dtype in ['float32', 'float64']:
+ v = np.arange(5000000, dtype=dtype)
s = Series(v)
# no bottleneck
result = s.sum(skipna=False)
- self.assertTrue(np.allclose(float(result),v.sum(dtype='float64')))
+ self.assertEqual(result, v.sum(dtype=dtype))
result = s.min(skipna=False)
- self.assertTrue(np.allclose(float(result),0.0))
+ self.assertTrue(np.allclose(float(result), 0.0))
result = s.max(skipna=False)
- self.assertTrue(np.allclose(float(result),v[-1]))
+ self.assertTrue(np.allclose(float(result), v[-1]))
# use bottleneck if available
result = s.sum()
- self.assertTrue(np.allclose(float(result),v.sum(dtype='float64')))
+ self.assertEqual(result, v.sum(dtype=dtype))
result = s.min()
- self.assertTrue(np.allclose(float(result),0.0))
+ self.assertTrue(np.allclose(float(result), 0.0))
result = s.max()
- self.assertTrue(np.allclose(float(result),v[-1]))
+ self.assertTrue(np.allclose(float(result), v[-1]))
class SafeForSparse(object):
pass
| this is a follow-up to https://github.com/pydata/pandas/pull/10172
In addition to `mean()`, this PR also makes sure the returned dtype is consistent for `std()`, `var()`, `skew()`, and `kurt()`
| https://api.github.com/repos/pandas-dev/pandas/pulls/10251 | 2015-06-02T17:32:47Z | 2015-06-05T21:28:59Z | 2015-06-05T21:28:59Z | 2015-06-05T21:29:03Z |
ENH: Conditional HTML Formatting | diff --git a/ci/requirements-2.6.run b/ci/requirements-2.6.run
index 5f8a2fde1409f..32d71beb24388 100644
--- a/ci/requirements-2.6.run
+++ b/ci/requirements-2.6.run
@@ -14,3 +14,4 @@ psycopg2=2.5.1
pymysql=0.6.0
sqlalchemy=0.7.8
xlsxwriter=0.4.6
+jinja2=2.8
diff --git a/ci/requirements-2.7.run b/ci/requirements-2.7.run
index 10049179912da..8fc074b96e0e4 100644
--- a/ci/requirements-2.7.run
+++ b/ci/requirements-2.7.run
@@ -19,3 +19,4 @@ pymysql=0.6.3
html5lib=1.0b2
beautiful-soup=4.2.1
statsmodels
+jinja2=2.8
diff --git a/ci/requirements-3.3.run b/ci/requirements-3.3.run
index 0256802a69eba..2379ab42391db 100644
--- a/ci/requirements-3.3.run
+++ b/ci/requirements-3.3.run
@@ -14,3 +14,4 @@ lxml=3.2.1
scipy
beautiful-soup=4.2.1
statsmodels
+jinja2=2.8
diff --git a/ci/requirements-3.4.run b/ci/requirements-3.4.run
index 45d082022713e..902a2984d4b3d 100644
--- a/ci/requirements-3.4.run
+++ b/ci/requirements-3.4.run
@@ -16,3 +16,4 @@ sqlalchemy
bottleneck
pymysql=0.6.3
psycopg2
+jinja2=2.8
diff --git a/ci/requirements-3.4_SLOW.run b/ci/requirements-3.4_SLOW.run
index 1eca130ecd96a..f0101d34204a3 100644
--- a/ci/requirements-3.4_SLOW.run
+++ b/ci/requirements-3.4_SLOW.run
@@ -18,3 +18,4 @@ bottleneck
pymysql
psycopg2
statsmodels
+jinja2=2.8
diff --git a/ci/requirements-3.5.run b/ci/requirements-3.5.run
index 8de8f7d8f0630..64ed11b744ffd 100644
--- a/ci/requirements-3.5.run
+++ b/ci/requirements-3.5.run
@@ -12,6 +12,7 @@ pytables
html5lib
lxml
matplotlib
+jinja2
# currently causing some warnings
#sqlalchemy
diff --git a/doc/source/api.rst b/doc/source/api.rst
index 6bee0a1ceafb8..668e297dc8f18 100644
--- a/doc/source/api.rst
+++ b/doc/source/api.rst
@@ -1662,6 +1662,56 @@ The following methods are available only for ``DataFrameGroupBy`` objects.
DataFrameGroupBy.corrwith
DataFrameGroupBy.boxplot
+Style
+-----
+.. currentmodule:: pandas.core.style
+
+``Styler`` objects are returned by :attr:`pandas.DataFrame.style`.
+
+
+Constructor
+~~~~~~~~~~~
+.. autosummary::
+ :toctree: generated/
+
+ Styler
+
+Style Application
+~~~~~~~~~~~~~~~~~
+.. autosummary::
+ :toctree: generated/
+
+ Styler.apply
+ Styler.applymap
+ Styler.set_precision
+ Styler.set_table_styles
+ Styler.set_caption
+ Styler.set_properties
+ Styler.set_uuid
+ Styler.clear
+
+Builtin Styles
+~~~~~~~~~~~~~~
+
+.. autosummary::
+ :toctree: generated/
+
+ Styler.highlight_max
+ Styler.highlight_min
+ Styler.highlight_null
+ Styler.background_gradient
+ Styler.bar
+
+Style Export and Import
+~~~~~~~~~~~~~~~~~~~~~~~
+
+.. autosummary::
+ :toctree: generated/
+
+ Styler.render
+ Styler.export
+ Styler.set
+
.. currentmodule:: pandas
General utility functions
diff --git a/doc/source/html-styling.html b/doc/source/html-styling.html
new file mode 100644
index 0000000000000..e595cffc751a8
--- /dev/null
+++ b/doc/source/html-styling.html
@@ -0,0 +1,21492 @@
+<!DOCTYPE html>
+<html>
+<head><meta charset="utf-8" />
+<title>html-styling</title>
+
+<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js"></script>
+<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
+
+<style type="text/css">
+ /*!
+*
+* Twitter Bootstrap
+*
+*//*! normalize.css v3.0.2 | MIT License | git.io/normalize */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;font-size:10px;-webkit-tap-highlight-color:transparent}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,optgroup,strong{font-weight:700}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0;vertical-align:middle}svg:not(:root){overflow:hidden}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}pre,textarea{overflow:auto}code,kbd,pre,samp{font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */@media print{*,:after,:before{background:0 0!important;color:#000!important;box-shadow:none!important;text-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href)")"}abbr[title]:after{content:" (" attr(title)")"}a[href^="javascript:"]:after,a[href^="#"]:after{content:""}blockquote,pre{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}img,tr{page-break-inside:avoid}img{max-width:100%!important}h2,h3,p{orphans:3;widows:3}h2,h3{page-break-after:avoid}select{background:#fff!important}.navbar{display:none}.btn>.caret,.dropup>.btn>.caret{border-top-color:#000!important}.label{border:1px solid #000}.table{border-collapse:collapse!important}.table td,.table th{background-color:#fff!important}.table-bordered td,.table-bordered th{border:1px solid #ddd!important}}@font-face{font-family:'Glyphicons Halflings';src:url(../components/bootstrap/fonts/glyphicons-halflings-regular.eot);src:url(../components/bootstrap/fonts/glyphicons-halflings-regular.eot?#iefix)format('embedded-opentype'),url(../components/bootstrap/fonts/glyphicons-halflings-regular.woff2)format('woff2'),url(../components/bootstrap/fonts/glyphicons-halflings-regular.woff)format('woff'),url(../components/bootstrap/fonts/glyphicons-halflings-regular.ttf)format('truetype'),url(../components/bootstrap/fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular)format('svg')}.glyphicon{position:relative;top:1px;display:inline-block;font-family:'Glyphicons Halflings';font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.glyphicon-asterisk:before{content:"\2a"}.glyphicon-plus:before{content:"\2b"}.glyphicon-eur:before,.glyphicon-euro:before{content:"\20ac"}.glyphicon-minus:before{content:"\2212"}.glyphicon-cloud:before{content:"\2601"}.glyphicon-envelope:before{content:"\2709"}.glyphicon-pencil:before{content:"\270f"}.glyphicon-glass:before{content:"\e001"}.glyphicon-music:before{content:"\e002"}.glyphicon-search:before{content:"\e003"}.glyphicon-heart:before{content:"\e005"}.glyphicon-star:before{content:"\e006"}.glyphicon-star-empty:before{content:"\e007"}.glyphicon-user:before{content:"\e008"}.glyphicon-film:before{content:"\e009"}.glyphicon-th-large:before{content:"\e010"}.glyphicon-th:before{content:"\e011"}.glyphicon-th-list:before{content:"\e012"}.glyphicon-ok:before{content:"\e013"}.glyphicon-remove:before{content:"\e014"}.glyphicon-zoom-in:before{content:"\e015"}.glyphicon-zoom-out:before{content:"\e016"}.glyphicon-off:before{content:"\e017"}.glyphicon-signal:before{content:"\e018"}.glyphicon-cog:before{content:"\e019"}.glyphicon-trash:before{content:"\e020"}.glyphicon-home:before{content:"\e021"}.glyphicon-file:before{content:"\e022"}.glyphicon-time:before{content:"\e023"}.glyphicon-road:before{content:"\e024"}.glyphicon-download-alt:before{content:"\e025"}.glyphicon-download:before{content:"\e026"}.glyphicon-upload:before{content:"\e027"}.glyphicon-inbox:before{content:"\e028"}.glyphicon-play-circle:before{content:"\e029"}.glyphicon-repeat:before{content:"\e030"}.glyphicon-refresh:before{content:"\e031"}.glyphicon-list-alt:before{content:"\e032"}.glyphicon-lock:before{content:"\e033"}.glyphicon-flag:before{content:"\e034"}.glyphicon-headphones:before{content:"\e035"}.glyphicon-volume-off:before{content:"\e036"}.glyphicon-volume-down:before{content:"\e037"}.glyphicon-volume-up:before{content:"\e038"}.glyphicon-qrcode:before{content:"\e039"}.glyphicon-barcode:before{content:"\e040"}.glyphicon-tag:before{content:"\e041"}.glyphicon-tags:before{content:"\e042"}.glyphicon-book:before{content:"\e043"}.glyphicon-bookmark:before{content:"\e044"}.glyphicon-print:before{content:"\e045"}.glyphicon-camera:before{content:"\e046"}.glyphicon-font:before{content:"\e047"}.glyphicon-bold:before{content:"\e048"}.glyphicon-italic:before{content:"\e049"}.glyphicon-text-height:before{content:"\e050"}.glyphicon-text-width:before{content:"\e051"}.glyphicon-align-left:before{content:"\e052"}.glyphicon-align-center:before{content:"\e053"}.glyphicon-align-right:before{content:"\e054"}.glyphicon-align-justify:before{content:"\e055"}.glyphicon-list:before{content:"\e056"}.glyphicon-indent-left:before{content:"\e057"}.glyphicon-indent-right:before{content:"\e058"}.glyphicon-facetime-video:before{content:"\e059"}.glyphicon-picture:before{content:"\e060"}.glyphicon-map-marker:before{content:"\e062"}.glyphicon-adjust:before{content:"\e063"}.glyphicon-tint:before{content:"\e064"}.glyphicon-edit:before{content:"\e065"}.glyphicon-share:before{content:"\e066"}.glyphicon-check:before{content:"\e067"}.glyphicon-move:before{content:"\e068"}.glyphicon-step-backward:before{content:"\e069"}.glyphicon-fast-backward:before{content:"\e070"}.glyphicon-backward:before{content:"\e071"}.glyphicon-play:before{content:"\e072"}.glyphicon-pause:before{content:"\e073"}.glyphicon-stop:before{content:"\e074"}.glyphicon-forward:before{content:"\e075"}.glyphicon-fast-forward:before{content:"\e076"}.glyphicon-step-forward:before{content:"\e077"}.glyphicon-eject:before{content:"\e078"}.glyphicon-chevron-left:before{content:"\e079"}.glyphicon-chevron-right:before{content:"\e080"}.glyphicon-plus-sign:before{content:"\e081"}.glyphicon-minus-sign:before{content:"\e082"}.glyphicon-remove-sign:before{content:"\e083"}.glyphicon-ok-sign:before{content:"\e084"}.glyphicon-question-sign:before{content:"\e085"}.glyphicon-info-sign:before{content:"\e086"}.glyphicon-screenshot:before{content:"\e087"}.glyphicon-remove-circle:before{content:"\e088"}.glyphicon-ok-circle:before{content:"\e089"}.glyphicon-ban-circle:before{content:"\e090"}.glyphicon-arrow-left:before{content:"\e091"}.glyphicon-arrow-right:before{content:"\e092"}.glyphicon-arrow-up:before{content:"\e093"}.glyphicon-arrow-down:before{content:"\e094"}.glyphicon-share-alt:before{content:"\e095"}.glyphicon-resize-full:before{content:"\e096"}.glyphicon-resize-small:before{content:"\e097"}.glyphicon-exclamation-sign:before{content:"\e101"}.glyphicon-gift:before{content:"\e102"}.glyphicon-leaf:before{content:"\e103"}.glyphicon-fire:before{content:"\e104"}.glyphicon-eye-open:before{content:"\e105"}.glyphicon-eye-close:before{content:"\e106"}.glyphicon-warning-sign:before{content:"\e107"}.glyphicon-plane:before{content:"\e108"}.glyphicon-calendar:before{content:"\e109"}.glyphicon-random:before{content:"\e110"}.glyphicon-comment:before{content:"\e111"}.glyphicon-magnet:before{content:"\e112"}.glyphicon-chevron-up:before{content:"\e113"}.glyphicon-chevron-down:before{content:"\e114"}.glyphicon-retweet:before{content:"\e115"}.glyphicon-shopping-cart:before{content:"\e116"}.glyphicon-folder-close:before{content:"\e117"}.glyphicon-folder-open:before{content:"\e118"}.glyphicon-resize-vertical:before{content:"\e119"}.glyphicon-resize-horizontal:before{content:"\e120"}.glyphicon-hdd:before{content:"\e121"}.glyphicon-bullhorn:before{content:"\e122"}.glyphicon-bell:before{content:"\e123"}.glyphicon-certificate:before{content:"\e124"}.glyphicon-thumbs-up:before{content:"\e125"}.glyphicon-thumbs-down:before{content:"\e126"}.glyphicon-hand-right:before{content:"\e127"}.glyphicon-hand-left:before{content:"\e128"}.glyphicon-hand-up:before{content:"\e129"}.glyphicon-hand-down:before{content:"\e130"}.glyphicon-circle-arrow-right:before{content:"\e131"}.glyphicon-circle-arrow-left:before{content:"\e132"}.glyphicon-circle-arrow-up:before{content:"\e133"}.glyphicon-circle-arrow-down:before{content:"\e134"}.glyphicon-globe:before{content:"\e135"}.glyphicon-wrench:before{content:"\e136"}.glyphicon-tasks:before{content:"\e137"}.glyphicon-filter:before{content:"\e138"}.glyphicon-briefcase:before{content:"\e139"}.glyphicon-fullscreen:before{content:"\e140"}.glyphicon-dashboard:before{content:"\e141"}.glyphicon-paperclip:before{content:"\e142"}.glyphicon-heart-empty:before{content:"\e143"}.glyphicon-link:before{content:"\e144"}.glyphicon-phone:before{content:"\e145"}.glyphicon-pushpin:before{content:"\e146"}.glyphicon-usd:before{content:"\e148"}.glyphicon-gbp:before{content:"\e149"}.glyphicon-sort:before{content:"\e150"}.glyphicon-sort-by-alphabet:before{content:"\e151"}.glyphicon-sort-by-alphabet-alt:before{content:"\e152"}.glyphicon-sort-by-order:before{content:"\e153"}.glyphicon-sort-by-order-alt:before{content:"\e154"}.glyphicon-sort-by-attributes:before{content:"\e155"}.glyphicon-sort-by-attributes-alt:before{content:"\e156"}.glyphicon-unchecked:before{content:"\e157"}.glyphicon-expand:before{content:"\e158"}.glyphicon-collapse-down:before{content:"\e159"}.glyphicon-collapse-up:before{content:"\e160"}.glyphicon-log-in:before{content:"\e161"}.glyphicon-flash:before{content:"\e162"}.glyphicon-log-out:before{content:"\e163"}.glyphicon-new-window:before{content:"\e164"}.glyphicon-record:before{content:"\e165"}.glyphicon-save:before{content:"\e166"}.glyphicon-open:before{content:"\e167"}.glyphicon-saved:before{content:"\e168"}.glyphicon-import:before{content:"\e169"}.glyphicon-export:before{content:"\e170"}.glyphicon-send:before{content:"\e171"}.glyphicon-floppy-disk:before{content:"\e172"}.glyphicon-floppy-saved:before{content:"\e173"}.glyphicon-floppy-remove:before{content:"\e174"}.glyphicon-floppy-save:before{content:"\e175"}.glyphicon-floppy-open:before{content:"\e176"}.glyphicon-credit-card:before{content:"\e177"}.glyphicon-transfer:before{content:"\e178"}.glyphicon-cutlery:before{content:"\e179"}.glyphicon-header:before{content:"\e180"}.glyphicon-compressed:before{content:"\e181"}.glyphicon-earphone:before{content:"\e182"}.glyphicon-phone-alt:before{content:"\e183"}.glyphicon-tower:before{content:"\e184"}.glyphicon-stats:before{content:"\e185"}.glyphicon-sd-video:before{content:"\e186"}.glyphicon-hd-video:before{content:"\e187"}.glyphicon-subtitles:before{content:"\e188"}.glyphicon-sound-stereo:before{content:"\e189"}.glyphicon-sound-dolby:before{content:"\e190"}.glyphicon-sound-5-1:before{content:"\e191"}.glyphicon-sound-6-1:before{content:"\e192"}.glyphicon-sound-7-1:before{content:"\e193"}.glyphicon-copyright-mark:before{content:"\e194"}.glyphicon-registration-mark:before{content:"\e195"}.glyphicon-cloud-download:before{content:"\e197"}.glyphicon-cloud-upload:before{content:"\e198"}.glyphicon-tree-conifer:before{content:"\e199"}.glyphicon-tree-deciduous:before{content:"\e200"}.glyphicon-cd:before{content:"\e201"}.glyphicon-save-file:before{content:"\e202"}.glyphicon-open-file:before{content:"\e203"}.glyphicon-level-up:before{content:"\e204"}.glyphicon-copy:before{content:"\e205"}.glyphicon-paste:before{content:"\e206"}.glyphicon-alert:before{content:"\e209"}.glyphicon-equalizer:before{content:"\e210"}.glyphicon-king:before{content:"\e211"}.glyphicon-queen:before{content:"\e212"}.glyphicon-pawn:before{content:"\e213"}.glyphicon-bishop:before{content:"\e214"}.glyphicon-knight:before{content:"\e215"}.glyphicon-baby-formula:before{content:"\e216"}.glyphicon-tent:before{content:"\26fa"}.glyphicon-blackboard:before{content:"\e218"}.glyphicon-bed:before{content:"\e219"}.glyphicon-apple:before{content:"\f8ff"}.glyphicon-erase:before{content:"\e221"}.glyphicon-hourglass:before{content:"\231b"}.glyphicon-lamp:before{content:"\e223"}.glyphicon-duplicate:before{content:"\e224"}.glyphicon-piggy-bank:before{content:"\e225"}.glyphicon-scissors:before{content:"\e226"}.glyphicon-bitcoin:before,.glyphicon-btc:before,.glyphicon-xbt:before{content:"\e227"}.glyphicon-jpy:before,.glyphicon-yen:before{content:"\00a5"}.glyphicon-rub:before,.glyphicon-ruble:before{content:"\20bd"}.glyphicon-scale:before{content:"\e230"}.glyphicon-ice-lolly:before{content:"\e231"}.glyphicon-ice-lolly-tasted:before{content:"\e232"}.glyphicon-education:before{content:"\e233"}.glyphicon-option-horizontal:before{content:"\e234"}.glyphicon-option-vertical:before{content:"\e235"}.glyphicon-menu-hamburger:before{content:"\e236"}.glyphicon-modal-window:before{content:"\e237"}.glyphicon-oil:before{content:"\e238"}.glyphicon-grain:before{content:"\e239"}.glyphicon-sunglasses:before{content:"\e240"}.glyphicon-text-size:before{content:"\e241"}.glyphicon-text-color:before{content:"\e242"}.glyphicon-text-background:before{content:"\e243"}.glyphicon-object-align-top:before{content:"\e244"}.glyphicon-object-align-bottom:before{content:"\e245"}.glyphicon-object-align-horizontal:before{content:"\e246"}.glyphicon-object-align-left:before{content:"\e247"}.glyphicon-object-align-vertical:before{content:"\e248"}.glyphicon-object-align-right:before{content:"\e249"}.glyphicon-triangle-right:before{content:"\e250"}.glyphicon-triangle-left:before{content:"\e251"}.glyphicon-triangle-bottom:before{content:"\e252"}.glyphicon-triangle-top:before{content:"\e253"}.glyphicon-console:before{content:"\e254"}.glyphicon-superscript:before{content:"\e255"}.glyphicon-subscript:before{content:"\e256"}.glyphicon-menu-left:before{content:"\e257"}.glyphicon-menu-right:before{content:"\e258"}.glyphicon-menu-down:before{content:"\e259"}.glyphicon-menu-up:before{content:"\e260"}*,:after,:before{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}body{margin:0;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px;line-height:1.42857143;color:#000;background-color:#fff}button,input,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit}a{color:#337ab7;text-decoration:none}a:focus,a:hover{color:#23527c;text-decoration:underline}a:focus{outline:dotted thin;outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}figure{margin:0}.carousel-inner>.item>a>img,.carousel-inner>.item>img,.img-responsive,.thumbnail a>img,.thumbnail>img{display:block;max-width:100%;height:auto}.img-rounded{border-radius:3px}.img-thumbnail{padding:4px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:2px;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out;display:inline-block;max-width:100%;height:auto}.img-circle{border-radius:50%}hr{margin-top:18px;margin-bottom:18px;border:0;border-top:1px solid #eee}.sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}[role=button]{cursor:pointer}.h1,.h2,.h3,.h4,.h5,.h6,h1,h2,h3,h4,h5,h6{font-family:inherit;font-weight:500;line-height:1.1;color:inherit}.h1 .small,.h1 small,.h2 .small,.h2 small,.h3 .small,.h3 small,.h4 .small,.h4 small,.h5 .small,.h5 small,.h6 .small,.h6 small,h1 .small,h1 small,h2 .small,h2 small,h3 .small,h3 small,h4 .small,h4 small,h5 .small,h5 small,h6 .small,h6 small{font-weight:400;line-height:1;color:#777}.h1,.h2,.h3,h1,h2,h3{margin-top:18px;margin-bottom:9px}.h1 .small,.h1 small,.h2 .small,.h2 small,.h3 .small,.h3 small,h1 .small,h1 small,h2 .small,h2 small,h3 .small,h3 small{font-size:65%}.h4,.h5,.h6,h4,h5,h6{margin-top:9px;margin-bottom:9px}.h4 .small,.h4 small,.h5 .small,.h5 small,.h6 .small,.h6 small,h4 .small,h4 small,h5 .small,h5 small,h6 .small,h6 small{font-size:75%}.h1,h1{font-size:33px}.h2,h2{font-size:27px}.h3,h3{font-size:23px}.h4,h4{font-size:17px}.h5,h5{font-size:13px}.h6,h6{font-size:12px}p{margin:0 0 9px}.lead{margin-bottom:18px;font-size:14px;font-weight:300;line-height:1.4}@media (min-width:768px){.lead{font-size:19.5px}}.small,small{font-size:92%}.mark,mark{background-color:#fcf8e3;padding:.2em}.text-left{text-align:left}.text-right{text-align:right}.text-center{text-align:center}.text-justify{text-align:justify}.text-nowrap{white-space:nowrap}.text-lowercase{text-transform:lowercase}.text-uppercase{text-transform:uppercase}.text-capitalize{text-transform:capitalize}.text-muted{color:#777}.text-primary{color:#337ab7}a.text-primary:hover{color:#286090}.text-success{color:#3c763d}a.text-success:hover{color:#2b542c}.text-info{color:#31708f}a.text-info:hover{color:#245269}.text-warning{color:#8a6d3b}a.text-warning:hover{color:#66512c}.text-danger{color:#a94442}a.text-danger:hover{color:#843534}.bg-primary{color:#fff;background-color:#337ab7}a.bg-primary:hover{background-color:#286090}.bg-success{background-color:#dff0d8}a.bg-success:hover{background-color:#c1e2b3}.bg-info{background-color:#d9edf7}a.bg-info:hover{background-color:#afd9ee}.bg-warning{background-color:#fcf8e3}a.bg-warning:hover{background-color:#f7ecb5}.bg-danger{background-color:#f2dede}a.bg-danger:hover{background-color:#e4b9b9}.page-header{padding-bottom:8px;margin:36px 0 18px;border-bottom:1px solid #eee}ol,ul{margin-top:0;margin-bottom:9px}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}.list-unstyled{padding-left:0;list-style:none}.list-inline{padding-left:0;list-style:none;margin-left:-5px}.list-inline>li{display:inline-block;padding-left:5px;padding-right:5px}dl{margin-top:0;margin-bottom:18px}dd,dt{line-height:1.42857143}dt{font-weight:700}dd{margin-left:0}@media (min-width:541px){.dl-horizontal dt{float:left;width:160px;clear:left;text-align:right;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-horizontal dd{margin-left:180px}}abbr[data-original-title],abbr[title]{cursor:help;border-bottom:1px dotted #777}.initialism{font-size:90%;text-transform:uppercase}blockquote{padding:9px 18px;margin:0 0 18px;font-size:inherit;border-left:5px solid #eee}blockquote ol:last-child,blockquote p:last-child,blockquote ul:last-child{margin-bottom:0}blockquote .small,blockquote footer,blockquote small{display:block;font-size:80%;line-height:1.42857143;color:#777}blockquote .small:before,blockquote footer:before,blockquote small:before{content:'\2014 \00A0'}.blockquote-reverse,blockquote.pull-right{padding-right:15px;padding-left:0;border-right:5px solid #eee;border-left:0;text-align:right}.blockquote-reverse .small:before,.blockquote-reverse footer:before,.blockquote-reverse small:before,blockquote.pull-right .small:before,blockquote.pull-right footer:before,blockquote.pull-right small:before{content:''}.blockquote-reverse .small:after,.blockquote-reverse footer:after,.blockquote-reverse small:after,blockquote.pull-right .small:after,blockquote.pull-right footer:after,blockquote.pull-right small:after{content:'\00A0 \2014'}address{margin-bottom:18px;font-style:normal;line-height:1.42857143}code,kbd,pre,samp{font-family:monospace}code{padding:2px 4px;font-size:90%;background-color:#f9f2f4;border-radius:2px}kbd{padding:2px 4px;font-size:90%;color:#fff;background-color:#333;border-radius:1px;box-shadow:inset 0 -1px 0 rgba(0,0,0,.25)}kbd kbd{padding:0;font-size:100%;font-weight:700;box-shadow:none}pre{display:block;padding:8.5px;margin:0 0 9px;word-break:break-all;word-wrap:break-word;color:#333;background-color:#f5f5f5;border:1px solid #ccc;border-radius:2px}pre code{padding:0;font-size:inherit;color:inherit;white-space:pre-wrap;background-color:transparent;border-radius:0}.pre-scrollable{max-height:340px;overflow-y:scroll}.container{margin-right:auto;margin-left:auto;padding-left:0;padding-right:0}@media (min-width:768px){.container{width:768px}}@media (min-width:992px){.container{width:940px}}@media (min-width:1200px){.container{width:1140px}}.container-fluid{margin-right:auto;margin-left:auto;padding-left:0;padding-right:0}.row{margin-left:0;margin-right:0}.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{position:relative;min-height:1px;padding-left:0;padding-right:0}.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{float:left}.col-xs-12{width:100%}.col-xs-11{width:91.66666667%}.col-xs-10{width:83.33333333%}.col-xs-9{width:75%}.col-xs-8{width:66.66666667%}.col-xs-7{width:58.33333333%}.col-xs-6{width:50%}.col-xs-5{width:41.66666667%}.col-xs-4{width:33.33333333%}.col-xs-3{width:25%}.col-xs-2{width:16.66666667%}.col-xs-1{width:8.33333333%}.col-xs-pull-12{right:100%}.col-xs-pull-11{right:91.66666667%}.col-xs-pull-10{right:83.33333333%}.col-xs-pull-9{right:75%}.col-xs-pull-8{right:66.66666667%}.col-xs-pull-7{right:58.33333333%}.col-xs-pull-6{right:50%}.col-xs-pull-5{right:41.66666667%}.col-xs-pull-4{right:33.33333333%}.col-xs-pull-3{right:25%}.col-xs-pull-2{right:16.66666667%}.col-xs-pull-1{right:8.33333333%}.col-xs-pull-0{right:auto}.col-xs-push-12{left:100%}.col-xs-push-11{left:91.66666667%}.col-xs-push-10{left:83.33333333%}.col-xs-push-9{left:75%}.col-xs-push-8{left:66.66666667%}.col-xs-push-7{left:58.33333333%}.col-xs-push-6{left:50%}.col-xs-push-5{left:41.66666667%}.col-xs-push-4{left:33.33333333%}.col-xs-push-3{left:25%}.col-xs-push-2{left:16.66666667%}.col-xs-push-1{left:8.33333333%}.col-xs-push-0{left:auto}.col-xs-offset-12{margin-left:100%}.col-xs-offset-11{margin-left:91.66666667%}.col-xs-offset-10{margin-left:83.33333333%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-8{margin-left:66.66666667%}.col-xs-offset-7{margin-left:58.33333333%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-5{margin-left:41.66666667%}.col-xs-offset-4{margin-left:33.33333333%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-2{margin-left:16.66666667%}.col-xs-offset-1{margin-left:8.33333333%}.col-xs-offset-0{margin-left:0}@media (min-width:768px){.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9{float:left}.col-sm-12{width:100%}.col-sm-11{width:91.66666667%}.col-sm-10{width:83.33333333%}.col-sm-9{width:75%}.col-sm-8{width:66.66666667%}.col-sm-7{width:58.33333333%}.col-sm-6{width:50%}.col-sm-5{width:41.66666667%}.col-sm-4{width:33.33333333%}.col-sm-3{width:25%}.col-sm-2{width:16.66666667%}.col-sm-1{width:8.33333333%}.col-sm-pull-12{right:100%}.col-sm-pull-11{right:91.66666667%}.col-sm-pull-10{right:83.33333333%}.col-sm-pull-9{right:75%}.col-sm-pull-8{right:66.66666667%}.col-sm-pull-7{right:58.33333333%}.col-sm-pull-6{right:50%}.col-sm-pull-5{right:41.66666667%}.col-sm-pull-4{right:33.33333333%}.col-sm-pull-3{right:25%}.col-sm-pull-2{right:16.66666667%}.col-sm-pull-1{right:8.33333333%}.col-sm-pull-0{right:auto}.col-sm-push-12{left:100%}.col-sm-push-11{left:91.66666667%}.col-sm-push-10{left:83.33333333%}.col-sm-push-9{left:75%}.col-sm-push-8{left:66.66666667%}.col-sm-push-7{left:58.33333333%}.col-sm-push-6{left:50%}.col-sm-push-5{left:41.66666667%}.col-sm-push-4{left:33.33333333%}.col-sm-push-3{left:25%}.col-sm-push-2{left:16.66666667%}.col-sm-push-1{left:8.33333333%}.col-sm-push-0{left:auto}.col-sm-offset-12{margin-left:100%}.col-sm-offset-11{margin-left:91.66666667%}.col-sm-offset-10{margin-left:83.33333333%}.col-sm-offset-9{margin-left:75%}.col-sm-offset-8{margin-left:66.66666667%}.col-sm-offset-7{margin-left:58.33333333%}.col-sm-offset-6{margin-left:50%}.col-sm-offset-5{margin-left:41.66666667%}.col-sm-offset-4{margin-left:33.33333333%}.col-sm-offset-3{margin-left:25%}.col-sm-offset-2{margin-left:16.66666667%}.col-sm-offset-1{margin-left:8.33333333%}.col-sm-offset-0{margin-left:0}}@media (min-width:992px){.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9{float:left}.col-md-12{width:100%}.col-md-11{width:91.66666667%}.col-md-10{width:83.33333333%}.col-md-9{width:75%}.col-md-8{width:66.66666667%}.col-md-7{width:58.33333333%}.col-md-6{width:50%}.col-md-5{width:41.66666667%}.col-md-4{width:33.33333333%}.col-md-3{width:25%}.col-md-2{width:16.66666667%}.col-md-1{width:8.33333333%}.col-md-pull-12{right:100%}.col-md-pull-11{right:91.66666667%}.col-md-pull-10{right:83.33333333%}.col-md-pull-9{right:75%}.col-md-pull-8{right:66.66666667%}.col-md-pull-7{right:58.33333333%}.col-md-pull-6{right:50%}.col-md-pull-5{right:41.66666667%}.col-md-pull-4{right:33.33333333%}.col-md-pull-3{right:25%}.col-md-pull-2{right:16.66666667%}.col-md-pull-1{right:8.33333333%}.col-md-pull-0{right:auto}.col-md-push-12{left:100%}.col-md-push-11{left:91.66666667%}.col-md-push-10{left:83.33333333%}.col-md-push-9{left:75%}.col-md-push-8{left:66.66666667%}.col-md-push-7{left:58.33333333%}.col-md-push-6{left:50%}.col-md-push-5{left:41.66666667%}.col-md-push-4{left:33.33333333%}.col-md-push-3{left:25%}.col-md-push-2{left:16.66666667%}.col-md-push-1{left:8.33333333%}.col-md-push-0{left:auto}.col-md-offset-12{margin-left:100%}.col-md-offset-11{margin-left:91.66666667%}.col-md-offset-10{margin-left:83.33333333%}.col-md-offset-9{margin-left:75%}.col-md-offset-8{margin-left:66.66666667%}.col-md-offset-7{margin-left:58.33333333%}.col-md-offset-6{margin-left:50%}.col-md-offset-5{margin-left:41.66666667%}.col-md-offset-4{margin-left:33.33333333%}.col-md-offset-3{margin-left:25%}.col-md-offset-2{margin-left:16.66666667%}.col-md-offset-1{margin-left:8.33333333%}.col-md-offset-0{margin-left:0}}@media (min-width:1200px){.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9{float:left}.col-lg-12{width:100%}.col-lg-11{width:91.66666667%}.col-lg-10{width:83.33333333%}.col-lg-9{width:75%}.col-lg-8{width:66.66666667%}.col-lg-7{width:58.33333333%}.col-lg-6{width:50%}.col-lg-5{width:41.66666667%}.col-lg-4{width:33.33333333%}.col-lg-3{width:25%}.col-lg-2{width:16.66666667%}.col-lg-1{width:8.33333333%}.col-lg-pull-12{right:100%}.col-lg-pull-11{right:91.66666667%}.col-lg-pull-10{right:83.33333333%}.col-lg-pull-9{right:75%}.col-lg-pull-8{right:66.66666667%}.col-lg-pull-7{right:58.33333333%}.col-lg-pull-6{right:50%}.col-lg-pull-5{right:41.66666667%}.col-lg-pull-4{right:33.33333333%}.col-lg-pull-3{right:25%}.col-lg-pull-2{right:16.66666667%}.col-lg-pull-1{right:8.33333333%}.col-lg-pull-0{right:auto}.col-lg-push-12{left:100%}.col-lg-push-11{left:91.66666667%}.col-lg-push-10{left:83.33333333%}.col-lg-push-9{left:75%}.col-lg-push-8{left:66.66666667%}.col-lg-push-7{left:58.33333333%}.col-lg-push-6{left:50%}.col-lg-push-5{left:41.66666667%}.col-lg-push-4{left:33.33333333%}.col-lg-push-3{left:25%}.col-lg-push-2{left:16.66666667%}.col-lg-push-1{left:8.33333333%}.col-lg-push-0{left:auto}.col-lg-offset-12{margin-left:100%}.col-lg-offset-11{margin-left:91.66666667%}.col-lg-offset-10{margin-left:83.33333333%}.col-lg-offset-9{margin-left:75%}.col-lg-offset-8{margin-left:66.66666667%}.col-lg-offset-7{margin-left:58.33333333%}.col-lg-offset-6{margin-left:50%}.col-lg-offset-5{margin-left:41.66666667%}.col-lg-offset-4{margin-left:33.33333333%}.col-lg-offset-3{margin-left:25%}.col-lg-offset-2{margin-left:16.66666667%}.col-lg-offset-1{margin-left:8.33333333%}.col-lg-offset-0{margin-left:0}}table{background-color:transparent}caption{padding-top:8px;padding-bottom:8px;color:#777;text-align:left}th{text-align:left}.table{width:100%;max-width:100%;margin-bottom:18px}.table>tbody>tr>td,.table>tbody>tr>th,.table>tfoot>tr>td,.table>tfoot>tr>th,.table>thead>tr>td,.table>thead>tr>th{padding:8px;line-height:1.42857143;vertical-align:top;border-top:1px solid #ddd}.table>thead>tr>th{vertical-align:bottom;border-bottom:2px solid #ddd}.table>caption+thead>tr:first-child>td,.table>caption+thead>tr:first-child>th,.table>colgroup+thead>tr:first-child>td,.table>colgroup+thead>tr:first-child>th,.table>thead:first-child>tr:first-child>td,.table>thead:first-child>tr:first-child>th{border-top:0}.table>tbody+tbody{border-top:2px solid #ddd}.table .table{background-color:#fff}.table-condensed>tbody>tr>td,.table-condensed>tbody>tr>th,.table-condensed>tfoot>tr>td,.table-condensed>tfoot>tr>th,.table-condensed>thead>tr>td,.table-condensed>thead>tr>th{padding:5px}.table-bordered,.table-bordered>tbody>tr>td,.table-bordered>tbody>tr>th,.table-bordered>tfoot>tr>td,.table-bordered>tfoot>tr>th,.table-bordered>thead>tr>td,.table-bordered>thead>tr>th{border:1px solid #ddd}.table-bordered>thead>tr>td,.table-bordered>thead>tr>th{border-bottom-width:2px}.table-striped>tbody>tr:nth-of-type(odd){background-color:#f9f9f9}.table-hover>tbody>tr:hover{background-color:#f5f5f5}table col[class*=col-]{position:static;float:none;display:table-column}table td[class*=col-],table th[class*=col-]{position:static;float:none;display:table-cell}.table>tbody>tr.active>td,.table>tbody>tr.active>th,.table>tbody>tr>td.active,.table>tbody>tr>th.active,.table>tfoot>tr.active>td,.table>tfoot>tr.active>th,.table>tfoot>tr>td.active,.table>tfoot>tr>th.active,.table>thead>tr.active>td,.table>thead>tr.active>th,.table>thead>tr>td.active,.table>thead>tr>th.active{background-color:#f5f5f5}.table-hover>tbody>tr.active:hover>td,.table-hover>tbody>tr.active:hover>th,.table-hover>tbody>tr:hover>.active,.table-hover>tbody>tr>td.active:hover,.table-hover>tbody>tr>th.active:hover{background-color:#e8e8e8}.table>tbody>tr.success>td,.table>tbody>tr.success>th,.table>tbody>tr>td.success,.table>tbody>tr>th.success,.table>tfoot>tr.success>td,.table>tfoot>tr.success>th,.table>tfoot>tr>td.success,.table>tfoot>tr>th.success,.table>thead>tr.success>td,.table>thead>tr.success>th,.table>thead>tr>td.success,.table>thead>tr>th.success{background-color:#dff0d8}.table-hover>tbody>tr.success:hover>td,.table-hover>tbody>tr.success:hover>th,.table-hover>tbody>tr:hover>.success,.table-hover>tbody>tr>td.success:hover,.table-hover>tbody>tr>th.success:hover{background-color:#d0e9c6}.table>tbody>tr.info>td,.table>tbody>tr.info>th,.table>tbody>tr>td.info,.table>tbody>tr>th.info,.table>tfoot>tr.info>td,.table>tfoot>tr.info>th,.table>tfoot>tr>td.info,.table>tfoot>tr>th.info,.table>thead>tr.info>td,.table>thead>tr.info>th,.table>thead>tr>td.info,.table>thead>tr>th.info{background-color:#d9edf7}.table-hover>tbody>tr.info:hover>td,.table-hover>tbody>tr.info:hover>th,.table-hover>tbody>tr:hover>.info,.table-hover>tbody>tr>td.info:hover,.table-hover>tbody>tr>th.info:hover{background-color:#c4e3f3}.table>tbody>tr.warning>td,.table>tbody>tr.warning>th,.table>tbody>tr>td.warning,.table>tbody>tr>th.warning,.table>tfoot>tr.warning>td,.table>tfoot>tr.warning>th,.table>tfoot>tr>td.warning,.table>tfoot>tr>th.warning,.table>thead>tr.warning>td,.table>thead>tr.warning>th,.table>thead>tr>td.warning,.table>thead>tr>th.warning{background-color:#fcf8e3}.table-hover>tbody>tr.warning:hover>td,.table-hover>tbody>tr.warning:hover>th,.table-hover>tbody>tr:hover>.warning,.table-hover>tbody>tr>td.warning:hover,.table-hover>tbody>tr>th.warning:hover{background-color:#faf2cc}.table>tbody>tr.danger>td,.table>tbody>tr.danger>th,.table>tbody>tr>td.danger,.table>tbody>tr>th.danger,.table>tfoot>tr.danger>td,.table>tfoot>tr.danger>th,.table>tfoot>tr>td.danger,.table>tfoot>tr>th.danger,.table>thead>tr.danger>td,.table>thead>tr.danger>th,.table>thead>tr>td.danger,.table>thead>tr>th.danger{background-color:#f2dede}.table-hover>tbody>tr.danger:hover>td,.table-hover>tbody>tr.danger:hover>th,.table-hover>tbody>tr:hover>.danger,.table-hover>tbody>tr>td.danger:hover,.table-hover>tbody>tr>th.danger:hover{background-color:#ebcccc}.table-responsive{overflow-x:auto;min-height:.01%}@media screen and (max-width:767px){.table-responsive{width:100%;margin-bottom:13.5px;overflow-y:hidden;-ms-overflow-style:-ms-autohiding-scrollbar;border:1px solid #ddd}.table-responsive>.table{margin-bottom:0}.table-responsive>.table>tbody>tr>td,.table-responsive>.table>tbody>tr>th,.table-responsive>.table>tfoot>tr>td,.table-responsive>.table>tfoot>tr>th,.table-responsive>.table>thead>tr>td,.table-responsive>.table>thead>tr>th{white-space:nowrap}.table-responsive>.table-bordered{border:0}.table-responsive>.table-bordered>tbody>tr>td:first-child,.table-responsive>.table-bordered>tbody>tr>th:first-child,.table-responsive>.table-bordered>tfoot>tr>td:first-child,.table-responsive>.table-bordered>tfoot>tr>th:first-child,.table-responsive>.table-bordered>thead>tr>td:first-child,.table-responsive>.table-bordered>thead>tr>th:first-child{border-left:0}.table-responsive>.table-bordered>tbody>tr>td:last-child,.table-responsive>.table-bordered>tbody>tr>th:last-child,.table-responsive>.table-bordered>tfoot>tr>td:last-child,.table-responsive>.table-bordered>tfoot>tr>th:last-child,.table-responsive>.table-bordered>thead>tr>td:last-child,.table-responsive>.table-bordered>thead>tr>th:last-child{border-right:0}.table-responsive>.table-bordered>tbody>tr:last-child>td,.table-responsive>.table-bordered>tbody>tr:last-child>th,.table-responsive>.table-bordered>tfoot>tr:last-child>td,.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}}fieldset{padding:0;margin:0;border:0;min-width:0}legend{display:block;width:100%;padding:0;margin-bottom:18px;font-size:19.5px;line-height:inherit;color:#333;border:0;border-bottom:1px solid #e5e5e5}label{display:inline-block;max-width:100%;margin-bottom:5px}input[type=search]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-appearance:none}input[type=checkbox],input[type=radio]{margin:4px 0 0;margin-top:1px \9;line-height:normal}input[type=file]{display:block}input[type=range]{display:block;width:100%}select[multiple],select[size]{height:auto}input[type=file]:focus,input[type=checkbox]:focus,input[type=radio]:focus{outline:dotted thin;outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}output{display:block;padding-top:7px;font-size:13px;line-height:1.42857143;color:#555}.form-control{display:block;width:100%;height:32px;padding:6px 12px;font-size:13px;line-height:1.42857143;color:#555;background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:2px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);-webkit-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;-o-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.form-control::-moz-placeholder{color:#999;opacity:1}.form-control:-ms-input-placeholder{color:#999}.form-control::-webkit-input-placeholder{color:#999}.form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{background-color:#eee;opacity:1}.form-control[disabled],fieldset[disabled] .form-control{cursor:not-allowed}textarea.form-control{height:auto}@media screen and (-webkit-min-device-pixel-ratio:0){input[type=date],input[type=time],input[type=datetime-local],input[type=month]{line-height:32px}.input-group-sm input[type=date],.input-group-sm input[type=time],.input-group-sm input[type=datetime-local],.input-group-sm input[type=month],input[type=date].input-sm,input[type=time].input-sm,input[type=datetime-local].input-sm,input[type=month].input-sm{line-height:30px}.input-group-lg input[type=date],.input-group-lg input[type=time],.input-group-lg input[type=datetime-local],.input-group-lg input[type=month],input[type=date].input-lg,input[type=time].input-lg,input[type=datetime-local].input-lg,input[type=month].input-lg{line-height:45px}}.form-group{margin-bottom:15px}.checkbox,.radio{position:relative;display:block;margin-top:10px;margin-bottom:10px}.checkbox label,.radio label{min-height:18px;padding-left:20px;margin-bottom:0;font-weight:400;cursor:pointer}.checkbox input[type=checkbox],.checkbox-inline input[type=checkbox],.radio input[type=radio],.radio-inline input[type=radio]{position:absolute;margin-left:-20px;margin-top:4px \9}.checkbox+.checkbox,.radio+.radio{margin-top:-5px}.checkbox-inline,.radio-inline{position:relative;display:inline-block;padding-left:20px;margin-bottom:0;vertical-align:middle;font-weight:400;cursor:pointer}.checkbox-inline+.checkbox-inline,.radio-inline+.radio-inline{margin-top:0;margin-left:10px}.checkbox-inline.disabled,.checkbox.disabled label,.radio-inline.disabled,.radio.disabled label,fieldset[disabled] .checkbox label,fieldset[disabled] .checkbox-inline,fieldset[disabled] .radio label,fieldset[disabled] .radio-inline,fieldset[disabled] input[type=checkbox],fieldset[disabled] input[type=radio],input[type=checkbox].disabled,input[type=checkbox][disabled],input[type=radio].disabled,input[type=radio][disabled]{cursor:not-allowed}.form-control-static{padding-top:7px;padding-bottom:7px;margin-bottom:0;min-height:31px}.form-control-static.input-lg,.form-control-static.input-sm{padding-left:0;padding-right:0}.input-sm{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:1px}select.input-sm{height:30px;line-height:30px}select[multiple].input-sm,textarea.input-sm{height:auto}.form-group-sm .form-control{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:1px}select.form-group-sm .form-control{height:30px;line-height:30px}select[multiple].form-group-sm .form-control,textarea.form-group-sm .form-control{height:auto}.form-group-sm .form-control-static{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;min-height:30px}.input-lg{height:45px;padding:10px 16px;font-size:17px;line-height:1.3333333;border-radius:3px}select.input-lg{height:45px;line-height:45px}select[multiple].input-lg,textarea.input-lg{height:auto}.form-group-lg .form-control{height:45px;padding:10px 16px;font-size:17px;line-height:1.3333333;border-radius:3px}select.form-group-lg .form-control{height:45px;line-height:45px}select[multiple].form-group-lg .form-control,textarea.form-group-lg .form-control{height:auto}.form-group-lg .form-control-static{height:45px;padding:10px 16px;font-size:17px;line-height:1.3333333;min-height:35px}.has-feedback{position:relative}.has-feedback .form-control{padding-right:40px}.form-control-feedback{position:absolute;top:0;right:0;z-index:2;display:block;width:32px;height:32px;line-height:32px;text-align:center;pointer-events:none}.input-lg+.form-control-feedback{width:45px;height:45px;line-height:45px}.input-sm+.form-control-feedback{width:30px;height:30px;line-height:30px}.has-success .checkbox,.has-success .checkbox-inline,.has-success .control-label,.has-success .help-block,.has-success .radio,.has-success .radio-inline,.has-success.checkbox label,.has-success.checkbox-inline label,.has-success.radio label,.has-success.radio-inline label{color:#3c763d}.has-success .form-control{border-color:#3c763d;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-success .form-control:focus{border-color:#2b542c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168}.has-success .input-group-addon{color:#3c763d;border-color:#3c763d;background-color:#dff0d8}.has-success .form-control-feedback{color:#3c763d}.has-warning .checkbox,.has-warning .checkbox-inline,.has-warning .control-label,.has-warning .help-block,.has-warning .radio,.has-warning .radio-inline,.has-warning.checkbox label,.has-warning.checkbox-inline label,.has-warning.radio label,.has-warning.radio-inline label{color:#8a6d3b}.has-warning .form-control{border-color:#8a6d3b;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-warning .form-control:focus{border-color:#66512c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b}.has-warning .input-group-addon{color:#8a6d3b;border-color:#8a6d3b;background-color:#fcf8e3}.has-warning .form-control-feedback{color:#8a6d3b}.has-error .checkbox,.has-error .checkbox-inline,.has-error .control-label,.has-error .help-block,.has-error .radio,.has-error .radio-inline,.has-error.checkbox label,.has-error.checkbox-inline label,.has-error.radio label,.has-error.radio-inline label{color:#a94442}.has-error .form-control{border-color:#a94442;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-error .form-control:focus{border-color:#843534;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483}.has-error .input-group-addon{color:#a94442;border-color:#a94442;background-color:#f2dede}.has-error .form-control-feedback{color:#a94442}.has-feedback label~.form-control-feedback{top:23px}.has-feedback label.sr-only~.form-control-feedback{top:0}.help-block{display:block;margin-top:5px;margin-bottom:10px;color:#404040}.form-horizontal .checkbox,.form-horizontal .checkbox-inline,.form-horizontal .radio,.form-horizontal .radio-inline{margin-top:0;margin-bottom:0;padding-top:7px}.form-horizontal .checkbox,.form-horizontal .radio{min-height:25px}.form-horizontal .form-group{margin-left:0;margin-right:0}.form-horizontal .has-feedback .form-control-feedback{right:0}@media (min-width:768px){.form-inline .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.form-inline .form-control{display:inline-block;width:auto;vertical-align:middle}.form-inline .form-control-static{display:inline-block}.form-inline .input-group{display:inline-table;vertical-align:middle}.form-inline .input-group .form-control,.form-inline .input-group .input-group-addon,.form-inline .input-group .input-group-btn{width:auto}.form-inline .input-group>.form-control{width:100%}.form-inline .control-label{margin-bottom:0;vertical-align:middle}.form-inline .checkbox,.form-inline .radio{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.form-inline .checkbox label,.form-inline .radio label{padding-left:0}.form-inline .checkbox input[type=checkbox],.form-inline .radio input[type=radio]{position:relative;margin-left:0}.form-inline .has-feedback .form-control-feedback{top:0}.form-horizontal .control-label{text-align:right;margin-bottom:0;padding-top:7px}.form-horizontal .form-group-lg .control-label{padding-top:14.33px}.form-horizontal .form-group-sm .control-label{padding-top:6px}}.btn{display:inline-block;margin-bottom:0;font-weight:400;text-align:center;vertical-align:middle;touch-action:manipulation;cursor:pointer;background-image:none;border:1px solid transparent;white-space:nowrap;padding:6px 12px;font-size:13px;line-height:1.42857143;border-radius:2px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.btn.active.focus,.btn.active:focus,.btn.focus,.btn:active.focus,.btn:active:focus,.btn:focus{outline:dotted thin;outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px}.btn.focus,.btn:focus,.btn:hover{color:#333;text-decoration:none}.btn.active,.btn:active{outline:0;background-image:none;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn.disabled,.btn[disabled],fieldset[disabled] .btn{cursor:not-allowed;pointer-events:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;box-shadow:none}.btn-default{color:#333;background-color:#fff;border-color:#ccc}.btn-default.active,.btn-default.focus,.btn-default:active,.btn-default:focus,.btn-default:hover,.open>.dropdown-toggle.btn-default{color:#333;background-color:#e6e6e6;border-color:#adadad}.btn-default.active,.btn-default:active,.open>.dropdown-toggle.btn-default{background-image:none}.btn-default.disabled,.btn-default.disabled.active,.btn-default.disabled.focus,.btn-default.disabled:active,.btn-default.disabled:focus,.btn-default.disabled:hover,.btn-default[disabled],.btn-default[disabled].active,.btn-default[disabled].focus,.btn-default[disabled]:active,.btn-default[disabled]:focus,.btn-default[disabled]:hover,fieldset[disabled] .btn-default,fieldset[disabled] .btn-default.active,fieldset[disabled] .btn-default.focus,fieldset[disabled] .btn-default:active,fieldset[disabled] .btn-default:focus,fieldset[disabled] .btn-default:hover{background-color:#fff;border-color:#ccc}.btn-default .badge{color:#fff;background-color:#333}.btn-primary{color:#fff;background-color:#337ab7;border-color:#2e6da4}.btn-primary.active,.btn-primary.focus,.btn-primary:active,.btn-primary:focus,.btn-primary:hover,.open>.dropdown-toggle.btn-primary{color:#fff;background-color:#286090;border-color:#204d74}.btn-primary.active,.btn-primary:active,.open>.dropdown-toggle.btn-primary{background-image:none}.btn-primary.disabled,.btn-primary.disabled.active,.btn-primary.disabled.focus,.btn-primary.disabled:active,.btn-primary.disabled:focus,.btn-primary.disabled:hover,.btn-primary[disabled],.btn-primary[disabled].active,.btn-primary[disabled].focus,.btn-primary[disabled]:active,.btn-primary[disabled]:focus,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary,fieldset[disabled] .btn-primary.active,fieldset[disabled] .btn-primary.focus,fieldset[disabled] .btn-primary:active,fieldset[disabled] .btn-primary:focus,fieldset[disabled] .btn-primary:hover{background-color:#337ab7;border-color:#2e6da4}.btn-primary .badge{color:#337ab7;background-color:#fff}.btn-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.btn-success.active,.btn-success.focus,.btn-success:active,.btn-success:focus,.btn-success:hover,.open>.dropdown-toggle.btn-success{color:#fff;background-color:#449d44;border-color:#398439}.btn-success.active,.btn-success:active,.open>.dropdown-toggle.btn-success{background-image:none}.btn-success.disabled,.btn-success.disabled.active,.btn-success.disabled.focus,.btn-success.disabled:active,.btn-success.disabled:focus,.btn-success.disabled:hover,.btn-success[disabled],.btn-success[disabled].active,.btn-success[disabled].focus,.btn-success[disabled]:active,.btn-success[disabled]:focus,.btn-success[disabled]:hover,fieldset[disabled] .btn-success,fieldset[disabled] .btn-success.active,fieldset[disabled] .btn-success.focus,fieldset[disabled] .btn-success:active,fieldset[disabled] .btn-success:focus,fieldset[disabled] .btn-success:hover{background-color:#5cb85c;border-color:#4cae4c}.btn-success .badge{color:#5cb85c;background-color:#fff}.btn-info{color:#fff;background-color:#5bc0de;border-color:#46b8da}.btn-info.active,.btn-info.focus,.btn-info:active,.btn-info:focus,.btn-info:hover,.open>.dropdown-toggle.btn-info{color:#fff;background-color:#31b0d5;border-color:#269abc}.btn-info.active,.btn-info:active,.open>.dropdown-toggle.btn-info{background-image:none}.btn-info.disabled,.btn-info.disabled.active,.btn-info.disabled.focus,.btn-info.disabled:active,.btn-info.disabled:focus,.btn-info.disabled:hover,.btn-info[disabled],.btn-info[disabled].active,.btn-info[disabled].focus,.btn-info[disabled]:active,.btn-info[disabled]:focus,.btn-info[disabled]:hover,fieldset[disabled] .btn-info,fieldset[disabled] .btn-info.active,fieldset[disabled] .btn-info.focus,fieldset[disabled] .btn-info:active,fieldset[disabled] .btn-info:focus,fieldset[disabled] .btn-info:hover{background-color:#5bc0de;border-color:#46b8da}.btn-info .badge{color:#5bc0de;background-color:#fff}.btn-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.btn-warning.active,.btn-warning.focus,.btn-warning:active,.btn-warning:focus,.btn-warning:hover,.open>.dropdown-toggle.btn-warning{color:#fff;background-color:#ec971f;border-color:#d58512}.btn-warning.active,.btn-warning:active,.open>.dropdown-toggle.btn-warning{background-image:none}.btn-warning.disabled,.btn-warning.disabled.active,.btn-warning.disabled.focus,.btn-warning.disabled:active,.btn-warning.disabled:focus,.btn-warning.disabled:hover,.btn-warning[disabled],.btn-warning[disabled].active,.btn-warning[disabled].focus,.btn-warning[disabled]:active,.btn-warning[disabled]:focus,.btn-warning[disabled]:hover,fieldset[disabled] .btn-warning,fieldset[disabled] .btn-warning.active,fieldset[disabled] .btn-warning.focus,fieldset[disabled] .btn-warning:active,fieldset[disabled] .btn-warning:focus,fieldset[disabled] .btn-warning:hover{background-color:#f0ad4e;border-color:#eea236}.btn-warning .badge{color:#f0ad4e;background-color:#fff}.btn-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.btn-danger.active,.btn-danger.focus,.btn-danger:active,.btn-danger:focus,.btn-danger:hover,.open>.dropdown-toggle.btn-danger{color:#fff;background-color:#c9302c;border-color:#ac2925}.btn-danger.active,.btn-danger:active,.open>.dropdown-toggle.btn-danger{background-image:none}.btn-danger.disabled,.btn-danger.disabled.active,.btn-danger.disabled.focus,.btn-danger.disabled:active,.btn-danger.disabled:focus,.btn-danger.disabled:hover,.btn-danger[disabled],.btn-danger[disabled].active,.btn-danger[disabled].focus,.btn-danger[disabled]:active,.btn-danger[disabled]:focus,.btn-danger[disabled]:hover,fieldset[disabled] .btn-danger,fieldset[disabled] .btn-danger.active,fieldset[disabled] .btn-danger.focus,fieldset[disabled] .btn-danger:active,fieldset[disabled] .btn-danger:focus,fieldset[disabled] .btn-danger:hover{background-color:#d9534f;border-color:#d43f3a}.btn-danger .badge{color:#d9534f;background-color:#fff}.btn-link{color:#337ab7;font-weight:400;border-radius:0}.btn-link,.btn-link.active,.btn-link:active,.btn-link[disabled],fieldset[disabled] .btn-link{background-color:transparent;-webkit-box-shadow:none;box-shadow:none}.btn-link,.btn-link:active,.btn-link:focus,.btn-link:hover{border-color:transparent}.btn-link:focus,.btn-link:hover{color:#23527c;text-decoration:underline;background-color:transparent}.btn-link[disabled]:focus,.btn-link[disabled]:hover,fieldset[disabled] .btn-link:focus,fieldset[disabled] .btn-link:hover{color:#777;text-decoration:none}.btn-group-lg>.btn,.btn-lg{padding:10px 16px;font-size:17px;line-height:1.3333333;border-radius:3px}.btn-group-sm>.btn,.btn-sm{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:1px}.btn-group-xs>.btn,.btn-xs{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:1px}.btn-block{display:block;width:100%}.btn-block+.btn-block{margin-top:5px}input[type=button].btn-block,input[type=reset].btn-block,input[type=submit].btn-block{width:100%}.fade{opacity:0;-webkit-transition:opacity .15s linear;-o-transition:opacity .15s linear;transition:opacity .15s linear}.fade.in{opacity:1}.collapse{display:none}.collapse.in{display:block}tr.collapse.in{display:table-row}tbody.collapse.in{display:table-row-group}.collapsing{position:relative;height:0;overflow:hidden;-webkit-transition-property:height,visibility;transition-property:height,visibility;-webkit-transition-duration:.35s;transition-duration:.35s;-webkit-transition-timing-function:ease;transition-timing-function:ease}.caret{display:inline-block;width:0;height:0;margin-left:2px;vertical-align:middle;border-top:4px dashed;border-right:4px solid transparent;border-left:4px solid transparent}.dropdown,.dropup{position:relative}.dropdown-toggle:focus{outline:0}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;list-style:none;font-size:13px;text-align:left;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,.15);border-radius:2px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175);background-clip:padding-box}.dropdown-menu.pull-right{right:0;left:auto}.dropdown-menu .divider{height:1px;margin:8px 0;overflow:hidden;background-color:#e5e5e5}.dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.42857143;color:#333;white-space:nowrap}.dropdown-menu>li>a:focus,.dropdown-menu>li>a:hover{text-decoration:none;color:#262626;background-color:#f5f5f5}.dropdown-menu>.active>a,.dropdown-menu>.active>a:focus,.dropdown-menu>.active>a:hover{color:#fff;text-decoration:none;outline:0;background-color:#337ab7}.dropdown-menu>.disabled>a,.dropdown-menu>.disabled>a:focus,.dropdown-menu>.disabled>a:hover{color:#777}.dropdown-menu>.disabled>a:focus,.dropdown-menu>.disabled>a:hover{text-decoration:none;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);cursor:not-allowed}.open>.dropdown-menu{display:block}.open>a{outline:0}.dropdown-menu-right{left:auto;right:0}.dropdown-menu-left{left:0;right:auto}.dropdown-header{display:block;padding:3px 20px;font-size:12px;line-height:1.42857143;color:#777;white-space:nowrap}.dropdown-backdrop{position:fixed;left:0;right:0;bottom:0;top:0;z-index:990}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.navbar-fixed-bottom .dropdown .caret{border-top:0;border-bottom:4px solid;content:""}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:2px}@media (min-width:541px){.navbar-right .dropdown-menu{left:auto;right:0}.navbar-right .dropdown-menu-left{left:0;right:auto}}.btn-group,.btn-group-vertical{position:relative;display:inline-block;vertical-align:middle}.btn-group-vertical>.btn,.btn-group>.btn{position:relative;float:left}.btn-group-vertical>.btn.active,.btn-group-vertical>.btn:active,.btn-group-vertical>.btn:focus,.btn-group-vertical>.btn:hover,.btn-group>.btn.active,.btn-group>.btn:active,.btn-group>.btn:focus,.btn-group>.btn:hover{z-index:2}.btn-group .btn+.btn,.btn-group .btn+.btn-group,.btn-group .btn-group+.btn,.btn-group .btn-group+.btn-group{margin-left:-1px}.btn-toolbar{margin-left:-5px}.btn-toolbar .btn-group,.btn-toolbar .input-group{float:left}.btn-toolbar>.btn,.btn-toolbar>.btn-group,.btn-toolbar>.input-group{margin-left:5px}.btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0}.btn-group>.btn:first-child{margin-left:0}.btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){border-bottom-right-radius:0;border-top-right-radius:0}.btn-group>.btn:last-child:not(:first-child),.btn-group>.dropdown-toggle:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.btn-group>.btn-group{float:left}.btn-group>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-bottom-right-radius:0;border-top-right-radius:0}.btn-group>.btn-group:last-child:not(:first-child)>.btn:first-child{border-bottom-left-radius:0;border-top-left-radius:0}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0}.btn-group>.btn+.dropdown-toggle{padding-left:8px;padding-right:8px}.btn-group>.btn-lg+.dropdown-toggle{padding-left:12px;padding-right:12px}.btn-group.open .dropdown-toggle{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-group.open .dropdown-toggle.btn-link{-webkit-box-shadow:none;box-shadow:none}.btn .caret{margin-left:0}.btn-lg .caret{border-width:5px 5px 0}.dropup .btn-lg .caret{border-width:0 5px 5px}.btn-group-vertical>.btn,.btn-group-vertical>.btn-group,.btn-group-vertical>.btn-group>.btn{display:block;float:none;width:100%;max-width:100%}.btn-group-vertical>.btn-group>.btn{float:none}.btn-group-vertical>.btn+.btn,.btn-group-vertical>.btn+.btn-group,.btn-group-vertical>.btn-group+.btn,.btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn:not(:first-child):not(:last-child){border-radius:0}.btn-group-vertical>.btn:first-child:not(:last-child){border-top-right-radius:2px;border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn:last-child:not(:first-child){border-bottom-left-radius:2px;border-top-right-radius:0;border-top-left-radius:0}.btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group-vertical>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group-vertical>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-right-radius:0;border-top-left-radius:0}.btn-group-justified{display:table;width:100%;table-layout:fixed;border-collapse:separate}.btn-group-justified>.btn,.btn-group-justified>.btn-group{float:none;display:table-cell;width:1%}.btn-group-justified>.btn-group .btn{width:100%}.btn-group-justified>.btn-group .dropdown-menu{left:auto}[data-toggle=buttons]>.btn input[type=checkbox],[data-toggle=buttons]>.btn input[type=radio],[data-toggle=buttons]>.btn-group>.btn input[type=checkbox],[data-toggle=buttons]>.btn-group>.btn input[type=radio]{position:absolute;clip:rect(0,0,0,0);pointer-events:none}.input-group{position:relative;display:table;border-collapse:separate}.input-group[class*=col-]{float:none;padding-left:0;padding-right:0}.input-group .form-control{position:relative;z-index:2;float:left;width:100%;margin-bottom:0}.input-group-lg>.form-control,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.btn{height:45px;padding:10px 16px;font-size:17px;line-height:1.3333333;border-radius:3px}select.input-group-lg>.form-control,select.input-group-lg>.input-group-addon,select.input-group-lg>.input-group-btn>.btn{height:45px;line-height:45px}select[multiple].input-group-lg>.form-control,select[multiple].input-group-lg>.input-group-addon,select[multiple].input-group-lg>.input-group-btn>.btn,textarea.input-group-lg>.form-control,textarea.input-group-lg>.input-group-addon,textarea.input-group-lg>.input-group-btn>.btn{height:auto}.input-group-sm>.form-control,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.btn{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:1px}select.input-group-sm>.form-control,select.input-group-sm>.input-group-addon,select.input-group-sm>.input-group-btn>.btn{height:30px;line-height:30px}select[multiple].input-group-sm>.form-control,select[multiple].input-group-sm>.input-group-addon,select[multiple].input-group-sm>.input-group-btn>.btn,textarea.input-group-sm>.form-control,textarea.input-group-sm>.input-group-addon,textarea.input-group-sm>.input-group-btn>.btn{height:auto}.input-group .form-control,.input-group-addon,.input-group-btn{display:table-cell}.input-group .form-control:not(:first-child):not(:last-child),.input-group-addon:not(:first-child):not(:last-child),.input-group-btn:not(:first-child):not(:last-child){border-radius:0}.input-group-addon,.input-group-btn{width:1%;white-space:nowrap;vertical-align:middle}.input-group-addon{padding:6px 12px;font-size:13px;font-weight:400;line-height:1;color:#555;text-align:center;background-color:#eee;border:1px solid #ccc;border-radius:2px}.input-group-addon.input-sm{padding:5px 10px;font-size:12px;border-radius:1px}.input-group-addon.input-lg{padding:10px 16px;font-size:17px;border-radius:3px}.input-group-addon input[type=checkbox],.input-group-addon input[type=radio]{margin-top:0}.input-group .form-control:first-child,.input-group-addon:first-child,.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group>.btn,.input-group-btn:first-child>.dropdown-toggle,.input-group-btn:last-child>.btn-group:not(:last-child)>.btn,.input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle){border-bottom-right-radius:0;border-top-right-radius:0}.input-group-addon:first-child{border-right:0}.input-group .form-control:last-child,.input-group-addon:last-child,.input-group-btn:first-child>.btn-group:not(:first-child)>.btn,.input-group-btn:first-child>.btn:not(:first-child),.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group>.btn,.input-group-btn:last-child>.dropdown-toggle{border-bottom-left-radius:0;border-top-left-radius:0}.input-group-addon:last-child{border-left:0}.input-group-btn{position:relative;font-size:0;white-space:nowrap}.input-group-btn>.btn{position:relative}.input-group-btn>.btn+.btn{margin-left:-1px}.input-group-btn>.btn:active,.input-group-btn>.btn:focus,.input-group-btn>.btn:hover{z-index:2}.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group{margin-right:-1px}.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group{margin-left:-1px}.nav{margin-bottom:0;padding-left:0;list-style:none}.nav>li{position:relative;display:block}.nav>li>a{position:relative;display:block;padding:10px 15px}.nav>li>a:focus,.nav>li>a:hover{text-decoration:none;background-color:#eee}.nav>li.disabled>a{color:#777}.nav>li.disabled>a:focus,.nav>li.disabled>a:hover{color:#777;text-decoration:none;background-color:transparent;cursor:not-allowed}.nav .open>a,.nav .open>a:focus,.nav .open>a:hover{background-color:#eee;border-color:#337ab7}.nav .nav-divider{height:1px;margin:8px 0;overflow:hidden;background-color:#e5e5e5}.nav>li>a>img{max-width:none}.nav-tabs{border-bottom:1px solid #ddd}.nav-tabs>li{float:left;margin-bottom:-1px}.nav-tabs>li>a{margin-right:2px;line-height:1.42857143;border:1px solid transparent;border-radius:2px 2px 0 0}.nav-tabs>li>a:hover{border-color:#eee #eee #ddd}.nav-tabs>li.active>a,.nav-tabs>li.active>a:focus,.nav-tabs>li.active>a:hover{color:#555;background-color:#fff;border:1px solid #ddd;border-bottom-color:transparent;cursor:default}.nav-tabs.nav-justified{width:100%;border-bottom:0}.nav-tabs.nav-justified>li{float:none}.nav-tabs.nav-justified>li>a{text-align:center;margin-bottom:5px;margin-right:0;border-radius:2px}.nav-tabs.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:focus,.nav-tabs.nav-justified>.active>a:hover{border:1px solid #ddd}@media (min-width:768px){.nav-tabs.nav-justified>li{display:table-cell;width:1%}.nav-tabs.nav-justified>li>a{margin-bottom:0;border-bottom:1px solid #ddd;border-radius:2px 2px 0 0}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:focus,.nav-tabs.nav-justified>.active>a:hover{border-bottom-color:#fff}}.nav-pills>li{float:left}.nav-pills>li>a{border-radius:2px}.nav-pills>li+li{margin-left:2px}.nav-pills>li.active>a,.nav-pills>li.active>a:focus,.nav-pills>li.active>a:hover{color:#fff;background-color:#337ab7}.nav-stacked>li{float:none}.nav-stacked>li+li{margin-top:2px;margin-left:0}.nav-justified{width:100%}.nav-justified>li{float:none}.nav-justified>li>a{text-align:center;margin-bottom:5px}.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}.nav-tabs-justified{border-bottom:0}.nav-tabs-justified>li>a{margin-right:0;border-radius:2px}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:focus,.nav-tabs-justified>.active>a:hover{border:1px solid #ddd}@media (min-width:768px){.nav-justified>li{display:table-cell;width:1%}.nav-justified>li>a{margin-bottom:0}.nav-tabs-justified>li>a{border-bottom:1px solid #ddd;border-radius:2px 2px 0 0}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:focus,.nav-tabs-justified>.active>a:hover{border-bottom-color:#fff}}.tab-content>.tab-pane{display:none}.tab-content>.active{display:block}.nav-tabs .dropdown-menu{margin-top:-1px;border-top-right-radius:0;border-top-left-radius:0}.navbar{position:relative;min-height:30px;margin-bottom:18px;border:1px solid transparent}.navbar-collapse{overflow-x:visible;padding-right:0;padding-left:0;border-top:1px solid transparent;box-shadow:inset 0 1px 0 rgba(255,255,255,.1);-webkit-overflow-scrolling:touch}.navbar-collapse.in{overflow-y:auto}.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse{max-height:340px}@media (max-device-width:540px)and (orientation:landscape){.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse{max-height:200px}}.container-fluid>.navbar-collapse,.container-fluid>.navbar-header,.container>.navbar-collapse,.container>.navbar-header{margin-right:0;margin-left:0}.navbar-static-top{z-index:1000;border-width:0 0 1px}.navbar-fixed-bottom,.navbar-fixed-top{position:fixed;right:0;left:0;z-index:1030}@media (min-width:541px){.navbar{border-radius:2px}.navbar-header{float:left}.navbar-collapse{width:auto;border-top:0;box-shadow:none}.navbar-collapse.collapse{display:block!important;height:auto!important;padding-bottom:0;overflow:visible!important}.navbar-collapse.in{overflow-y:visible}.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse,.navbar-static-top .navbar-collapse{padding-left:0;padding-right:0}.container-fluid>.navbar-collapse,.container-fluid>.navbar-header,.container>.navbar-collapse,.container>.navbar-header{margin-right:0;margin-left:0}.navbar-fixed-bottom,.navbar-fixed-top,.navbar-static-top{border-radius:0}}.navbar-fixed-top{top:0;border-width:0 0 1px}.navbar-fixed-bottom{bottom:0;margin-bottom:0;border-width:1px 0 0}.navbar-brand{float:left;padding:6px 0;font-size:17px;line-height:18px;height:30px}.navbar-brand:focus,.navbar-brand:hover{text-decoration:none}.navbar-brand>img{display:block}.navbar-toggle{position:relative;float:right;margin-right:0;padding:9px 10px;margin-top:-2px;margin-bottom:-2px;background-color:transparent;background-image:none;border:1px solid transparent;border-radius:2px}.navbar-toggle:focus{outline:0}.navbar-toggle .icon-bar{display:block;width:22px;height:2px;border-radius:1px}.navbar-toggle .icon-bar+.icon-bar{margin-top:4px}@media (min-width:541px){.navbar>.container .navbar-brand,.navbar>.container-fluid .navbar-brand{margin-left:0}.navbar-toggle{display:none}}.navbar-nav{margin:3px 0}.navbar-nav>li>a{padding-top:10px;padding-bottom:10px;line-height:18px}@media (max-width:540px){.navbar-nav .open .dropdown-menu{position:static;float:none;width:auto;margin-top:0;background-color:transparent;border:0;box-shadow:none}.navbar-nav .open .dropdown-menu .dropdown-header,.navbar-nav .open .dropdown-menu>li>a{padding:5px 15px 5px 25px}.navbar-nav .open .dropdown-menu>li>a{line-height:18px}.navbar-nav .open .dropdown-menu>li>a:focus,.navbar-nav .open .dropdown-menu>li>a:hover{background-image:none}}@media (min-width:541px){.navbar-nav{float:left;margin:0}.navbar-nav>li{float:left}.navbar-nav>li>a{padding-top:6px;padding-bottom:6px}}.navbar-form{padding:10px 0;border-top:1px solid transparent;border-bottom:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1);margin:-1px 0}@media (min-width:768px){.navbar-form .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.navbar-form .form-control{display:inline-block;width:auto;vertical-align:middle}.navbar-form .form-control-static{display:inline-block}.navbar-form .input-group{display:inline-table;vertical-align:middle}.navbar-form .input-group .form-control,.navbar-form .input-group .input-group-addon,.navbar-form .input-group .input-group-btn{width:auto}.navbar-form .input-group>.form-control{width:100%}.navbar-form .control-label{margin-bottom:0;vertical-align:middle}.navbar-form .checkbox,.navbar-form .radio{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.navbar-form .checkbox label,.navbar-form .radio label{padding-left:0}.navbar-form .checkbox input[type=checkbox],.navbar-form .radio input[type=radio]{position:relative;margin-left:0}.navbar-form .has-feedback .form-control-feedback{top:0}}@media (max-width:540px){.navbar-form .form-group{margin-bottom:5px}.navbar-form .form-group:last-child{margin-bottom:0}}.navbar-nav>li>.dropdown-menu{margin-top:0;border-top-right-radius:0;border-top-left-radius:0}.navbar-fixed-bottom .navbar-nav>li>.dropdown-menu{margin-bottom:0;border-radius:2px 2px 0 0}.navbar-btn{margin-top:-1px;margin-bottom:-1px}.navbar-btn.btn-sm{margin-top:0;margin-bottom:0}.navbar-btn.btn-xs{margin-top:4px;margin-bottom:4px}.navbar-text{margin-top:6px;margin-bottom:6px}@media (min-width:541px){.navbar-form{width:auto;border:0;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;-webkit-box-shadow:none;box-shadow:none}.navbar-text{float:left;margin-left:0;margin-right:0}.navbar-left{float:left!important;float:left}.navbar-right{float:right!important;float:right;margin-right:0}.navbar-right~.navbar-right{margin-right:0}}.navbar-default{background-color:#f8f8f8;border-color:#e7e7e7}.navbar-default .navbar-brand{color:#777}.navbar-default .navbar-brand:focus,.navbar-default .navbar-brand:hover{color:#5e5e5e;background-color:transparent}.navbar-default .navbar-nav>li>a,.navbar-default .navbar-text{color:#777}.navbar-default .navbar-nav>li>a:focus,.navbar-default .navbar-nav>li>a:hover{color:#333;background-color:transparent}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:focus,.navbar-default .navbar-nav>.active>a:hover{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav>.disabled>a,.navbar-default .navbar-nav>.disabled>a:focus,.navbar-default .navbar-nav>.disabled>a:hover{color:#ccc;background-color:transparent}.navbar-default .navbar-toggle{border-color:#ddd}.navbar-default .navbar-toggle:focus,.navbar-default .navbar-toggle:hover{background-color:#ddd}.navbar-default .navbar-toggle .icon-bar{background-color:#888}.navbar-default .navbar-collapse,.navbar-default .navbar-form{border-color:#e7e7e7}.navbar-default .navbar-nav>.open>a,.navbar-default .navbar-nav>.open>a:focus,.navbar-default .navbar-nav>.open>a:hover{background-color:#e7e7e7;color:#555}@media (max-width:540px){.navbar-default .navbar-nav .open .dropdown-menu>li>a{color:#777}.navbar-default .navbar-nav .open .dropdown-menu>li>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>li>a:hover{color:#333;background-color:transparent}.navbar-default .navbar-nav .open .dropdown-menu>.active>a,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:hover{color:#ccc;background-color:transparent}}.navbar-default .navbar-link{color:#777}.navbar-default .navbar-link:hover{color:#333}.navbar-default .btn-link{color:#777}.navbar-default .btn-link:focus,.navbar-default .btn-link:hover{color:#333}.navbar-default .btn-link[disabled]:focus,.navbar-default .btn-link[disabled]:hover,fieldset[disabled] .navbar-default .btn-link:focus,fieldset[disabled] .navbar-default .btn-link:hover{color:#ccc}.navbar-inverse{background-color:#222;border-color:#080808}.navbar-inverse .navbar-brand{color:#9d9d9d}.navbar-inverse .navbar-brand:focus,.navbar-inverse .navbar-brand:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav>li>a,.navbar-inverse .navbar-text{color:#9d9d9d}.navbar-inverse .navbar-nav>li>a:focus,.navbar-inverse .navbar-nav>li>a:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.active>a:focus,.navbar-inverse .navbar-nav>.active>a:hover{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav>.disabled>a,.navbar-inverse .navbar-nav>.disabled>a:focus,.navbar-inverse .navbar-nav>.disabled>a:hover{color:#444;background-color:transparent}.navbar-inverse .navbar-toggle{border-color:#333}.navbar-inverse .navbar-toggle:focus,.navbar-inverse .navbar-toggle:hover{background-color:#333}.navbar-inverse .navbar-toggle .icon-bar{background-color:#fff}.navbar-inverse .navbar-collapse,.navbar-inverse .navbar-form{border-color:#101010}.navbar-inverse .navbar-nav>.open>a,.navbar-inverse .navbar-nav>.open>a:focus,.navbar-inverse .navbar-nav>.open>a:hover{background-color:#080808;color:#fff}@media (max-width:540px){.navbar-inverse .navbar-nav .open .dropdown-menu>.dropdown-header{border-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu .divider{background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a{color:#9d9d9d}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:hover{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:hover{color:#444;background-color:transparent}}.navbar-inverse .navbar-link{color:#9d9d9d}.navbar-inverse .navbar-link:hover{color:#fff}.navbar-inverse .btn-link{color:#9d9d9d}.navbar-inverse .btn-link:focus,.navbar-inverse .btn-link:hover{color:#fff}.navbar-inverse .btn-link[disabled]:focus,.navbar-inverse .btn-link[disabled]:hover,fieldset[disabled] .navbar-inverse .btn-link:focus,fieldset[disabled] .navbar-inverse .btn-link:hover{color:#444}.breadcrumb{padding:8px 15px;margin-bottom:18px;list-style:none;background-color:#f5f5f5;border-radius:2px}.breadcrumb>li{display:inline-block}.breadcrumb>li+li:before{content:"/\00a0";padding:0 5px;color:#5e5e5e}.breadcrumb>.active{color:#777}.pagination{display:inline-block;padding-left:0;margin:18px 0;border-radius:2px}.pagination>li{display:inline}.pagination>li>a,.pagination>li>span{position:relative;float:left;padding:6px 12px;line-height:1.42857143;text-decoration:none;color:#337ab7;background-color:#fff;border:1px solid #ddd;margin-left:-1px}.pagination>li:first-child>a,.pagination>li:first-child>span{margin-left:0;border-bottom-left-radius:2px;border-top-left-radius:2px}.pagination>li:last-child>a,.pagination>li:last-child>span{border-bottom-right-radius:2px;border-top-right-radius:2px}.pagination>li>a:focus,.pagination>li>a:hover,.pagination>li>span:focus,.pagination>li>span:hover{color:#23527c;background-color:#eee;border-color:#ddd}.pagination>.active>a,.pagination>.active>a:focus,.pagination>.active>a:hover,.pagination>.active>span,.pagination>.active>span:focus,.pagination>.active>span:hover{z-index:2;color:#fff;background-color:#337ab7;border-color:#337ab7;cursor:default}.pagination>.disabled>a,.pagination>.disabled>a:focus,.pagination>.disabled>a:hover,.pagination>.disabled>span,.pagination>.disabled>span:focus,.pagination>.disabled>span:hover{color:#777;background-color:#fff;border-color:#ddd;cursor:not-allowed}.pagination-lg>li>a,.pagination-lg>li>span{padding:10px 16px;font-size:17px}.pagination-lg>li:first-child>a,.pagination-lg>li:first-child>span{border-bottom-left-radius:3px;border-top-left-radius:3px}.pagination-lg>li:last-child>a,.pagination-lg>li:last-child>span{border-bottom-right-radius:3px;border-top-right-radius:3px}.pagination-sm>li>a,.pagination-sm>li>span{padding:5px 10px;font-size:12px}.pagination-sm>li:first-child>a,.pagination-sm>li:first-child>span{border-bottom-left-radius:1px;border-top-left-radius:1px}.pagination-sm>li:last-child>a,.pagination-sm>li:last-child>span{border-bottom-right-radius:1px;border-top-right-radius:1px}.pager{padding-left:0;margin:18px 0;list-style:none;text-align:center}.pager li{display:inline}.pager li>a,.pager li>span{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;border-radius:15px}.pager li>a:focus,.pager li>a:hover{text-decoration:none;background-color:#eee}.pager .next>a,.pager .next>span{float:right}.pager .previous>a,.pager .previous>span{float:left}.pager .disabled>a,.pager .disabled>a:focus,.pager .disabled>a:hover,.pager .disabled>span{color:#777;background-color:#fff;cursor:not-allowed}.label{display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em}a.label:focus,a.label:hover{color:#fff;text-decoration:none;cursor:pointer}.label:empty{display:none}.btn .label{position:relative;top:-1px}.label-default{background-color:#777}.label-default[href]:focus,.label-default[href]:hover{background-color:#5e5e5e}.label-primary{background-color:#337ab7}.label-primary[href]:focus,.label-primary[href]:hover{background-color:#286090}.label-success{background-color:#5cb85c}.label-success[href]:focus,.label-success[href]:hover{background-color:#449d44}.label-info{background-color:#5bc0de}.label-info[href]:focus,.label-info[href]:hover{background-color:#31b0d5}.label-warning{background-color:#f0ad4e}.label-warning[href]:focus,.label-warning[href]:hover{background-color:#ec971f}.label-danger{background-color:#d9534f}.label-danger[href]:focus,.label-danger[href]:hover{background-color:#c9302c}.badge{display:inline-block;min-width:10px;padding:3px 7px;font-size:12px;font-weight:700;color:#fff;line-height:1;vertical-align:baseline;white-space:nowrap;text-align:center;background-color:#777;border-radius:10px}.badge:empty{display:none}.btn .badge{position:relative;top:-1px}.btn-group-xs>.btn .badge,.btn-xs .badge{top:0;padding:1px 5px}a.badge:focus,a.badge:hover{color:#fff;text-decoration:none;cursor:pointer}.list-group-item.active>.badge,.nav-pills>.active>a>.badge{color:#337ab7;background-color:#fff}.list-group-item>.badge{float:right}.list-group-item>.badge+.badge{margin-right:5px}.nav-pills>li>a>.badge{margin-left:3px}.jumbotron{padding:30px 15px;margin-bottom:30px;color:inherit;background-color:#eee}.jumbotron .h1,.jumbotron h1{color:inherit}.jumbotron p{margin-bottom:15px;font-size:20px;font-weight:200}.jumbotron>hr{border-top-color:#d5d5d5}.container .jumbotron,.container-fluid .jumbotron{border-radius:3px}.jumbotron .container{max-width:100%}@media screen and (min-width:768px){.jumbotron{padding:48px 0}.container .jumbotron,.container-fluid .jumbotron{padding-left:60px;padding-right:60px}.jumbotron .h1,.jumbotron h1{font-size:58.5px}}.thumbnail{display:block;padding:4px;margin-bottom:18px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:2px;-webkit-transition:border .2s ease-in-out;-o-transition:border .2s ease-in-out;transition:border .2s ease-in-out}.thumbnail a>img,.thumbnail>img{margin-left:auto;margin-right:auto}a.thumbnail.active,a.thumbnail:focus,a.thumbnail:hover{border-color:#337ab7}.thumbnail .caption{padding:9px;color:#000}.alert{padding:15px;margin-bottom:18px;border:1px solid transparent;border-radius:2px}.alert h4{margin-top:0;color:inherit}.alert .alert-link{font-weight:700}.alert>p,.alert>ul{margin-bottom:0}.alert>p+p{margin-top:5px}.alert-dismissable,.alert-dismissible{padding-right:35px}.alert-dismissable .close,.alert-dismissible .close{position:relative;top:-2px;right:-21px;color:inherit}.alert-success{background-color:#dff0d8;border-color:#d6e9c6;color:#3c763d}.alert-success hr{border-top-color:#c9e2b3}.alert-success .alert-link{color:#2b542c}.alert-info{background-color:#d9edf7;border-color:#bce8f1;color:#31708f}.alert-info hr{border-top-color:#a6e1ec}.alert-info .alert-link{color:#245269}.alert-warning{background-color:#fcf8e3;border-color:#faebcc;color:#8a6d3b}.alert-warning hr{border-top-color:#f7e1b5}.alert-warning .alert-link{color:#66512c}.alert-danger{background-color:#f2dede;border-color:#ebccd1;color:#a94442}.alert-danger hr{border-top-color:#e4b9c0}.alert-danger .alert-link{color:#843534}@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}.progress{overflow:hidden;height:18px;margin-bottom:18px;background-color:#f5f5f5;border-radius:2px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1);box-shadow:inset 0 1px 2px rgba(0,0,0,.1)}.progress-bar{float:left;width:0;height:100%;font-size:12px;line-height:18px;color:#fff;text-align:center;background-color:#337ab7;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);-webkit-transition:width .6s ease;-o-transition:width .6s ease;transition:width .6s ease}.progress-bar-striped,.progress-striped .progress-bar{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-size:40px 40px}.progress-bar.active,.progress.active .progress-bar{-webkit-animation:progress-bar-stripes 2s linear infinite;-o-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.progress-bar-success{background-color:#5cb85c}.progress-striped .progress-bar-success{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-info{background-color:#5bc0de}.progress-striped .progress-bar-info{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-warning{background-color:#f0ad4e}.progress-striped .progress-bar-warning{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-danger{background-color:#d9534f}.progress-striped .progress-bar-danger{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.media{margin-top:15px}.media:first-child{margin-top:0}.media,.media-body{zoom:1;overflow:hidden}.media-body{width:10000px}.media-object{display:block}.media-right,.media>.pull-right{padding-left:10px}.media-left,.media>.pull-left{padding-right:10px}.media-body,.media-left,.media-right{display:table-cell;vertical-align:top}.media-middle{vertical-align:middle}.media-bottom{vertical-align:bottom}.media-heading{margin-top:0;margin-bottom:5px}.media-list{padding-left:0;list-style:none}.list-group{margin-bottom:20px;padding-left:0}.list-group-item{position:relative;display:block;padding:10px 15px;margin-bottom:-1px;background-color:#fff;border:1px solid #ddd}.list-group-item:first-child{border-top-right-radius:2px;border-top-left-radius:2px}.list-group-item:last-child{margin-bottom:0;border-bottom-right-radius:2px;border-bottom-left-radius:2px}a.list-group-item{color:#555}a.list-group-item .list-group-item-heading{color:#333}a.list-group-item:focus,a.list-group-item:hover{text-decoration:none;color:#555;background-color:#f5f5f5}.list-group-item.disabled,.list-group-item.disabled:focus,.list-group-item.disabled:hover{background-color:#eee;color:#777;cursor:not-allowed}.list-group-item.disabled .list-group-item-heading,.list-group-item.disabled:focus .list-group-item-heading,.list-group-item.disabled:hover .list-group-item-heading{color:inherit}.list-group-item.disabled .list-group-item-text,.list-group-item.disabled:focus .list-group-item-text,.list-group-item.disabled:hover .list-group-item-text{color:#777}.list-group-item.active,.list-group-item.active:focus,.list-group-item.active:hover{z-index:2;color:#fff;background-color:#337ab7;border-color:#337ab7}.list-group-item.active .list-group-item-heading,.list-group-item.active .list-group-item-heading>.small,.list-group-item.active .list-group-item-heading>small,.list-group-item.active:focus .list-group-item-heading,.list-group-item.active:focus .list-group-item-heading>.small,.list-group-item.active:focus .list-group-item-heading>small,.list-group-item.active:hover .list-group-item-heading,.list-group-item.active:hover .list-group-item-heading>.small,.list-group-item.active:hover .list-group-item-heading>small{color:inherit}.list-group-item.active .list-group-item-text,.list-group-item.active:focus .list-group-item-text,.list-group-item.active:hover .list-group-item-text{color:#c7ddef}.list-group-item-success{color:#3c763d;background-color:#dff0d8}a.list-group-item-success{color:#3c763d}a.list-group-item-success .list-group-item-heading{color:inherit}a.list-group-item-success:focus,a.list-group-item-success:hover{color:#3c763d;background-color:#d0e9c6}a.list-group-item-success.active,a.list-group-item-success.active:focus,a.list-group-item-success.active:hover{color:#fff;background-color:#3c763d;border-color:#3c763d}.list-group-item-info{color:#31708f;background-color:#d9edf7}a.list-group-item-info{color:#31708f}a.list-group-item-info .list-group-item-heading{color:inherit}a.list-group-item-info:focus,a.list-group-item-info:hover{color:#31708f;background-color:#c4e3f3}a.list-group-item-info.active,a.list-group-item-info.active:focus,a.list-group-item-info.active:hover{color:#fff;background-color:#31708f;border-color:#31708f}.list-group-item-warning{color:#8a6d3b;background-color:#fcf8e3}a.list-group-item-warning{color:#8a6d3b}a.list-group-item-warning .list-group-item-heading{color:inherit}a.list-group-item-warning:focus,a.list-group-item-warning:hover{color:#8a6d3b;background-color:#faf2cc}a.list-group-item-warning.active,a.list-group-item-warning.active:focus,a.list-group-item-warning.active:hover{color:#fff;background-color:#8a6d3b;border-color:#8a6d3b}.list-group-item-danger{color:#a94442;background-color:#f2dede}a.list-group-item-danger{color:#a94442}a.list-group-item-danger .list-group-item-heading{color:inherit}a.list-group-item-danger:focus,a.list-group-item-danger:hover{color:#a94442;background-color:#ebcccc}a.list-group-item-danger.active,a.list-group-item-danger.active:focus,a.list-group-item-danger.active:hover{color:#fff;background-color:#a94442;border-color:#a94442}.list-group-item-heading{margin-top:0;margin-bottom:5px}.list-group-item-text{margin-bottom:0;line-height:1.3}.panel{margin-bottom:18px;background-color:#fff;border:1px solid transparent;border-radius:2px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05);box-shadow:0 1px 1px rgba(0,0,0,.05)}.panel-body{padding:15px}.panel-heading{padding:10px 15px;border-bottom:1px solid transparent;border-top-right-radius:1px;border-top-left-radius:1px}.panel-heading>.dropdown .dropdown-toggle{color:inherit}.panel-title{margin-top:0;margin-bottom:0;font-size:15px;color:inherit}.panel-title>.small,.panel-title>.small>a,.panel-title>a,.panel-title>small,.panel-title>small>a{color:inherit}.panel-footer{padding:10px 15px;background-color:#f5f5f5;border-top:1px solid #ddd;border-bottom-right-radius:1px;border-bottom-left-radius:1px}.panel>.list-group,.panel>.panel-collapse>.list-group{margin-bottom:0}.panel>.list-group .list-group-item,.panel>.panel-collapse>.list-group .list-group-item{border-width:1px 0;border-radius:0}.panel>.list-group:first-child .list-group-item:first-child,.panel>.panel-collapse>.list-group:first-child .list-group-item:first-child{border-top:0;border-top-right-radius:1px;border-top-left-radius:1px}.panel>.list-group:last-child .list-group-item:last-child,.panel>.panel-collapse>.list-group:last-child .list-group-item:last-child{border-bottom:0;border-bottom-right-radius:1px;border-bottom-left-radius:1px}.list-group+.panel-footer,.panel-heading+.list-group .list-group-item:first-child{border-top-width:0}.panel>.panel-collapse>.table,.panel>.table,.panel>.table-responsive>.table{margin-bottom:0}.panel>.panel-collapse>.table caption,.panel>.table caption,.panel>.table-responsive>.table caption{padding-left:15px;padding-right:15px}.panel>.table-responsive:first-child>.table:first-child,.panel>.table:first-child{border-top-right-radius:1px;border-top-left-radius:1px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child,.panel>.table:first-child>thead:first-child>tr:first-child{border-top-left-radius:1px;border-top-right-radius:1px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table:first-child>thead:first-child>tr:first-child th:first-child{border-top-left-radius:1px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table:first-child>thead:first-child>tr:first-child th:last-child{border-top-right-radius:1px}.panel>.table-responsive:last-child>.table:last-child,.panel>.table:last-child{border-bottom-right-radius:1px;border-bottom-left-radius:1px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child{border-bottom-left-radius:1px;border-bottom-right-radius:1px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:first-child{border-bottom-left-radius:1px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:last-child{border-bottom-right-radius:1px}.panel>.panel-body+.table,.panel>.panel-body+.table-responsive,.panel>.table+.panel-body,.panel>.table-responsive+.panel-body{border-top:1px solid #ddd}.panel>.table>tbody:first-child>tr:first-child td,.panel>.table>tbody:first-child>tr:first-child th{border-top:0}.panel>.table-bordered,.panel>.table-responsive>.table-bordered{border:0}.panel>.table-bordered>tbody>tr>td:first-child,.panel>.table-bordered>tbody>tr>th:first-child,.panel>.table-bordered>tfoot>tr>td:first-child,.panel>.table-bordered>tfoot>tr>th:first-child,.panel>.table-bordered>thead>tr>td:first-child,.panel>.table-bordered>thead>tr>th:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:first-child,.panel>.table-responsive>.table-bordered>thead>tr>td:first-child,.panel>.table-responsive>.table-bordered>thead>tr>th:first-child{border-left:0}.panel>.table-bordered>tbody>tr>td:last-child,.panel>.table-bordered>tbody>tr>th:last-child,.panel>.table-bordered>tfoot>tr>td:last-child,.panel>.table-bordered>tfoot>tr>th:last-child,.panel>.table-bordered>thead>tr>td:last-child,.panel>.table-bordered>thead>tr>th:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:last-child,.panel>.table-responsive>.table-bordered>thead>tr>td:last-child,.panel>.table-responsive>.table-bordered>thead>tr>th:last-child{border-right:0}.panel>.table-bordered>tbody>tr:first-child>td,.panel>.table-bordered>tbody>tr:first-child>th,.panel>.table-bordered>tbody>tr:last-child>td,.panel>.table-bordered>tbody>tr:last-child>th,.panel>.table-bordered>tfoot>tr:last-child>td,.panel>.table-bordered>tfoot>tr:last-child>th,.panel>.table-bordered>thead>tr:first-child>td,.panel>.table-bordered>thead>tr:first-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>th,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>td,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>th,.panel>.table-responsive>.table-bordered>thead>tr:first-child>td,.panel>.table-responsive>.table-bordered>thead>tr:first-child>th{border-bottom:0}.panel>.table-responsive{border:0;margin-bottom:0}.panel-group{margin-bottom:18px}.panel-group .panel{margin-bottom:0;border-radius:2px}.panel-group .panel+.panel{margin-top:5px}.panel-group .panel-heading{border-bottom:0}.panel-group .panel-heading+.panel-collapse>.list-group,.panel-group .panel-heading+.panel-collapse>.panel-body{border-top:1px solid #ddd}.panel-group .panel-footer{border-top:0}.panel-group .panel-footer+.panel-collapse .panel-body{border-bottom:1px solid #ddd}.panel-default{border-color:#ddd}.panel-default>.panel-heading{color:#333;background-color:#f5f5f5;border-color:#ddd}.panel-default>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ddd}.panel-default>.panel-heading .badge{color:#f5f5f5;background-color:#333}.panel-default>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ddd}.panel-primary{border-color:#337ab7}.panel-primary>.panel-heading{color:#fff;background-color:#337ab7;border-color:#337ab7}.panel-primary>.panel-heading+.panel-collapse>.panel-body{border-top-color:#337ab7}.panel-primary>.panel-heading .badge{color:#337ab7;background-color:#fff}.panel-primary>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#337ab7}.panel-success{border-color:#d6e9c6}.panel-success>.panel-heading{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.panel-success>.panel-heading+.panel-collapse>.panel-body{border-top-color:#d6e9c6}.panel-success>.panel-heading .badge{color:#dff0d8;background-color:#3c763d}.panel-success>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#d6e9c6}.panel-info{border-color:#bce8f1}.panel-info>.panel-heading{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.panel-info>.panel-heading+.panel-collapse>.panel-body{border-top-color:#bce8f1}.panel-info>.panel-heading .badge{color:#d9edf7;background-color:#31708f}.panel-info>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#bce8f1}.panel-warning{border-color:#faebcc}.panel-warning>.panel-heading{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.panel-warning>.panel-heading+.panel-collapse>.panel-body{border-top-color:#faebcc}.panel-warning>.panel-heading .badge{color:#fcf8e3;background-color:#8a6d3b}.panel-warning>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#faebcc}.panel-danger{border-color:#ebccd1}.panel-danger>.panel-heading{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.panel-danger>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ebccd1}.panel-danger>.panel-heading .badge{color:#f2dede;background-color:#a94442}.panel-danger>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ebccd1}.embed-responsive{position:relative;display:block;height:0;padding:0;overflow:hidden}.embed-responsive .embed-responsive-item,.embed-responsive embed,.embed-responsive iframe,.embed-responsive object,.embed-responsive video{position:absolute;top:0;left:0;bottom:0;height:100%;width:100%;border:0}.embed-responsive-16by9{padding-bottom:56.25%}.embed-responsive-4by3{padding-bottom:75%}.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;border-radius:2px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.05);box-shadow:inset 0 1px 1px rgba(0,0,0,.05)}.well blockquote{border-color:#ddd;border-color:rgba(0,0,0,.15)}.well-lg{padding:24px;border-radius:3px}.well-sm{padding:9px;border-radius:1px}.close{float:right;font-size:19.5px;font-weight:700;line-height:1;color:#000;text-shadow:0 1px 0 #fff;opacity:.2;filter:alpha(opacity=20)}.close:focus,.close:hover{color:#000;text-decoration:none;cursor:pointer;opacity:.5;filter:alpha(opacity=50)}button.close{padding:0;cursor:pointer;background:0 0;border:0;-webkit-appearance:none}.modal-open{overflow:hidden}.modal{display:none;overflow:hidden;position:fixed;top:0;right:0;bottom:0;left:0;z-index:1050;-webkit-overflow-scrolling:touch;outline:0}.modal.fade .modal-dialog{-webkit-transition:-webkit-transform .3s ease-out;-moz-transition:-moz-transform .3s ease-out;-o-transition:-o-transform .3s ease-out;transition:transform .3s ease-out}.modal.in .modal-dialog{-webkit-transform:translate(0,0);-ms-transform:translate(0,0);-o-transform:translate(0,0);transform:translate(0,0)}.modal-open .modal{overflow-x:hidden;overflow-y:auto}.modal-dialog{position:relative;width:auto;margin:10px}.modal-content{position:relative;background-color:#fff;border:1px solid #999;border:1px solid rgba(0,0,0,.2);border-radius:3px;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5);background-clip:padding-box;outline:0}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000}.modal-backdrop.fade{opacity:0;filter:alpha(opacity=0)}.modal-backdrop.in{opacity:.5;filter:alpha(opacity=50)}.modal-header{padding:15px;border-bottom:1px solid #e5e5e5;min-height:16.43px}.modal-header .close{margin-top:-2px}.modal-title{margin:0;line-height:1.42857143}.modal-body{position:relative;padding:15px}.modal-footer{padding:15px;text-align:right;border-top:1px solid #e5e5e5}.modal-footer .btn+.btn{margin-left:5px;margin-bottom:0}.modal-footer .btn-group .btn+.btn{margin-left:-1px}.modal-footer .btn-block+.btn-block{margin-left:0}.modal-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}@media (min-width:768px){.modal-dialog{width:600px;margin:30px auto}.modal-content{-webkit-box-shadow:0 5px 15px rgba(0,0,0,.5);box-shadow:0 5px 15px rgba(0,0,0,.5)}.modal-sm{width:300px}}@media (min-width:992px){.modal-lg{width:900px}}.tooltip{position:absolute;z-index:1070;display:block;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:12px;font-weight:400;line-height:1.4;opacity:0;filter:alpha(opacity=0)}.tooltip.in{opacity:.9;filter:alpha(opacity=90)}.tooltip.top{margin-top:-3px;padding:5px 0}.tooltip.right{margin-left:3px;padding:0 5px}.tooltip.bottom{margin-top:3px;padding:5px 0}.tooltip.left{margin-left:-3px;padding:0 5px}.tooltip-inner{max-width:200px;padding:3px 8px;color:#fff;text-align:center;text-decoration:none;background-color:#000;border-radius:2px}.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-left .tooltip-arrow{bottom:0;right:5px;margin-bottom:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-right .tooltip-arrow{bottom:0;left:5px;margin-bottom:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-width:5px 5px 5px 0;border-right-color:#000}.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-width:5px 0 5px 5px;border-left-color:#000}.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-left .tooltip-arrow{top:0;right:5px;margin-top:-5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-right .tooltip-arrow{top:0;left:5px;margin-top:-5px;border-width:0 5px 5px;border-bottom-color:#000}.popover{position:absolute;top:0;left:0;z-index:1060;display:none;max-width:276px;padding:1px;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px;font-weight:400;line-height:1.42857143;text-align:left;background-color:#fff;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.2);border-radius:3px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);white-space:normal}.popover.top{margin-top:-10px}.popover.right{margin-left:10px}.popover.bottom{margin-top:10px}.popover.left{margin-left:-10px}.popover-title{margin:0;padding:8px 14px;font-size:13px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;border-radius:2px 2px 0 0}.popover-content{padding:9px 14px}.popover>.arrow,.popover>.arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.popover>.arrow{border-width:11px}.popover>.arrow:after{border-width:10px;content:""}.popover.top>.arrow{left:50%;margin-left:-11px;border-bottom-width:0;border-top-color:#999;border-top-color:rgba(0,0,0,.25);bottom:-11px}.popover.top>.arrow:after{content:" ";bottom:1px;margin-left:-10px;border-bottom-width:0;border-top-color:#fff}.popover.right>.arrow{top:50%;left:-11px;margin-top:-11px;border-left-width:0;border-right-color:#999;border-right-color:rgba(0,0,0,.25)}.popover.right>.arrow:after{content:" ";left:1px;bottom:-10px;border-left-width:0;border-right-color:#fff}.popover.bottom>.arrow{left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#999;border-bottom-color:rgba(0,0,0,.25);top:-11px}.popover.bottom>.arrow:after{content:" ";top:1px;margin-left:-10px;border-top-width:0;border-bottom-color:#fff}.popover.left>.arrow{top:50%;right:-11px;margin-top:-11px;border-right-width:0;border-left-color:#999;border-left-color:rgba(0,0,0,.25)}.popover.left>.arrow:after{content:" ";right:1px;border-right-width:0;border-left-color:#fff;bottom:-10px}.carousel{position:relative}.carousel-inner{position:relative;overflow:hidden;width:100%}.carousel-inner>.item{display:none;position:relative;-webkit-transition:.6s ease-in-out left;-o-transition:.6s ease-in-out left;transition:.6s ease-in-out left}.carousel-inner>.item>a>img,.carousel-inner>.item>img{line-height:1}@media all and (transform-3d),(-webkit-transform-3d){.carousel-inner>.item{-webkit-transition:-webkit-transform .6s ease-in-out;-moz-transition:-moz-transform .6s ease-in-out;-o-transition:-o-transform .6s ease-in-out;transition:transform .6s ease-in-out;-webkit-backface-visibility:hidden;-moz-backface-visibility:hidden;backface-visibility:hidden;-webkit-perspective:1000;-moz-perspective:1000;perspective:1000}.carousel-inner>.item.active.right,.carousel-inner>.item.next{-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0);left:0}.carousel-inner>.item.active.left,.carousel-inner>.item.prev{-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0);left:0}.carousel-inner>.item.active,.carousel-inner>.item.next.left,.carousel-inner>.item.prev.right{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);left:0}}.carousel-inner>.active,.carousel-inner>.next,.carousel-inner>.prev{display:block}.carousel-inner>.active{left:0}.carousel-inner>.next,.carousel-inner>.prev{position:absolute;top:0;width:100%}.carousel-inner>.next{left:100%}.carousel-inner>.prev{left:-100%}.carousel-inner>.next.left,.carousel-inner>.prev.right{left:0}.carousel-inner>.active.left{left:-100%}.carousel-inner>.active.right{left:100%}.carousel-control{position:absolute;top:0;left:0;bottom:0;width:15%;opacity:.5;filter:alpha(opacity=50);font-size:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6)}.carousel-control.left{background-image:-webkit-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:linear-gradient(to right,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1)}.carousel-control.right{left:auto;right:0;background-image:-webkit-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:linear-gradient(to right,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1)}.carousel-control:focus,.carousel-control:hover{outline:0;color:#fff;text-decoration:none;opacity:.9;filter:alpha(opacity=90)}.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next,.carousel-control .icon-prev{position:absolute;top:50%;z-index:5;display:inline-block}.carousel-control .glyphicon-chevron-left,.carousel-control .icon-prev{left:50%;margin-left:-10px}.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next{right:50%;margin-right:-10px}.carousel-control .icon-next,.carousel-control .icon-prev{width:20px;height:20px;margin-top:-10px;line-height:1;font-family:serif}.carousel-control .icon-prev:before{content:'\2039'}.carousel-control .icon-next:before{content:'\203a'}.carousel-indicators{position:absolute;bottom:10px;left:50%;z-index:15;width:60%;margin-left:-30%;padding-left:0;list-style:none;text-align:center}.carousel-indicators li{display:inline-block;width:10px;height:10px;margin:1px;text-indent:-999px;border:1px solid #fff;border-radius:10px;cursor:pointer;background-color:transparent}.carousel-indicators .active{margin:0;width:12px;height:12px;background-color:#fff}.carousel-caption{position:absolute;left:15%;right:15%;bottom:20px;z-index:10;padding-top:20px;padding-bottom:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6)}.carousel-caption .btn{text-shadow:none}@media screen and (min-width:768px){.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next,.carousel-control .icon-prev{width:30px;height:30px;margin-top:-15px;font-size:30px}.carousel-control .glyphicon-chevron-left,.carousel-control .icon-prev{margin-left:-15px}.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next{margin-right:-15px}.carousel-caption{left:20%;right:20%;padding-bottom:30px}.carousel-indicators{bottom:20px}}.btn-group-vertical>.btn-group:after,.btn-group-vertical>.btn-group:before,.btn-toolbar:after,.btn-toolbar:before,.clearfix:after,.clearfix:before,.container-fluid:after,.container-fluid:before,.container:after,.container:before,.dl-horizontal dd:after,.dl-horizontal dd:before,.form-horizontal .form-group:after,.form-horizontal .form-group:before,.item_buttons:after,.item_buttons:before,.modal-footer:after,.modal-footer:before,.nav:after,.nav:before,.navbar-collapse:after,.navbar-collapse:before,.navbar-header:after,.navbar-header:before,.navbar:after,.navbar:before,.pager:after,.pager:before,.panel-body:after,.panel-body:before,.row:after,.row:before{content:" ";display:table}.btn-group-vertical>.btn-group:after,.btn-toolbar:after,.clearfix:after,.container-fluid:after,.container:after,.dl-horizontal dd:after,.form-horizontal .form-group:after,.item_buttons:after,.modal-footer:after,.nav:after,.navbar-collapse:after,.navbar-header:after,.navbar:after,.pager:after,.panel-body:after,.row:after{clear:both}.center-block{display:block;margin-left:auto;margin-right:auto}.pull-right{float:right!important}.pull-left{float:left!important}.hide{display:none!important}.show{display:block!important}.invisible{visibility:hidden}.text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.hidden{display:none!important}.affix{position:fixed}@-ms-viewport{width:device-width}.visible-lg,.visible-lg-block,.visible-lg-inline,.visible-lg-inline-block,.visible-md,.visible-md-block,.visible-md-inline,.visible-md-inline-block,.visible-sm,.visible-sm-block,.visible-sm-inline,.visible-sm-inline-block,.visible-xs,.visible-xs-block,.visible-xs-inline,.visible-xs-inline-block{display:none!important}@media (max-width:767px){.visible-xs{display:block!important}table.visible-xs{display:table}tr.visible-xs{display:table-row!important}td.visible-xs,th.visible-xs{display:table-cell!important}.visible-xs-block{display:block!important}.visible-xs-inline{display:inline!important}.visible-xs-inline-block{display:inline-block!important}}@media (min-width:768px)and (max-width:991px){.visible-sm{display:block!important}table.visible-sm{display:table}tr.visible-sm{display:table-row!important}td.visible-sm,th.visible-sm{display:table-cell!important}.visible-sm-block{display:block!important}.visible-sm-inline{display:inline!important}.visible-sm-inline-block{display:inline-block!important}}@media (min-width:992px)and (max-width:1199px){.visible-md{display:block!important}table.visible-md{display:table}tr.visible-md{display:table-row!important}td.visible-md,th.visible-md{display:table-cell!important}.visible-md-block{display:block!important}.visible-md-inline{display:inline!important}.visible-md-inline-block{display:inline-block!important}}@media (min-width:1200px){.visible-lg{display:block!important}table.visible-lg{display:table}tr.visible-lg{display:table-row!important}td.visible-lg,th.visible-lg{display:table-cell!important}.visible-lg-block{display:block!important}.visible-lg-inline{display:inline!important}.visible-lg-inline-block{display:inline-block!important}}@media (max-width:767px){.hidden-xs{display:none!important}}@media (min-width:768px)and (max-width:991px){.hidden-sm{display:none!important}}@media (min-width:992px)and (max-width:1199px){.hidden-md{display:none!important}}@media (min-width:1200px){.hidden-lg{display:none!important}}.visible-print{display:none!important}@media print{.visible-print{display:block!important}table.visible-print{display:table}tr.visible-print{display:table-row!important}td.visible-print,th.visible-print{display:table-cell!important}}.visible-print-block{display:none!important}@media print{.visible-print-block{display:block!important}}.visible-print-inline{display:none!important}@media print{.visible-print-inline{display:inline!important}}.visible-print-inline-block{display:none!important}@media print{.visible-print-inline-block{display:inline-block!important}.hidden-print{display:none!important}}/*!
+*
+* Font Awesome
+*
+*//*!
+ * Font Awesome 4.2.0 by @davegandy - http://fontawesome.io - @fontawesome
+ * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
+ */@font-face{font-family:'FontAwesome';src:url(../components/font-awesome/fonts/fontawesome-webfont.eot?v=4.2.0);src:url(../components/font-awesome/fonts/fontawesome-webfont.eot?#iefix&v=4.2.0)format('embedded-opentype'),url(../components/font-awesome/fonts/fontawesome-webfont.woff?v=4.2.0)format('woff'),url(../components/font-awesome/fonts/fontawesome-webfont.ttf?v=4.2.0)format('truetype'),url(../components/font-awesome/fonts/fontawesome-webfont.svg?v=4.2.0#fontawesomeregular)format('svg');font-weight:400;font-style:normal}.fa{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fa-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-fw{width:1.28571429em;text-align:center}.fa-ul{padding-left:0;margin-left:2.14285714em;list-style-type:none}.fa-ul>li{position:relative}.fa-li{position:absolute;left:-2.14285714em;width:2.14285714em;top:.14285714em;text-align:center}.fa-li.fa-lg{left:-1.85714286em}.fa-border{padding:.2em .25em .15em;border:.08em solid #eee;border-radius:.1em}.fa.pull-left{margin-right:.3em}.fa.pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fa-rotate-90{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1);-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2);-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=3);-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1);-webkit-transform:scale(-1,1);-ms-transform:scale(-1,1);transform:scale(-1,1)}.fa-flip-vertical{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1);-webkit-transform:scale(1,-1);-ms-transform:scale(1,-1);transform:scale(1,-1)}:root .fa-flip-horizontal,:root .fa-flip-vertical,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-rotate-90{filter:none}.fa-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}.fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-glass:before{content:"\f000"}.fa-music:before{content:"\f001"}.fa-search:before{content:"\f002"}.fa-envelope-o:before{content:"\f003"}.fa-heart:before{content:"\f004"}.fa-star:before{content:"\f005"}.fa-star-o:before{content:"\f006"}.fa-user:before{content:"\f007"}.fa-film:before{content:"\f008"}.fa-th-large:before{content:"\f009"}.fa-th:before{content:"\f00a"}.fa-th-list:before{content:"\f00b"}.fa-check:before{content:"\f00c"}.fa-close:before,.fa-remove:before,.fa-times:before{content:"\f00d"}.fa-search-plus:before{content:"\f00e"}.fa-search-minus:before{content:"\f010"}.fa-power-off:before{content:"\f011"}.fa-signal:before{content:"\f012"}.fa-cog:before,.fa-gear:before{content:"\f013"}.fa-trash-o:before{content:"\f014"}.fa-home:before{content:"\f015"}.fa-file-o:before{content:"\f016"}.fa-clock-o:before{content:"\f017"}.fa-road:before{content:"\f018"}.fa-download:before{content:"\f019"}.fa-arrow-circle-o-down:before{content:"\f01a"}.fa-arrow-circle-o-up:before{content:"\f01b"}.fa-inbox:before{content:"\f01c"}.fa-play-circle-o:before{content:"\f01d"}.fa-repeat:before,.fa-rotate-right:before{content:"\f01e"}.fa-refresh:before{content:"\f021"}.fa-list-alt:before{content:"\f022"}.fa-lock:before{content:"\f023"}.fa-flag:before{content:"\f024"}.fa-headphones:before{content:"\f025"}.fa-volume-off:before{content:"\f026"}.fa-volume-down:before{content:"\f027"}.fa-volume-up:before{content:"\f028"}.fa-qrcode:before{content:"\f029"}.fa-barcode:before{content:"\f02a"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-book:before{content:"\f02d"}.fa-bookmark:before{content:"\f02e"}.fa-print:before{content:"\f02f"}.fa-camera:before{content:"\f030"}.fa-font:before{content:"\f031"}.fa-bold:before{content:"\f032"}.fa-italic:before{content:"\f033"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-align-left:before{content:"\f036"}.fa-align-center:before{content:"\f037"}.fa-align-right:before{content:"\f038"}.fa-align-justify:before{content:"\f039"}.fa-list:before{content:"\f03a"}.fa-dedent:before,.fa-outdent:before{content:"\f03b"}.fa-indent:before{content:"\f03c"}.fa-video-camera:before{content:"\f03d"}.fa-image:before,.fa-photo:before,.fa-picture-o:before{content:"\f03e"}.fa-pencil:before{content:"\f040"}.fa-map-marker:before{content:"\f041"}.fa-adjust:before{content:"\f042"}.fa-tint:before{content:"\f043"}.fa-edit:before,.fa-pencil-square-o:before{content:"\f044"}.fa-share-square-o:before{content:"\f045"}.fa-check-square-o:before{content:"\f046"}.fa-arrows:before{content:"\f047"}.fa-step-backward:before{content:"\f048"}.fa-fast-backward:before{content:"\f049"}.fa-backward:before{content:"\f04a"}.fa-play:before{content:"\f04b"}.fa-pause:before{content:"\f04c"}.fa-stop:before{content:"\f04d"}.fa-forward:before{content:"\f04e"}.fa-fast-forward:before{content:"\f050"}.fa-step-forward:before{content:"\f051"}.fa-eject:before{content:"\f052"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-plus-circle:before{content:"\f055"}.fa-minus-circle:before{content:"\f056"}.fa-times-circle:before{content:"\f057"}.fa-check-circle:before{content:"\f058"}.fa-question-circle:before{content:"\f059"}.fa-info-circle:before{content:"\f05a"}.fa-crosshairs:before{content:"\f05b"}.fa-times-circle-o:before{content:"\f05c"}.fa-check-circle-o:before{content:"\f05d"}.fa-ban:before{content:"\f05e"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrow-down:before{content:"\f063"}.fa-mail-forward:before,.fa-share:before{content:"\f064"}.fa-expand:before{content:"\f065"}.fa-compress:before{content:"\f066"}.fa-plus:before{content:"\f067"}.fa-minus:before{content:"\f068"}.fa-asterisk:before{content:"\f069"}.fa-exclamation-circle:before{content:"\f06a"}.fa-gift:before{content:"\f06b"}.fa-leaf:before{content:"\f06c"}.fa-fire:before{content:"\f06d"}.fa-eye:before{content:"\f06e"}.fa-eye-slash:before{content:"\f070"}.fa-exclamation-triangle:before,.fa-warning:before{content:"\f071"}.fa-plane:before{content:"\f072"}.fa-calendar:before{content:"\f073"}.fa-random:before{content:"\f074"}.fa-comment:before{content:"\f075"}.fa-magnet:before{content:"\f076"}.fa-chevron-up:before{content:"\f077"}.fa-chevron-down:before{content:"\f078"}.fa-retweet:before{content:"\f079"}.fa-shopping-cart:before{content:"\f07a"}.fa-folder:before{content:"\f07b"}.fa-folder-open:before{content:"\f07c"}.fa-arrows-v:before{content:"\f07d"}.fa-arrows-h:before{content:"\f07e"}.fa-bar-chart-o:before,.fa-bar-chart:before{content:"\f080"}.fa-twitter-square:before{content:"\f081"}.fa-facebook-square:before{content:"\f082"}.fa-camera-retro:before{content:"\f083"}.fa-key:before{content:"\f084"}.fa-cogs:before,.fa-gears:before{content:"\f085"}.fa-comments:before{content:"\f086"}.fa-thumbs-o-up:before{content:"\f087"}.fa-thumbs-o-down:before{content:"\f088"}.fa-star-half:before{content:"\f089"}.fa-heart-o:before{content:"\f08a"}.fa-sign-out:before{content:"\f08b"}.fa-linkedin-square:before{content:"\f08c"}.fa-thumb-tack:before{content:"\f08d"}.fa-external-link:before{content:"\f08e"}.fa-sign-in:before{content:"\f090"}.fa-trophy:before{content:"\f091"}.fa-github-square:before{content:"\f092"}.fa-upload:before{content:"\f093"}.fa-lemon-o:before{content:"\f094"}.fa-phone:before{content:"\f095"}.fa-square-o:before{content:"\f096"}.fa-bookmark-o:before{content:"\f097"}.fa-phone-square:before{content:"\f098"}.fa-twitter:before{content:"\f099"}.fa-facebook:before{content:"\f09a"}.fa-github:before{content:"\f09b"}.fa-unlock:before{content:"\f09c"}.fa-credit-card:before{content:"\f09d"}.fa-rss:before{content:"\f09e"}.fa-hdd-o:before{content:"\f0a0"}.fa-bullhorn:before{content:"\f0a1"}.fa-bell:before{content:"\f0f3"}.fa-certificate:before{content:"\f0a3"}.fa-hand-o-right:before{content:"\f0a4"}.fa-hand-o-left:before{content:"\f0a5"}.fa-hand-o-up:before{content:"\f0a6"}.fa-hand-o-down:before{content:"\f0a7"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-globe:before{content:"\f0ac"}.fa-wrench:before{content:"\f0ad"}.fa-tasks:before{content:"\f0ae"}.fa-filter:before{content:"\f0b0"}.fa-briefcase:before{content:"\f0b1"}.fa-arrows-alt:before{content:"\f0b2"}.fa-group:before,.fa-users:before{content:"\f0c0"}.fa-chain:before,.fa-link:before{content:"\f0c1"}.fa-cloud:before{content:"\f0c2"}.fa-flask:before{content:"\f0c3"}.fa-cut:before,.fa-scissors:before{content:"\f0c4"}.fa-copy:before,.fa-files-o:before{content:"\f0c5"}.fa-paperclip:before{content:"\f0c6"}.fa-floppy-o:before,.fa-save:before{content:"\f0c7"}.fa-square:before{content:"\f0c8"}.fa-bars:before,.fa-navicon:before,.fa-reorder:before{content:"\f0c9"}.fa-list-ul:before{content:"\f0ca"}.fa-list-ol:before{content:"\f0cb"}.fa-strikethrough:before{content:"\f0cc"}.fa-underline:before{content:"\f0cd"}.fa-table:before{content:"\f0ce"}.fa-magic:before{content:"\f0d0"}.fa-truck:before{content:"\f0d1"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-square:before{content:"\f0d3"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-plus:before{content:"\f0d5"}.fa-money:before{content:"\f0d6"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-up:before{content:"\f0d8"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-columns:before{content:"\f0db"}.fa-sort:before,.fa-unsorted:before{content:"\f0dc"}.fa-sort-desc:before,.fa-sort-down:before{content:"\f0dd"}.fa-sort-asc:before,.fa-sort-up:before{content:"\f0de"}.fa-envelope:before{content:"\f0e0"}.fa-linkedin:before{content:"\f0e1"}.fa-rotate-left:before,.fa-undo:before{content:"\f0e2"}.fa-gavel:before,.fa-legal:before{content:"\f0e3"}.fa-dashboard:before,.fa-tachometer:before{content:"\f0e4"}.fa-comment-o:before{content:"\f0e5"}.fa-comments-o:before{content:"\f0e6"}.fa-bolt:before,.fa-flash:before{content:"\f0e7"}.fa-sitemap:before{content:"\f0e8"}.fa-umbrella:before{content:"\f0e9"}.fa-clipboard:before,.fa-paste:before{content:"\f0ea"}.fa-lightbulb-o:before{content:"\f0eb"}.fa-exchange:before{content:"\f0ec"}.fa-cloud-download:before{content:"\f0ed"}.fa-cloud-upload:before{content:"\f0ee"}.fa-user-md:before{content:"\f0f0"}.fa-stethoscope:before{content:"\f0f1"}.fa-suitcase:before{content:"\f0f2"}.fa-bell-o:before{content:"\f0a2"}.fa-coffee:before{content:"\f0f4"}.fa-cutlery:before{content:"\f0f5"}.fa-file-text-o:before{content:"\f0f6"}.fa-building-o:before{content:"\f0f7"}.fa-hospital-o:before{content:"\f0f8"}.fa-ambulance:before{content:"\f0f9"}.fa-medkit:before{content:"\f0fa"}.fa-fighter-jet:before{content:"\f0fb"}.fa-beer:before{content:"\f0fc"}.fa-h-square:before{content:"\f0fd"}.fa-plus-square:before{content:"\f0fe"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angle-down:before{content:"\f107"}.fa-desktop:before{content:"\f108"}.fa-laptop:before{content:"\f109"}.fa-tablet:before{content:"\f10a"}.fa-mobile-phone:before,.fa-mobile:before{content:"\f10b"}.fa-circle-o:before{content:"\f10c"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-spinner:before{content:"\f110"}.fa-circle:before{content:"\f111"}.fa-mail-reply:before,.fa-reply:before{content:"\f112"}.fa-github-alt:before{content:"\f113"}.fa-folder-o:before{content:"\f114"}.fa-folder-open-o:before{content:"\f115"}.fa-smile-o:before{content:"\f118"}.fa-frown-o:before{content:"\f119"}.fa-meh-o:before{content:"\f11a"}.fa-gamepad:before{content:"\f11b"}.fa-keyboard-o:before{content:"\f11c"}.fa-flag-o:before{content:"\f11d"}.fa-flag-checkered:before{content:"\f11e"}.fa-terminal:before{content:"\f120"}.fa-code:before{content:"\f121"}.fa-mail-reply-all:before,.fa-reply-all:before{content:"\f122"}.fa-star-half-empty:before,.fa-star-half-full:before,.fa-star-half-o:before{content:"\f123"}.fa-location-arrow:before{content:"\f124"}.fa-crop:before{content:"\f125"}.fa-code-fork:before{content:"\f126"}.fa-chain-broken:before,.fa-unlink:before{content:"\f127"}.fa-question:before{content:"\f128"}.fa-info:before{content:"\f129"}.fa-exclamation:before{content:"\f12a"}.fa-superscript:before{content:"\f12b"}.fa-subscript:before{content:"\f12c"}.fa-eraser:before{content:"\f12d"}.fa-puzzle-piece:before{content:"\f12e"}.fa-microphone:before{content:"\f130"}.fa-microphone-slash:before{content:"\f131"}.fa-shield:before{content:"\f132"}.fa-calendar-o:before{content:"\f133"}.fa-fire-extinguisher:before{content:"\f134"}.fa-rocket:before{content:"\f135"}.fa-maxcdn:before{content:"\f136"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-html5:before{content:"\f13b"}.fa-css3:before{content:"\f13c"}.fa-anchor:before{content:"\f13d"}.fa-unlock-alt:before{content:"\f13e"}.fa-bullseye:before{content:"\f140"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-rss-square:before{content:"\f143"}.fa-play-circle:before{content:"\f144"}.fa-ticket:before{content:"\f145"}.fa-minus-square:before{content:"\f146"}.fa-minus-square-o:before{content:"\f147"}.fa-level-up:before{content:"\f148"}.fa-level-down:before{content:"\f149"}.fa-check-square:before{content:"\f14a"}.fa-pencil-square:before{content:"\f14b"}.fa-external-link-square:before{content:"\f14c"}.fa-share-square:before{content:"\f14d"}.fa-compass:before{content:"\f14e"}.fa-caret-square-o-down:before,.fa-toggle-down:before{content:"\f150"}.fa-caret-square-o-up:before,.fa-toggle-up:before{content:"\f151"}.fa-caret-square-o-right:before,.fa-toggle-right:before{content:"\f152"}.fa-eur:before,.fa-euro:before{content:"\f153"}.fa-gbp:before{content:"\f154"}.fa-dollar:before,.fa-usd:before{content:"\f155"}.fa-inr:before,.fa-rupee:before{content:"\f156"}.fa-cny:before,.fa-jpy:before,.fa-rmb:before,.fa-yen:before{content:"\f157"}.fa-rouble:before,.fa-rub:before,.fa-ruble:before{content:"\f158"}.fa-krw:before,.fa-won:before{content:"\f159"}.fa-bitcoin:before,.fa-btc:before{content:"\f15a"}.fa-file:before{content:"\f15b"}.fa-file-text:before{content:"\f15c"}.fa-sort-alpha-asc:before{content:"\f15d"}.fa-sort-alpha-desc:before{content:"\f15e"}.fa-sort-amount-asc:before{content:"\f160"}.fa-sort-amount-desc:before{content:"\f161"}.fa-sort-numeric-asc:before{content:"\f162"}.fa-sort-numeric-desc:before{content:"\f163"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbs-down:before{content:"\f165"}.fa-youtube-square:before{content:"\f166"}.fa-youtube:before{content:"\f167"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-youtube-play:before{content:"\f16a"}.fa-dropbox:before{content:"\f16b"}.fa-stack-overflow:before{content:"\f16c"}.fa-instagram:before{content:"\f16d"}.fa-flickr:before{content:"\f16e"}.fa-adn:before{content:"\f170"}.fa-bitbucket:before{content:"\f171"}.fa-bitbucket-square:before{content:"\f172"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-long-arrow-down:before{content:"\f175"}.fa-long-arrow-up:before{content:"\f176"}.fa-long-arrow-left:before{content:"\f177"}.fa-long-arrow-right:before{content:"\f178"}.fa-apple:before{content:"\f179"}.fa-windows:before{content:"\f17a"}.fa-android:before{content:"\f17b"}.fa-linux:before{content:"\f17c"}.fa-dribbble:before{content:"\f17d"}.fa-skype:before{content:"\f17e"}.fa-foursquare:before{content:"\f180"}.fa-trello:before{content:"\f181"}.fa-female:before{content:"\f182"}.fa-male:before{content:"\f183"}.fa-gittip:before{content:"\f184"}.fa-sun-o:before{content:"\f185"}.fa-moon-o:before{content:"\f186"}.fa-archive:before{content:"\f187"}.fa-bug:before{content:"\f188"}.fa-vk:before{content:"\f189"}.fa-weibo:before{content:"\f18a"}.fa-renren:before{content:"\f18b"}.fa-pagelines:before{content:"\f18c"}.fa-stack-exchange:before{content:"\f18d"}.fa-arrow-circle-o-right:before{content:"\f18e"}.fa-arrow-circle-o-left:before{content:"\f190"}.fa-caret-square-o-left:before,.fa-toggle-left:before{content:"\f191"}.fa-dot-circle-o:before{content:"\f192"}.fa-wheelchair:before{content:"\f193"}.fa-vimeo-square:before{content:"\f194"}.fa-try:before,.fa-turkish-lira:before{content:"\f195"}.fa-plus-square-o:before{content:"\f196"}.fa-space-shuttle:before{content:"\f197"}.fa-slack:before{content:"\f198"}.fa-envelope-square:before{content:"\f199"}.fa-wordpress:before{content:"\f19a"}.fa-openid:before{content:"\f19b"}.fa-bank:before,.fa-institution:before,.fa-university:before{content:"\f19c"}.fa-graduation-cap:before,.fa-mortar-board:before{content:"\f19d"}.fa-yahoo:before{content:"\f19e"}.fa-google:before{content:"\f1a0"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-square:before{content:"\f1a2"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-stumbleupon:before{content:"\f1a4"}.fa-delicious:before{content:"\f1a5"}.fa-digg:before{content:"\f1a6"}.fa-pied-piper:before{content:"\f1a7"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-drupal:before{content:"\f1a9"}.fa-joomla:before{content:"\f1aa"}.fa-language:before{content:"\f1ab"}.fa-fax:before{content:"\f1ac"}.fa-building:before{content:"\f1ad"}.fa-child:before{content:"\f1ae"}.fa-paw:before{content:"\f1b0"}.fa-spoon:before{content:"\f1b1"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-recycle:before{content:"\f1b8"}.fa-automobile:before,.fa-car:before{content:"\f1b9"}.fa-cab:before,.fa-taxi:before{content:"\f1ba"}.fa-tree:before{content:"\f1bb"}.fa-spotify:before{content:"\f1bc"}.fa-deviantart:before{content:"\f1bd"}.fa-soundcloud:before{content:"\f1be"}.fa-database:before{content:"\f1c0"}.fa-file-pdf-o:before{content:"\f1c1"}.fa-file-word-o:before{content:"\f1c2"}.fa-file-excel-o:before{content:"\f1c3"}.fa-file-powerpoint-o:before{content:"\f1c4"}.fa-file-image-o:before,.fa-file-photo-o:before,.fa-file-picture-o:before{content:"\f1c5"}.fa-file-archive-o:before,.fa-file-zip-o:before{content:"\f1c6"}.fa-file-audio-o:before,.fa-file-sound-o:before{content:"\f1c7"}.fa-file-movie-o:before,.fa-file-video-o:before{content:"\f1c8"}.fa-file-code-o:before{content:"\f1c9"}.fa-vine:before{content:"\f1ca"}.fa-codepen:before{content:"\f1cb"}.fa-jsfiddle:before{content:"\f1cc"}.fa-life-bouy:before,.fa-life-buoy:before,.fa-life-ring:before,.fa-life-saver:before,.fa-support:before{content:"\f1cd"}.fa-circle-o-notch:before{content:"\f1ce"}.fa-ra:before,.fa-rebel:before{content:"\f1d0"}.fa-empire:before,.fa-ge:before{content:"\f1d1"}.fa-git-square:before{content:"\f1d2"}.fa-git:before{content:"\f1d3"}.fa-hacker-news:before{content:"\f1d4"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-qq:before{content:"\f1d6"}.fa-wechat:before,.fa-weixin:before{content:"\f1d7"}.fa-paper-plane:before,.fa-send:before{content:"\f1d8"}.fa-paper-plane-o:before,.fa-send-o:before{content:"\f1d9"}.fa-history:before{content:"\f1da"}.fa-circle-thin:before{content:"\f1db"}.fa-header:before{content:"\f1dc"}.fa-paragraph:before{content:"\f1dd"}.fa-sliders:before{content:"\f1de"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-bomb:before{content:"\f1e2"}.fa-futbol-o:before,.fa-soccer-ball-o:before{content:"\f1e3"}.fa-tty:before{content:"\f1e4"}.fa-binoculars:before{content:"\f1e5"}.fa-plug:before{content:"\f1e6"}.fa-slideshare:before{content:"\f1e7"}.fa-twitch:before{content:"\f1e8"}.fa-yelp:before{content:"\f1e9"}.fa-newspaper-o:before{content:"\f1ea"}.fa-wifi:before{content:"\f1eb"}.fa-calculator:before{content:"\f1ec"}.fa-paypal:before{content:"\f1ed"}.fa-google-wallet:before{content:"\f1ee"}.fa-cc-visa:before{content:"\f1f0"}.fa-cc-mastercard:before{content:"\f1f1"}.fa-cc-discover:before{content:"\f1f2"}.fa-cc-amex:before{content:"\f1f3"}.fa-cc-paypal:before{content:"\f1f4"}.fa-cc-stripe:before{content:"\f1f5"}.fa-bell-slash:before{content:"\f1f6"}.fa-bell-slash-o:before{content:"\f1f7"}.fa-trash:before{content:"\f1f8"}.fa-copyright:before{content:"\f1f9"}.fa-at:before{content:"\f1fa"}.fa-eyedropper:before{content:"\f1fb"}.fa-paint-brush:before{content:"\f1fc"}.fa-birthday-cake:before{content:"\f1fd"}.fa-area-chart:before{content:"\f1fe"}.fa-pie-chart:before{content:"\f200"}.fa-line-chart:before{content:"\f201"}.fa-lastfm:before{content:"\f202"}.fa-lastfm-square:before{content:"\f203"}.fa-toggle-off:before{content:"\f204"}.fa-toggle-on:before{content:"\f205"}.fa-bicycle:before{content:"\f206"}.fa-bus:before{content:"\f207"}.fa-ioxhost:before{content:"\f208"}.fa-angellist:before{content:"\f209"}.fa-cc:before{content:"\f20a"}.fa-ils:before,.fa-shekel:before,.fa-sheqel:before{content:"\f20b"}.fa-meanpath:before{content:"\f20c"}/*!
+*
+* IPython base
+*
+*/.modal.fade .modal-dialog{-webkit-transform:translate(0,0);-ms-transform:translate(0,0);-o-transform:translate(0,0);transform:translate(0,0)}code{color:#000}pre{font-size:inherit;line-height:inherit}label{font-weight:400}.border-box-sizing{box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}.corner-all{border-radius:2px}.no-padding{padding:0}.hbox{display:-webkit-box;-webkit-box-orient:horizontal;display:-moz-box;-moz-box-orient:horizontal;display:box;box-orient:horizontal;box-align:stretch;display:flex;flex-direction:row;align-items:stretch}.hbox>*{-webkit-box-flex:0;-moz-box-flex:0;box-flex:0;flex:none}.vbox{display:-webkit-box;-webkit-box-orient:vertical;display:-moz-box;-moz-box-orient:vertical;display:box;box-orient:vertical;box-align:stretch;display:flex;flex-direction:column;align-items:stretch}.vbox>*{-webkit-box-flex:0;-moz-box-flex:0;box-flex:0;flex:none}.hbox.reverse,.reverse,.vbox.reverse{-webkit-box-direction:reverse;-moz-box-direction:reverse;box-direction:reverse;flex-direction:row-reverse}.box-flex0,.hbox.box-flex0,.vbox.box-flex0{-webkit-box-flex:0;-moz-box-flex:0;box-flex:0;flex:none;width:auto}.box-flex1,.hbox.box-flex1,.vbox.box-flex1{-webkit-box-flex:1;-moz-box-flex:1;box-flex:1;flex:1}.box-flex,.hbox.box-flex,.vbox.box-flex{-webkit-box-flex:1;-moz-box-flex:1;box-flex:1;flex:1}.box-flex2,.hbox.box-flex2,.vbox.box-flex2{-webkit-box-flex:2;-moz-box-flex:2;box-flex:2;flex:2}.box-group1{-webkit-box-flex-group:1;-moz-box-flex-group:1;box-flex-group:1}.box-group2{-webkit-box-flex-group:2;-moz-box-flex-group:2;box-flex-group:2}.hbox.start,.start,.vbox.start{-webkit-box-pack:start;-moz-box-pack:start;box-pack:start;justify-content:flex-start}.end,.hbox.end,.vbox.end{-webkit-box-pack:end;-moz-box-pack:end;box-pack:end;justify-content:flex-end}.center,.hbox.center,.vbox.center{-webkit-box-pack:center;-moz-box-pack:center;box-pack:center;justify-content:center}.baseline,.hbox.baseline,.vbox.baseline{-webkit-box-pack:baseline;-moz-box-pack:baseline;box-pack:baseline;justify-content:baseline}.hbox.stretch,.stretch,.vbox.stretch{-webkit-box-pack:stretch;-moz-box-pack:stretch;box-pack:stretch;justify-content:stretch}.align-start,.hbox.align-start,.vbox.align-start{-webkit-box-align:start;-moz-box-align:start;box-align:start;align-items:flex-start}.align-end,.hbox.align-end,.vbox.align-end{-webkit-box-align:end;-moz-box-align:end;box-align:end;align-items:flex-end}.align-center,.hbox.align-center,.vbox.align-center{-webkit-box-align:center;-moz-box-align:center;box-align:center;align-items:center}.align-baseline,.hbox.align-baseline,.vbox.align-baseline{-webkit-box-align:baseline;-moz-box-align:baseline;box-align:baseline;align-items:baseline}.align-stretch,.hbox.align-stretch,.vbox.align-stretch{-webkit-box-align:stretch;-moz-box-align:stretch;box-align:stretch;align-items:stretch}div.error{margin:2em;text-align:center}div.error>h1{font-size:500%;line-height:normal}div.error>p{font-size:200%;line-height:normal}div.traceback-wrapper{text-align:left;max-width:800px;margin:auto}body{position:absolute;left:0;right:0;top:0;bottom:0;overflow:visible}#header{display:none;background-color:#fff;position:relative;z-index:100}#header #header-container{padding-bottom:5px;padding-top:5px;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}#header .header-bar{width:100%;height:1px;background:#e7e7e7;margin-bottom:-1px}#header-spacer{width:100%;visibility:hidden}@media print{#header{display:none!important}#header-spacer{display:none}}#ipython_notebook{padding-left:0;padding-top:1px;padding-bottom:1px}@media (max-width:991px){#ipython_notebook{margin-left:10px}}#noscript{width:auto;padding-top:16px;padding-bottom:16px;text-align:center;font-size:22px;color:red;font-weight:700}#ipython_notebook img{height:28px}#site{width:100%;display:none;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;overflow:auto}@media print{#site{height:auto!important}}.ui-button .ui-button-text{padding:.2em .8em;font-size:77%}input.ui-button{padding:.3em .9em}span#login_widget{float:right}#logout,span#login_widget>.button{color:#333;background-color:#fff;border-color:#ccc}#logout.active,#logout.focus,#logout:active,#logout:focus,#logout:hover,.open>.dropdown-toggle#logout,.open>.dropdown-togglespan#login_widget>.button,span#login_widget>.button.active,span#login_widget>.button.focus,span#login_widget>.button:active,span#login_widget>.button:focus,span#login_widget>.button:hover{color:#333;background-color:#e6e6e6;border-color:#adadad}#logout.active,#logout:active,.open>.dropdown-toggle#logout,.open>.dropdown-togglespan#login_widget>.button,span#login_widget>.button.active,span#login_widget>.button:active{background-image:none}#logout.disabled,#logout.disabled.active,#logout.disabled.focus,#logout.disabled:active,#logout.disabled:focus,#logout.disabled:hover,#logout[disabled],#logout[disabled].active,#logout[disabled].focus,#logout[disabled]:active,#logout[disabled]:focus,#logout[disabled]:hover,fieldset[disabled] #logout,fieldset[disabled] #logout.active,fieldset[disabled] #logout.focus,fieldset[disabled] #logout:active,fieldset[disabled] #logout:focus,fieldset[disabled] #logout:hover,fieldset[disabled] span#login_widget>.button,fieldset[disabled] span#login_widget>.button.active,fieldset[disabled] span#login_widget>.button.focus,fieldset[disabled] span#login_widget>.button:active,fieldset[disabled] span#login_widget>.button:focus,fieldset[disabled] span#login_widget>.button:hover,span#login_widget>.button.disabled,span#login_widget>.button.disabled.active,span#login_widget>.button.disabled.focus,span#login_widget>.button.disabled:active,span#login_widget>.button.disabled:focus,span#login_widget>.button.disabled:hover,span#login_widget>.button[disabled],span#login_widget>.button[disabled].active,span#login_widget>.button[disabled].focus,span#login_widget>.button[disabled]:active,span#login_widget>.button[disabled]:focus,span#login_widget>.button[disabled]:hover{background-color:#fff;border-color:#ccc}#logout .badge,span#login_widget>.button .badge{color:#fff;background-color:#333}.nav-header{text-transform:none}#header>span{margin-top:10px}.modal_stretch .modal-dialog{display:-webkit-box;-webkit-box-orient:vertical;display:-moz-box;-moz-box-orient:vertical;display:box;box-orient:vertical;box-align:stretch;display:flex;flex-direction:column;align-items:stretch;min-height:80vh}.modal_stretch .modal-dialog .modal-body{max-height:calc(100vh - 200px);overflow:auto;flex:1}@media (min-width:768px){.modal .modal-dialog{width:700px}select.form-control{margin-left:12px;margin-right:12px}}/*!
+*
+* IPython auth
+*
+*/.center-nav{display:inline-block;margin-bottom:-4px}/*!
+*
+* IPython tree view
+*
+*/.alternate_upload{background-color:none;display:inline}.alternate_upload.form{padding:0;margin:0}.alternate_upload input.fileinput{text-align:center;vertical-align:middle;display:inline;opacity:0;z-index:2;width:12ex;margin-right:-12ex}.alternate_upload .btn-upload{height:22px}ul#tabs{margin-bottom:4px}ul#tabs a{padding-top:6px;padding-bottom:4px}ul.breadcrumb a:focus,ul.breadcrumb a:hover{text-decoration:none}ul.breadcrumb i.icon-home{font-size:16px;margin-right:4px}ul.breadcrumb span{color:#5e5e5e}.list_toolbar{padding:4px 0;vertical-align:middle}.list_toolbar .tree-buttons{padding-top:1px}.dynamic-buttons{padding-top:3px;display:inline-block}.list_toolbar [class*=span]{min-height:24px}.list_header{font-weight:700;background-color:#eee}.list_placeholder{font-weight:700;padding:4px 7px}.list_container{margin-top:4px;margin-bottom:20px;border:1px solid #ddd;border-radius:2px}.list_container>div{border-bottom:1px solid #ddd}.list_container>div:hover .list-item{background-color:red}.list_container>div:last-child{border:none}.list_item:hover .list_item{background-color:#ddd}.list_item a{text-decoration:none}.list_item:hover{background-color:#fafafa}.action_col{text-align:right}.list_header>div,.list_item>div{line-height:22px;padding:4px 7px}.list_header>div input,.list_item>div input{margin-right:7px;margin-left:14px;vertical-align:baseline;line-height:22px;position:relative;top:-1px}.list_header>div .item_link,.list_item>div .item_link{margin-left:-1px;vertical-align:baseline;line-height:22px}.new-file input[type=checkbox]{visibility:hidden}.item_name{line-height:22px;height:24px}.item_icon{font-size:14px;color:#5e5e5e;margin-right:7px;margin-left:7px;line-height:22px;vertical-align:baseline}.item_buttons{line-height:1em;margin-left:-5px}.item_buttons .btn-group,.item_buttons .input-group{float:left}.item_buttons>.btn,.item_buttons>.btn-group,.item_buttons>.input-group{margin-left:5px}.item_buttons .btn{min-width:13ex}.item_buttons .running-indicator{padding-top:4px;color:#5cb85c}.toolbar_info{height:24px;line-height:24px}input.engine_num_input,input.nbname_input{padding-top:3px;padding-bottom:3px;height:22px;line-height:14px;margin:0}input.engine_num_input{width:60px}.highlight_text{color:#00f}#project_name{display:inline-block;padding-left:7px;margin-left:-2px}#project_name>.breadcrumb{padding:0;margin-bottom:0;background-color:transparent;font-weight:700}#tree-selector{padding-right:0}#button-select-all{min-width:50px}#select-all{margin-left:7px;margin-right:2px}.menu_icon{margin-right:2px}.tab-content .row{margin-left:0;margin-right:0}.folder_icon:before{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\f114"}.folder_icon:before.pull-left{margin-right:.3em}.folder_icon:before.pull-right{margin-left:.3em}.notebook_icon:before{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\f02d";position:relative;top:-1px}.notebook_icon:before.pull-left{margin-right:.3em}.notebook_icon:before.pull-right{margin-left:.3em}.running_notebook_icon:before{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\f02d";position:relative;top:-1px;color:#5cb85c}.running_notebook_icon:before.pull-left{margin-right:.3em}.running_notebook_icon:before.pull-right{margin-left:.3em}.file_icon:before{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\f016";position:relative;top:-2px}.file_icon:before.pull-left{margin-right:.3em}.file_icon:before.pull-right{margin-left:.3em}#notebook_toolbar .pull-right{padding-top:0;margin-right:-1px}ul#new-menu{left:auto;right:0}.kernel-menu-icon{padding-right:12px;width:24px;content:"\f096"}.kernel-menu-icon:before{content:"\f096"}.kernel-menu-icon-current:before{content:"\f00c"}#tab_content{padding-top:20px}#running .panel-group .panel{margin-top:3px;margin-bottom:1em}#running .panel-group .panel .panel-heading{background-color:#eee;line-height:22px;padding:4px 7px}#running .panel-group .panel .panel-heading a:focus,#running .panel-group .panel .panel-heading a:hover{text-decoration:none}#running .panel-group .panel .panel-body{padding:0}#running .panel-group .panel .panel-body .list_container{margin-top:0;margin-bottom:0;border:0;border-radius:0}#running .panel-group .panel .panel-body .list_container .list_item{border-bottom:1px solid #ddd}#running .panel-group .panel .panel-body .list_container .list_item:last-child{border-bottom:0}.delete-button,.duplicate-button,.rename-button,.shutdown-button{display:none}.dynamic-instructions{display:inline-block;padding-top:4px}/*!
+*
+* IPython text editor webapp
+*
+*/.selected-keymap i.fa{padding:0 5px}.selected-keymap i.fa:before{content:"\f00c"}#mode-menu{overflow:auto;max-height:20em}.edit_app #header{-webkit-box-shadow:0 0 12px 1px rgba(87,87,87,.2);box-shadow:0 0 12px 1px rgba(87,87,87,.2)}.edit_app #menubar .navbar{margin-bottom:-1px}.dirty-indicator{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;width:20px}.dirty-indicator.pull-left{margin-right:.3em}.dirty-indicator.pull-right{margin-left:.3em}.dirty-indicator-dirty{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;width:20px}.dirty-indicator-dirty.pull-left{margin-right:.3em}.dirty-indicator-dirty.pull-right{margin-left:.3em}.dirty-indicator-clean{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;width:20px}.dirty-indicator-clean.pull-left{margin-right:.3em}.dirty-indicator-clean.pull-right{margin-left:.3em}.dirty-indicator-clean:before{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\f00c"}.dirty-indicator-clean:before.pull-left{margin-right:.3em}.dirty-indicator-clean:before.pull-right{margin-left:.3em}#filename{font-size:16pt;display:table;padding:0 5px}#current-mode{padding-left:5px;padding-right:5px}#texteditor-backdrop{padding-top:20px;padding-bottom:20px}@media not print{#texteditor-backdrop{background-color:#eee}}@media print{#texteditor-backdrop #texteditor-container .CodeMirror-gutter,#texteditor-backdrop #texteditor-container .CodeMirror-gutters{background-color:#fff}}@media not print{#texteditor-backdrop #texteditor-container .CodeMirror-gutter,#texteditor-backdrop #texteditor-container .CodeMirror-gutters{background-color:#fff}#texteditor-backdrop #texteditor-container{padding:0;background-color:#fff;-webkit-box-shadow:0 0 12px 1px rgba(87,87,87,.2);box-shadow:0 0 12px 1px rgba(87,87,87,.2)}}/*!
+*
+* IPython notebook
+*
+*/.ansibold{font-weight:700}.ansiblack{color:#000}.ansired{color:#8b0000}.ansigreen{color:#006400}.ansiyellow{color:#c4a000}.ansiblue{color:#00008b}.ansipurple{color:#9400d3}.ansicyan{color:#4682b4}.ansigray{color:gray}.ansibgblack{background-color:#000}.ansibgred{background-color:red}.ansibggreen{background-color:green}.ansibgyellow{background-color:#ff0}.ansibgblue{background-color:#00f}.ansibgpurple{background-color:#ff00ff}.ansibgcyan{background-color:#0ff}.ansibggray{background-color:gray}div.cell{border:1px solid transparent;display:-webkit-box;-webkit-box-orient:vertical;display:-moz-box;-moz-box-orient:vertical;display:box;box-orient:vertical;box-align:stretch;display:flex;flex-direction:column;align-items:stretch;border-radius:2px;box-sizing:border-box;-moz-box-sizing:border-box;border-width:thin;border-style:solid;width:100%;padding:5px;margin:0;outline:0}div.cell.selected{border-color:#ababab}@media print{div.cell.selected{border-color:transparent}}.edit_mode div.cell.selected{border-color:green}.prompt{min-width:14ex;padding:.4em;margin:0;font-family:monospace;text-align:right;line-height:1.21429em}div.inner_cell{display:-webkit-box;-webkit-box-orient:vertical;display:-moz-box;-moz-box-orient:vertical;display:box;box-orient:vertical;box-align:stretch;display:flex;flex-direction:column;align-items:stretch;-webkit-box-flex:1;-moz-box-flex:1;box-flex:1;flex:1}@-moz-document url-prefix(){div.inner_cell{overflow-x:hidden}}div.input_area{border:1px solid #cfcfcf;border-radius:2px;background:#f7f7f7;line-height:1.21429em}div.prompt:empty{padding-top:0;padding-bottom:0}div.unrecognized_cell{padding:5px 5px 5px 0;display:-webkit-box;-webkit-box-orient:horizontal;display:-moz-box;-moz-box-orient:horizontal;display:box;box-orient:horizontal;box-align:stretch;display:flex;flex-direction:row;align-items:stretch}div.unrecognized_cell .inner_cell{border-radius:2px;padding:5px;font-weight:700;color:red;border:1px solid #cfcfcf;background:#eaeaea}div.unrecognized_cell .inner_cell a,div.unrecognized_cell .inner_cell a:hover{color:inherit;text-decoration:none}@media (max-width:540px){.prompt{text-align:left}div.unrecognized_cell>div.prompt{display:none}}div.code_cell{}div.input{page-break-inside:avoid;display:-webkit-box;-webkit-box-orient:horizontal;display:-moz-box;-moz-box-orient:horizontal;display:box;box-orient:horizontal;box-align:stretch;display:flex;flex-direction:row;align-items:stretch}@media (max-width:540px){div.input{-webkit-box-orient:vertical;-moz-box-orient:vertical;box-orient:vertical;box-align:stretch;display:flex;flex-direction:column;align-items:stretch}}div.input_prompt{color:navy;border-top:1px solid transparent}div.input_area>div.highlight{margin:.4em;border:none;padding:0;background-color:transparent}div.input_area>div.highlight>pre{margin:0;border:none;padding:0;background-color:transparent}.CodeMirror{line-height:1.21429em;font-size:14px;height:auto;background:0 0}.CodeMirror-scroll{overflow-y:hidden;overflow-x:auto}.CodeMirror-lines{padding:.4em}.CodeMirror-linenumber{padding:0 8px 0 4px}.CodeMirror-gutters{border-bottom-left-radius:2px;border-top-left-radius:2px}.CodeMirror pre{padding:0;border:0;border-radius:0}.highlight-base,.highlight-variable{color:#000}.highlight-variable-2{color:#1a1a1a}.highlight-variable-3{color:#333}.highlight-string{color:#BA2121}.highlight-comment{color:#408080;font-style:italic}.highlight-number{color:#080}.highlight-atom{color:#88F}.highlight-keyword{color:green;font-weight:700}.highlight-builtin{color:green}.highlight-error{color:red}.highlight-operator{color:#A2F;font-weight:700}.highlight-meta{color:#A2F}.highlight-def{color:#00f}.highlight-string-2{color:#f50}.highlight-qualifier{color:#555}.highlight-bracket{color:#997}.highlight-tag{color:#170}.highlight-attribute{color:#00c}.highlight-header{color:#00f}.highlight-quote{color:#090}.highlight-link{color:#00c}.cm-s-ipython span.cm-keyword{color:green;font-weight:700}.cm-s-ipython span.cm-atom{color:#88F}.cm-s-ipython span.cm-number{color:#080}.cm-s-ipython span.cm-def{color:#00f}.cm-s-ipython span.cm-variable{color:#000}.cm-s-ipython span.cm-operator{color:#A2F;font-weight:700}.cm-s-ipython span.cm-variable-2{color:#1a1a1a}.cm-s-ipython span.cm-variable-3{color:#333}.cm-s-ipython span.cm-comment{color:#408080;font-style:italic}.cm-s-ipython span.cm-string{color:#BA2121}.cm-s-ipython span.cm-string-2{color:#f50}.cm-s-ipython span.cm-meta{color:#A2F}.cm-s-ipython span.cm-qualifier{color:#555}.cm-s-ipython span.cm-builtin{color:green}.cm-s-ipython span.cm-bracket{color:#997}.cm-s-ipython span.cm-tag{color:#170}.cm-s-ipython span.cm-attribute{color:#00c}.cm-s-ipython span.cm-header{color:#00f}.cm-s-ipython span.cm-quote{color:#090}.cm-s-ipython span.cm-link{color:#00c}.cm-s-ipython span.cm-error{color:red}.cm-s-ipython span.cm-tab{background:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAMCAYAAAAkuj5RAAAAAXNSR0IArs4c6QAAAGFJREFUSMft1LsRQFAQheHPowAKoACx3IgEKtaEHujDjORSgWTH/ZOdnZOcM/sgk/kFFWY0qV8foQwS4MKBCS3qR6ixBJvElOobYAtivseIE120FaowJPN75GMu8j/LfMwNjh4HUpwg4LUAAAAASUVORK5CYII=')right no-repeat}div.output_wrapper{display:-webkit-box;-webkit-box-align:stretch;display:-moz-box;-moz-box-align:stretch;display:box;box-orient:vertical;box-align:stretch;display:flex;flex-direction:column;align-items:stretch;z-index:1}div.output_scroll{height:24em;width:100%;overflow:auto;border-radius:2px;-webkit-box-shadow:inset 0 2px 8px rgba(0,0,0,.8);box-shadow:inset 0 2px 8px rgba(0,0,0,.8);display:block}div.output_collapsed{margin:0;padding:0;display:-webkit-box;-webkit-box-orient:vertical;display:-moz-box;-moz-box-orient:vertical;display:box;box-orient:vertical;box-align:stretch;display:flex;flex-direction:column;align-items:stretch}div.out_prompt_overlay{height:100%;padding:0 .4em;position:absolute;border-radius:2px}div.out_prompt_overlay:hover{-webkit-box-shadow:inset 0 0 1px #000;box-shadow:inset 0 0 1px #000;background:rgba(240,240,240,.5)}div.output_prompt{color:#8b0000}div.output_area{padding:0;page-break-inside:avoid;display:-webkit-box;-webkit-box-orient:horizontal;display:-moz-box;-moz-box-orient:horizontal;display:box;box-orient:horizontal;box-align:stretch;display:flex;flex-direction:row;align-items:stretch}div.output_area .MathJax_Display{text-align:left!important}div.output_area .rendered_html img,div.output_area .rendered_html table{margin-left:0;margin-right:0}div.output_area img,div.output_area svg{max-width:100%;height:auto}div.output_area img.unconfined,div.output_area svg.unconfined{max-width:none}.output{display:-webkit-box;-webkit-box-orient:vertical;display:-moz-box;-moz-box-orient:vertical;display:box;box-orient:vertical;box-align:stretch;display:flex;flex-direction:column;align-items:stretch}@media (max-width:540px){div.output_area{-webkit-box-orient:vertical;-moz-box-orient:vertical;box-orient:vertical;box-align:stretch;display:flex;flex-direction:column;align-items:stretch}}div.output_area pre{margin:0;padding:0;border:0;vertical-align:baseline;color:#000;background-color:transparent;border-radius:0}div.output_subarea{overflow-x:auto;padding:.4em;-webkit-box-flex:1;-moz-box-flex:1;box-flex:1;flex:1;max-width:calc(100% - 14ex)}div.output_text{text-align:left;color:#000;line-height:1.21429em}div.output_stderr{background:#fdd}div.output_latex{text-align:left}div.output_javascript:empty{padding:0}.js-error{color:#8b0000}div.raw_input_container{font-family:monospace;padding-top:5px}span.raw_input_prompt{}input.raw_input{font-family:inherit;font-size:inherit;color:inherit;width:auto;vertical-align:baseline;padding:0 .25em;margin:0 .25em}input.raw_input:focus{box-shadow:none}p.p-space{margin-bottom:10px}div.output_unrecognized{padding:5px;font-weight:700;color:red}div.output_unrecognized a,div.output_unrecognized a:hover{color:inherit;text-decoration:none}.rendered_html{color:#000}.rendered_html em{font-style:italic}.rendered_html strong{font-weight:700}.rendered_html :link,.rendered_html :visited,.rendered_html u{text-decoration:underline}.rendered_html h1{font-size:185.7%;margin:1.08em 0 0;font-weight:700;line-height:1}.rendered_html h2{font-size:157.1%;margin:1.27em 0 0;font-weight:700;line-height:1}.rendered_html h3{font-size:128.6%;margin:1.55em 0 0;font-weight:700;line-height:1}.rendered_html h4{font-size:100%;margin:2em 0 0;font-weight:700;line-height:1}.rendered_html h5,.rendered_html h6{font-size:100%;margin:2em 0 0;font-weight:700;line-height:1;font-style:italic}.rendered_html h1:first-child{margin-top:.538em}.rendered_html h2:first-child{margin-top:.636em}.rendered_html h3:first-child{margin-top:.777em}.rendered_html h4:first-child,.rendered_html h5:first-child,.rendered_html h6:first-child{margin-top:1em}.rendered_html ul{list-style:disc;margin:0 2em;padding-left:0}.rendered_html ul ul{list-style:square;margin:0 2em}.rendered_html ul ul ul{list-style:circle;margin:0 2em}.rendered_html ol{list-style:decimal;margin:0 2em;padding-left:0}.rendered_html ol ol{list-style:upper-alpha;margin:0 2em}.rendered_html ol ol ol{list-style:lower-alpha;margin:0 2em}.rendered_html ol ol ol ol{list-style:lower-roman;margin:0 2em}.rendered_html ol ol ol ol ol{list-style:decimal;margin:0 2em}.rendered_html *+ol,.rendered_html *+ul{margin-top:1em}.rendered_html hr{color:#000;background-color:#000}.rendered_html pre{margin:1em 2em}.rendered_html code,.rendered_html pre{border:0;background-color:#fff;color:#000;font-size:100%;padding:0}.rendered_html blockquote{margin:1em 2em}.rendered_html table{margin-left:auto;margin-right:auto;border:1px solid #000;border-collapse:collapse}.rendered_html td,.rendered_html th,.rendered_html tr{border:1px solid #000;border-collapse:collapse;margin:1em 2em}.rendered_html td,.rendered_html th{text-align:left;vertical-align:middle;padding:4px}.rendered_html th{font-weight:700}.rendered_html *+table{margin-top:1em}.rendered_html p{text-align:left}.rendered_html *+p{margin-top:1em}.rendered_html img{display:block;margin-left:auto;margin-right:auto}.rendered_html *+img{margin-top:1em}.rendered_html img,.rendered_html svg{max-width:100%;height:auto}.rendered_html img.unconfined,.rendered_html svg.unconfined{max-width:none}div.text_cell{display:-webkit-box;-webkit-box-orient:horizontal;display:-moz-box;-moz-box-orient:horizontal;display:box;box-orient:horizontal;box-align:stretch;display:flex;flex-direction:row;align-items:stretch}@media (max-width:540px){div.text_cell>div.prompt{display:none}}div.text_cell_render{outline:0;resize:none;width:inherit;border-style:none;padding:.5em .5em .5em .4em;color:#000;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}a.anchor-link:link{text-decoration:none;padding:0 20px;visibility:hidden}h1:hover .anchor-link,h2:hover .anchor-link,h3:hover .anchor-link,h4:hover .anchor-link,h5:hover .anchor-link,h6:hover .anchor-link{visibility:visible}.text_cell.rendered .input_area{display:none}.text_cell.rendered .rendered_html{overflow-x:auto}.text_cell.unrendered .text_cell_render{display:none}.cm-header-1,.cm-header-2,.cm-header-3,.cm-header-4,.cm-header-5,.cm-header-6{font-weight:700;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif}.cm-header-1{font-size:185.7%}.cm-header-2{font-size:157.1%}.cm-header-3{font-size:128.6%}.cm-header-4{font-size:110%}.cm-header-5,.cm-header-6{font-size:100%;font-style:italic}/*!
+*
+* IPython notebook webapp
+*
+*/@media (max-width:767px){.notebook_app{padding-left:0;padding-right:0}}#ipython-main-app{box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;height:100%}div#notebook_panel{margin:0;padding:0;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;height:100%}#notebook{font-size:14px;line-height:20px;overflow-y:hidden;overflow-x:auto;width:100%;padding-top:20px;margin:0;outline:0;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;min-height:100%}@media not print{#notebook-container{padding:15px;background-color:#fff;min-height:0;-webkit-box-shadow:0 0 12px 1px rgba(87,87,87,.2);box-shadow:0 0 12px 1px rgba(87,87,87,.2)}}div.ui-widget-content{border:1px solid #ababab;outline:0}pre.dialog{background-color:#f7f7f7;border:1px solid #ddd;border-radius:2px;padding:.4em .4em .4em 2em}p.dialog{padding:.2em}code,kbd,pre,samp{white-space:pre-wrap}#fonttest{font-family:monospace}p{margin-bottom:0}.end_space{min-height:100px;transition:height .2s ease}.notebook_app #header{-webkit-box-shadow:0 0 12px 1px rgba(87,87,87,.2);box-shadow:0 0 12px 1px rgba(87,87,87,.2)}@media not print{.notebook_app{background-color:#eee}}.celltoolbar{border:thin solid #CFCFCF;border-bottom:none;background:#EEE;border-radius:2px 2px 0 0;width:100%;height:29px;padding-right:4px;-webkit-box-orient:horizontal;-moz-box-orient:horizontal;box-orient:horizontal;box-align:stretch;display:flex;flex-direction:row;align-items:stretch;-webkit-box-pack:end;-moz-box-pack:end;box-pack:end;justify-content:flex-end;font-size:87%;padding-top:3px}@media print{.edit_mode div.cell.selected{border-color:transparent}div.code_cell{page-break-inside:avoid}#notebook-container{width:100%}.celltoolbar{display:none}}.ctb_hideshow{display:none;vertical-align:bottom}.ctb_global_show .ctb_show.ctb_hideshow{display:block}.ctb_global_show .ctb_show+.input_area,.ctb_global_show .ctb_show+div.text_cell_input,.ctb_global_show .ctb_show~div.text_cell_render{border-top-right-radius:0;border-top-left-radius:0}.ctb_global_show .ctb_show~div.text_cell_render{border:1px solid #cfcfcf}.celltoolbar select{color:#555;background-color:#fff;background-image:none;border:1px solid #ccc;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);-webkit-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;-o-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;line-height:1.5;border-radius:1px;width:inherit;font-size:inherit;height:22px;padding:0;display:inline-block}.celltoolbar select:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.celltoolbar select::-moz-placeholder{color:#999;opacity:1}.celltoolbar select:-ms-input-placeholder{color:#999}.celltoolbar select::-webkit-input-placeholder{color:#999}.celltoolbar select[disabled],.celltoolbar select[readonly],fieldset[disabled] .celltoolbar select{background-color:#eee;opacity:1}.celltoolbar select[disabled],fieldset[disabled] .celltoolbar select{cursor:not-allowed}textarea.celltoolbar select{height:auto}select.celltoolbar select{height:30px;line-height:30px}select[multiple].celltoolbar select,textarea.celltoolbar select{height:auto}.celltoolbar label{margin-left:5px;margin-right:5px}.completions{position:absolute;z-index:10;overflow:hidden;border:1px solid #ababab;border-radius:2px;-webkit-box-shadow:0 6px 10px -1px #adadad;box-shadow:0 6px 10px -1px #adadad;line-height:1}.completions select{background:#fff;outline:0;border:none;padding:0;margin:0;overflow:auto;font-family:monospace;font-size:110%;color:#000;width:auto}.completions select option.context{color:#286090}#kernel_logo_widget{float:right!important;float:right}#kernel_logo_widget .current_kernel_logo{display:none;margin-top:-1px;margin-bottom:-1px;width:32px;height:32px}#menubar{box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;margin-top:1px}#menubar .navbar{border-top:1px;border-radius:0 0 2px 2px;margin-bottom:0}#menubar .navbar-toggle{float:left;padding-top:7px;padding-bottom:7px;border:none}#menubar .navbar-collapse{clear:left}.nav-wrapper{border-bottom:1px solid #e7e7e7}i.menu-icon{padding-top:4px}ul#help_menu li a{overflow:hidden;padding-right:2.2em}ul#help_menu li a i{margin-right:-1.2em}.dropdown-submenu{position:relative}.dropdown-submenu>.dropdown-menu{top:0;left:100%;margin-top:-6px;margin-left:-1px}.dropdown-submenu:hover>.dropdown-menu{display:block}.dropdown-submenu>a:after{font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;display:block;content:"\f0da";float:right;color:#333;margin-top:2px;margin-right:-10px}.dropdown-submenu>a:after.pull-left{margin-right:.3em}.dropdown-submenu>a:after.pull-right{margin-left:.3em}.dropdown-submenu:hover>a:after{color:#262626}.dropdown-submenu.pull-left{float:none}.dropdown-submenu.pull-left>.dropdown-menu{left:-100%;margin-left:10px}#notification_area{float:right!important;float:right;z-index:10}.indicator_area{float:right!important;float:right;color:#777;margin-left:5px;margin-right:5px;z-index:10;text-align:center;width:auto}#kernel_indicator{float:right!important;float:right;color:#777;margin-left:5px;margin-right:5px;z-index:10;text-align:center;width:auto;border-left:1px solid}#kernel_indicator .kernel_indicator_name{padding-left:5px;padding-right:5px}#modal_indicator{float:right!important;float:right;color:#777;margin-left:5px;margin-right:5px;z-index:10;text-align:center;width:auto}#readonly-indicator{float:right!important;float:right;color:#777;z-index:10;text-align:center;width:auto;display:none;margin:2px 0 0}.modal_indicator:before{width:1.28571429em;text-align:center}.edit_mode .modal_indicator:before{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\f040"}.edit_mode .modal_indicator:before.pull-left{margin-right:.3em}.edit_mode .modal_indicator:before.pull-right{margin-left:.3em}.command_mode .modal_indicator:before{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:' '}.command_mode .modal_indicator:before.pull-left{margin-right:.3em}.command_mode .modal_indicator:before.pull-right{margin-left:.3em}.kernel_idle_icon:before{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\f10c"}.kernel_idle_icon:before.pull-left{margin-right:.3em}.kernel_idle_icon:before.pull-right{margin-left:.3em}.kernel_busy_icon:before{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\f111"}.kernel_busy_icon:before.pull-left{margin-right:.3em}.kernel_busy_icon:before.pull-right{margin-left:.3em}.kernel_dead_icon:before{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\f1e2"}.kernel_dead_icon:before.pull-left{margin-right:.3em}.kernel_dead_icon:before.pull-right{margin-left:.3em}.kernel_disconnected_icon:before{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\f127"}.kernel_disconnected_icon:before.pull-left{margin-right:.3em}.kernel_disconnected_icon:before.pull-right{margin-left:.3em}.notification_widget{z-index:10;background:rgba(240,240,240,.5);margin-right:4px;color:#333;background-color:#fff;border-color:#ccc}.notification_widget.active,.notification_widget.focus,.notification_widget:active,.notification_widget:focus,.notification_widget:hover,.open>.dropdown-toggle.notification_widget{color:#333;background-color:#e6e6e6;border-color:#adadad}.notification_widget.active,.notification_widget:active,.open>.dropdown-toggle.notification_widget{background-image:none}.notification_widget.disabled,.notification_widget.disabled.active,.notification_widget.disabled.focus,.notification_widget.disabled:active,.notification_widget.disabled:focus,.notification_widget.disabled:hover,.notification_widget[disabled],.notification_widget[disabled].active,.notification_widget[disabled].focus,.notification_widget[disabled]:active,.notification_widget[disabled]:focus,.notification_widget[disabled]:hover,fieldset[disabled] .notification_widget,fieldset[disabled] .notification_widget.active,fieldset[disabled] .notification_widget.focus,fieldset[disabled] .notification_widget:active,fieldset[disabled] .notification_widget:focus,fieldset[disabled] .notification_widget:hover{background-color:#fff;border-color:#ccc}.notification_widget .badge{color:#fff;background-color:#333}.notification_widget.warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.notification_widget.warning.active,.notification_widget.warning.focus,.notification_widget.warning:active,.notification_widget.warning:focus,.notification_widget.warning:hover,.open>.dropdown-toggle.notification_widget.warning{color:#fff;background-color:#ec971f;border-color:#d58512}.notification_widget.warning.active,.notification_widget.warning:active,.open>.dropdown-toggle.notification_widget.warning{background-image:none}.notification_widget.warning.disabled,.notification_widget.warning.disabled.active,.notification_widget.warning.disabled.focus,.notification_widget.warning.disabled:active,.notification_widget.warning.disabled:focus,.notification_widget.warning.disabled:hover,.notification_widget.warning[disabled],.notification_widget.warning[disabled].active,.notification_widget.warning[disabled].focus,.notification_widget.warning[disabled]:active,.notification_widget.warning[disabled]:focus,.notification_widget.warning[disabled]:hover,fieldset[disabled] .notification_widget.warning,fieldset[disabled] .notification_widget.warning.active,fieldset[disabled] .notification_widget.warning.focus,fieldset[disabled] .notification_widget.warning:active,fieldset[disabled] .notification_widget.warning:focus,fieldset[disabled] .notification_widget.warning:hover{background-color:#f0ad4e;border-color:#eea236}.notification_widget.warning .badge{color:#f0ad4e;background-color:#fff}.notification_widget.success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.notification_widget.success.active,.notification_widget.success.focus,.notification_widget.success:active,.notification_widget.success:focus,.notification_widget.success:hover,.open>.dropdown-toggle.notification_widget.success{color:#fff;background-color:#449d44;border-color:#398439}.notification_widget.success.active,.notification_widget.success:active,.open>.dropdown-toggle.notification_widget.success{background-image:none}.notification_widget.success.disabled,.notification_widget.success.disabled.active,.notification_widget.success.disabled.focus,.notification_widget.success.disabled:active,.notification_widget.success.disabled:focus,.notification_widget.success.disabled:hover,.notification_widget.success[disabled],.notification_widget.success[disabled].active,.notification_widget.success[disabled].focus,.notification_widget.success[disabled]:active,.notification_widget.success[disabled]:focus,.notification_widget.success[disabled]:hover,fieldset[disabled] .notification_widget.success,fieldset[disabled] .notification_widget.success.active,fieldset[disabled] .notification_widget.success.focus,fieldset[disabled] .notification_widget.success:active,fieldset[disabled] .notification_widget.success:focus,fieldset[disabled] .notification_widget.success:hover{background-color:#5cb85c;border-color:#4cae4c}.notification_widget.success .badge{color:#5cb85c;background-color:#fff}.notification_widget.info{color:#fff;background-color:#5bc0de;border-color:#46b8da}.notification_widget.info.active,.notification_widget.info.focus,.notification_widget.info:active,.notification_widget.info:focus,.notification_widget.info:hover,.open>.dropdown-toggle.notification_widget.info{color:#fff;background-color:#31b0d5;border-color:#269abc}.notification_widget.info.active,.notification_widget.info:active,.open>.dropdown-toggle.notification_widget.info{background-image:none}.notification_widget.info.disabled,.notification_widget.info.disabled.active,.notification_widget.info.disabled.focus,.notification_widget.info.disabled:active,.notification_widget.info.disabled:focus,.notification_widget.info.disabled:hover,.notification_widget.info[disabled],.notification_widget.info[disabled].active,.notification_widget.info[disabled].focus,.notification_widget.info[disabled]:active,.notification_widget.info[disabled]:focus,.notification_widget.info[disabled]:hover,fieldset[disabled] .notification_widget.info,fieldset[disabled] .notification_widget.info.active,fieldset[disabled] .notification_widget.info.focus,fieldset[disabled] .notification_widget.info:active,fieldset[disabled] .notification_widget.info:focus,fieldset[disabled] .notification_widget.info:hover{background-color:#5bc0de;border-color:#46b8da}.notification_widget.info .badge{color:#5bc0de;background-color:#fff}.notification_widget.danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.notification_widget.danger.active,.notification_widget.danger.focus,.notification_widget.danger:active,.notification_widget.danger:focus,.notification_widget.danger:hover,.open>.dropdown-toggle.notification_widget.danger{color:#fff;background-color:#c9302c;border-color:#ac2925}.notification_widget.danger.active,.notification_widget.danger:active,.open>.dropdown-toggle.notification_widget.danger{background-image:none}.notification_widget.danger.disabled,.notification_widget.danger.disabled.active,.notification_widget.danger.disabled.focus,.notification_widget.danger.disabled:active,.notification_widget.danger.disabled:focus,.notification_widget.danger.disabled:hover,.notification_widget.danger[disabled],.notification_widget.danger[disabled].active,.notification_widget.danger[disabled].focus,.notification_widget.danger[disabled]:active,.notification_widget.danger[disabled]:focus,.notification_widget.danger[disabled]:hover,fieldset[disabled] .notification_widget.danger,fieldset[disabled] .notification_widget.danger.active,fieldset[disabled] .notification_widget.danger.focus,fieldset[disabled] .notification_widget.danger:active,fieldset[disabled] .notification_widget.danger:focus,fieldset[disabled] .notification_widget.danger:hover{background-color:#d9534f;border-color:#d43f3a}.notification_widget.danger .badge{color:#d9534f;background-color:#fff}div#pager{background-color:#fff;font-size:14px;line-height:20px;overflow:hidden;display:none;position:fixed;bottom:0;width:100%;max-height:50%;padding-top:8px;-webkit-box-shadow:0 0 12px 1px rgba(87,87,87,.2);box-shadow:0 0 12px 1px rgba(87,87,87,.2);z-index:100;top:auto!important}div#pager pre{line-height:1.21429em;color:#000;background-color:#f7f7f7;padding:.4em}div#pager #pager-button-area{position:absolute;top:8px;right:20px}div#pager #pager-contents{position:relative;overflow:auto;width:100%;height:100%}div#pager #pager-contents #pager-container{position:relative;padding:15px 0;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}div#pager .ui-resizable-handle{top:0;height:8px;background:#f7f7f7;border-top:1px solid #cfcfcf;border-bottom:1px solid #cfcfcf}div#pager .ui-resizable-handle::after{content:'';top:2px;left:50%;height:3px;width:30px;margin-left:-15px;position:absolute;border-top:1px solid #cfcfcf}.quickhelp{display:-webkit-box;-webkit-box-orient:horizontal;display:-moz-box;-moz-box-orient:horizontal;display:box;box-orient:horizontal;box-align:stretch;display:flex;flex-direction:row;align-items:stretch}.shortcut_key{display:inline-block;width:20ex;text-align:right;font-family:monospace}.shortcut_descr{display:inline-block;-webkit-box-flex:1;-moz-box-flex:1;box-flex:1;flex:1}span.save_widget{margin-top:6px}span.save_widget span.filename{height:1em;line-height:1em;padding:3px;margin-left:16px;border:none;font-size:146.5%;border-radius:2px}span.save_widget span.filename:hover{background-color:#e6e6e6}span.autosave_status,span.checkpoint_status{font-size:small}@media (max-width:767px){span.save_widget{font-size:small}span.autosave_status,span.checkpoint_status{display:none}}@media (min-width:768px)and (max-width:991px){span.checkpoint_status{display:none}span.autosave_status{font-size:x-small}}.toolbar{padding:0;margin-left:-5px;margin-top:2px;margin-bottom:5px;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}.toolbar label,.toolbar select{width:auto;vertical-align:middle;margin-bottom:0;display:inline;font-size:92%;margin-left:.3em;margin-right:.3em;padding:3px 0 0}.toolbar .btn{padding:2px 8px}.toolbar .btn-group{margin-top:0;margin-left:5px}#maintoolbar{margin-bottom:-3px;margin-top:-8px;border:0;min-height:27px;margin-left:0;padding-top:11px;padding-bottom:3px}#maintoolbar .navbar-text{float:none;vertical-align:middle;text-align:right;margin-left:5px;margin-right:0;margin-top:0}.select-xs{height:24px}@-moz-keyframes fadeOut{from{opacity:1}to{opacity:0}}@-webkit-keyframes fadeOut{from{opacity:1}to{opacity:0}}@-moz-keyframes fadeIn{from{opacity:0}to{opacity:1}}@-webkit-keyframes fadeIn{from{opacity:0}to{opacity:1}}.bigtooltip{overflow:auto;height:200px;-webkit-transition-property:height;-webkit-transition-duration:500ms;-moz-transition-property:height;-moz-transition-duration:500ms;transition-property:height;transition-duration:500ms}.smalltooltip{-webkit-transition-property:height;-webkit-transition-duration:500ms;-moz-transition-property:height;-moz-transition-duration:500ms;transition-property:height;transition-duration:500ms;text-overflow:ellipsis;overflow:hidden;height:80px}.tooltipbuttons{position:absolute;padding-right:15px;top:0;right:0}.tooltiptext{padding-right:30px}.ipython_tooltip{max-width:700px;animation:fadeOut 400ms;-webkit-animation:fadeIn 400ms;-moz-animation:fadeIn 400ms;animation:fadeIn 400ms;vertical-align:middle;background-color:#f7f7f7;overflow:visible;border:1px solid #ababab;outline:0;padding:3px 3px 3px 7px;padding-left:7px;font-family:monospace;min-height:50px;-moz-box-shadow:0 6px 10px -1px #adadad;-webkit-box-shadow:0 6px 10px -1px #adadad;box-shadow:0 6px 10px -1px #adadad;border-radius:2px;position:absolute;z-index:1000}.ipython_tooltip a{float:right}.ipython_tooltip .tooltiptext pre{border:0;border-radius:0;font-size:100%;background-color:#f7f7f7}.pretooltiparrow{left:0;margin:0;top:-16px;width:40px;height:16px;overflow:hidden;position:absolute}.pretooltiparrow:before{background-color:#f7f7f7;border:1px solid #ababab;z-index:11;content:"";position:absolute;left:15px;top:10px;width:25px;height:25px;-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);-o-transform:rotate(45deg)}.terminal-app{background:#eee}.terminal-app #header{background:#fff;-webkit-box-shadow:0 0 12px 1px rgba(87,87,87,.2);box-shadow:0 0 12px 1px rgba(87,87,87,.2)}.terminal-app .terminal{float:left;font-family:monospace;color:#fff;background:#000;padding:.4em;border-radius:2px;-webkit-box-shadow:0 0 12px 1px rgba(87,87,87,.4);box-shadow:0 0 12px 1px rgba(87,87,87,.4)}.terminal-app .terminal,.terminal-app .terminal dummy-screen{line-height:1em;font-size:14px}.terminal-app .terminal-cursor{color:#000;background:#fff}.terminal-app #terminado-container{margin-top:20px}
+/*# sourceMappingURL=style.min.css.map */
+ </style>
+<style type="text/css">
+ .highlight .hll { background-color: #ffffcc }
+.highlight { background: #f8f8f8; }
+.highlight .c { color: #408080; font-style: italic } /* Comment */
+.highlight .err { border: 1px solid #FF0000 } /* Error */
+.highlight .k { color: #008000; font-weight: bold } /* Keyword */
+.highlight .o { color: #666666 } /* Operator */
+.highlight .cm { color: #408080; font-style: italic } /* Comment.Multiline */
+.highlight .cp { color: #BC7A00 } /* Comment.Preproc */
+.highlight .c1 { color: #408080; font-style: italic } /* Comment.Single */
+.highlight .cs { color: #408080; font-style: italic } /* Comment.Special */
+.highlight .gd { color: #A00000 } /* Generic.Deleted */
+.highlight .ge { font-style: italic } /* Generic.Emph */
+.highlight .gr { color: #FF0000 } /* Generic.Error */
+.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
+.highlight .gi { color: #00A000 } /* Generic.Inserted */
+.highlight .go { color: #888888 } /* Generic.Output */
+.highlight .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
+.highlight .gs { font-weight: bold } /* Generic.Strong */
+.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
+.highlight .gt { color: #0044DD } /* Generic.Traceback */
+.highlight .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
+.highlight .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
+.highlight .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
+.highlight .kp { color: #008000 } /* Keyword.Pseudo */
+.highlight .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
+.highlight .kt { color: #B00040 } /* Keyword.Type */
+.highlight .m { color: #666666 } /* Literal.Number */
+.highlight .s { color: #BA2121 } /* Literal.String */
+.highlight .na { color: #7D9029 } /* Name.Attribute */
+.highlight .nb { color: #008000 } /* Name.Builtin */
+.highlight .nc { color: #0000FF; font-weight: bold } /* Name.Class */
+.highlight .no { color: #880000 } /* Name.Constant */
+.highlight .nd { color: #AA22FF } /* Name.Decorator */
+.highlight .ni { color: #999999; font-weight: bold } /* Name.Entity */
+.highlight .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
+.highlight .nf { color: #0000FF } /* Name.Function */
+.highlight .nl { color: #A0A000 } /* Name.Label */
+.highlight .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
+.highlight .nt { color: #008000; font-weight: bold } /* Name.Tag */
+.highlight .nv { color: #19177C } /* Name.Variable */
+.highlight .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
+.highlight .w { color: #bbbbbb } /* Text.Whitespace */
+.highlight .mb { color: #666666 } /* Literal.Number.Bin */
+.highlight .mf { color: #666666 } /* Literal.Number.Float */
+.highlight .mh { color: #666666 } /* Literal.Number.Hex */
+.highlight .mi { color: #666666 } /* Literal.Number.Integer */
+.highlight .mo { color: #666666 } /* Literal.Number.Oct */
+.highlight .sb { color: #BA2121 } /* Literal.String.Backtick */
+.highlight .sc { color: #BA2121 } /* Literal.String.Char */
+.highlight .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
+.highlight .s2 { color: #BA2121 } /* Literal.String.Double */
+.highlight .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
+.highlight .sh { color: #BA2121 } /* Literal.String.Heredoc */
+.highlight .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
+.highlight .sx { color: #008000 } /* Literal.String.Other */
+.highlight .sr { color: #BB6688 } /* Literal.String.Regex */
+.highlight .s1 { color: #BA2121 } /* Literal.String.Single */
+.highlight .ss { color: #19177C } /* Literal.String.Symbol */
+.highlight .bp { color: #008000 } /* Name.Builtin.Pseudo */
+.highlight .vc { color: #19177C } /* Name.Variable.Class */
+.highlight .vg { color: #19177C } /* Name.Variable.Global */
+.highlight .vi { color: #19177C } /* Name.Variable.Instance */
+.highlight .il { color: #666666 } /* Literal.Number.Integer.Long */
+ </style>
+<style type="text/css">
+ /* Experimental typographically tinkered IJulia stylesheet
+ * Copyright © 2013--2015 Jiahao Chen <jiahao@mit.edu>
+ * MIT License
+ *
+ * To use, place in ~/.ipython/profile_notebook/static/custom/custom.css
+ * and refresh the page. (The IPython/Jupyter server does not need to be restarted.)
+ *
+ * Based on suggestions from practicaltypography.com
+ */
+
+.rendered_html ol {
+ list-style:decimal;
+ margin: 1em 2em;
+ color: #fff;
+}
+
+.autosave_status, .checkpoint_status {
+ color: #bbbbbb;
+ font-family: "Fira Sans", sans-serif;
+}
+
+.filename {
+ font-family: "Charis SIL", "Hoefler Text", Garamond, Palatino, serif;
+ font-variant: small-caps;
+ letter-spacing: 0.15em;
+}
+
+.text_cell, .text_cell_render {
+ font-family: "Optima", "Charis SIL", "Hoefler Text", Garamond, Palatino, serif;
+ font-size: 18px;
+ line-height:1.4em;
+ padding-left:3em;
+ padding-right:3em;
+ max-width: 50em;
+ text-rendering: optimizeLegibility;
+ font-variant-ligatures: contextual no-historical-ligatures common-ligatures;,
+ background-color: #4a525a;
+}
+
+blockquote p {
+ font-size: 17px;
+ line-height:1.2em;
+ font-family: "Charis SIL", "Hoefler Text", Garamond, Palatino, serif;
+ text-rendering: optimizeLegibility;
+ font-variant-ligatures: contextual no-historical-ligatures common-ligatures;
+}
+
+.code_cell { /* Area containing both code and output */
+ font-family: "Source Code Pro", "Droid Sans Mono", Consolas, "Ubuntu Mono", "Liberation Mono", monospace;
+ background-color:#F1F0FF; /* light blue */
+ border-radius: 0.8em;
+ padding: 1em;
+}
+
+code, pre, .CodeMirror {
+ font-family: "Source Code Pro", "Droid Sans Mono", Consolas, "Ubuntu Mono", "Liberation Mono", monospace;
+ line-height:1.25em;
+ font-size: 16px;
+}
+
+.slide-header, p.slide-header
+{
+ color: #498AF3;
+ font-size: 200%;
+ font-weight:bold;
+ margin: 0px 20px 10px;
+ page-break-before: always;
+ text-align: center;
+}
+
+div.prompt {
+ font-family: "Source Code Pro", "Droid Sans Mono", Consolas, "Ubuntu Mono", "Liberation Mono", monospace;
+ font-size: 11px;
+}
+
+div.output_area pre {
+ font-family: "Source Code Pro", "Droid Sans Mono", Consolas, "Ubuntu Mono", "Liberation Mono", monospace;
+ line-height:1.25em;
+ font-size: 16px;
+ background-color: #F4F4F4;
+}
+
+div.output_error pre {
+ background-color: #ffeeee;
+}
+
+.cm-header-1, .rendered_html h1 {
+ font-family: "Charis SIL", "Hoefler Text", Garamond, Palatino, serif;
+ font-size: 24px;
+ font-variant: small-caps;
+ text-rendering: auto;
+ letter-spacing: 0.06em;
+ font-variant-ligatures: contextual no-historical-ligatures common-ligatures;
+}
+
+.cm-header-2, .rendered_html h2 {
+ font-family: "Charis SIL", "Hoefler Text", Garamond, Palatino, serif;
+ font-size: 21px;
+ font-weight: bold;
+ text-rendering: optimizeLegibility;
+ font-variant-ligatures: contextual no-historical-ligatures common-ligatures;
+}
+
+.cm-header-3, .rendered_html h3 {
+ font-family: "Charis SIL", "Hoefler Text", Garamond, Palatino, serif;
+ font-size: 19px;
+ font-weight: bold;
+ text-rendering: optimizeLegibility;
+ font-variant-ligatures: contextual no-historical-ligatures common-ligatures;
+}
+
+.cm-header-4, .rendered_html h4, .cm-header-5, .rendered_html h5, .cm-header-6, .rendered_html h6 {
+ font-family: "Charis SIL", "Hoefler Text", Garamond, Palatino, serif;
+ font-size: 18px;
+ font-weight: bold;
+ text-rendering: optimizeLegibility;
+ font-variant-ligatures: contextual no-historical-ligatures common-ligatures;
+}
+
+.rendered_html td {
+ font-variant-numeric: tabular-nums;
+}
+
+ </style>
+
+
+<style type="text/css">
+/* Overrides of notebook CSS for static HTML export */
+body {
+ overflow: visible;
+ padding: 8px;
+}
+
+div#notebook {
+ overflow: visible;
+ border-top: none;
+}
+
+@media print {
+ div.cell {
+ display: block;
+ page-break-inside: avoid;
+ }
+ div.output_wrapper {
+ display: block;
+ page-break-inside: avoid;
+ }
+ div.output {
+ display: block;
+ page-break-inside: avoid;
+ }
+}
+</style>
+
+<!-- Custom stylesheet, it must be in the same directory as the html file -->
+<link rel="stylesheet" href="custom.css">
+
+<!-- Loading mathjax macro -->
+<!-- Load mathjax -->
+ <script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"></script>
+ <!-- MathJax configuration -->
+ <script type="text/x-mathjax-config">
+ MathJax.Hub.Config({
+ tex2jax: {
+ inlineMath: [ ['$','$'], ["\\(","\\)"] ],
+ displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
+ processEscapes: true,
+ processEnvironments: true
+ },
+ // Center justify equations in code and markdown cells. Elsewhere
+ // we use CSS to left justify single line equations in code cells.
+ displayAlign: 'center',
+ "HTML-CSS": {
+ styles: {'.MathJax_Display': {"margin": 0}},
+ linebreaks: { automatic: true }
+ }
+ });
+ </script>
+ <!-- End of mathjax configuration --></head>
+<body>
+ <div tabindex="-1" id="notebook" class="border-box-sizing">
+ <div class="container" id="notebook-container">
+
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<h1 id="Conditional-Formatting">Conditional Formatting<a class="anchor-link" href="#Conditional-Formatting">¶</a></h1><p><em>New in version 0.17.1</em></p>
+<p><p style="color: red"><em>Provisional: This is a new feature and still under development. We'll be adding features and possibly making breaking changes in future releases. We'd love to hear your <a href="https://github.com/pydata/pandas/issues">feedback</a>.</em><p style="color: red"></p>
+<p>You can apply <strong>conditional formatting</strong>, the visual styling of a DataFrame
+depending on the data within, by using the <code>DataFrame.style</code> property.
+This is a property that returns a <code>pandas.Styler</code> object, which has
+useful methods for formatting and displaying DataFrames.</p>
+<p>The styling is accomplished using CSS.
+You write "style functions" that take scalars, <code>DataFrame</code>s or <code>Series</code>, and return <em>like-indexed</em> DataFrames or Series with CSS <code>"attribute: value"</code> pairs for the values.
+These functions can be incrementally passed to the <code>Styler</code> which collects the styles before rendering.</p>
+<h3 id="Contents">Contents<a class="anchor-link" href="#Contents">¶</a></h3><ul>
+<li><a href="#Building-Styles">Building Styles</a></li>
+<li><a href="#Finer-Control:-Slicing">Finer Control: Slicing</a></li>
+<li><a href="#Builtin-Styles">Builtin Styles</a></li>
+<li><a href="#Other-options">Other options</a></li>
+<li><a href="#Sharing-Styles">Sharing Styles</a></li>
+<li><a href="#Limitations">Limitations</a></li>
+<li><a href="#Terms">Terms</a></li>
+<li><a href="#Extensibility">Extensibility</a></li>
+</ul>
+
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<h1 id="Building-Styles">Building Styles<a class="anchor-link" href="#Building-Styles">¶</a></h1><p>Pass your style functions into one of the following methods:</p>
+<ul>
+<li><code>Styler.applymap</code>: elementwise</li>
+<li><code>Styler.apply</code>: column-/row-/table-wise</li>
+</ul>
+<p>Both of those methods take a function (and some other keyword arguments) and applies your function to the DataFrame in a certain way.
+<code>Styler.applymap</code> works through the DataFrame elementwise.
+<code>Styler.apply</code> passes each column or row into your DataFrame one-at-a-time or the entire table at once, depending on the <code>axis</code> keyword argument.
+For columnwise use <code>axis=0</code>, rowwise use <code>axis=1</code>, and for the entire table at once use <code>axis=None</code>.</p>
+<p>The result of the function application, a CSS attribute-value pair, is stored in an internal dictionary on your <code>Styler</code> object.</p>
+<p>Let's see some examples.</p>
+
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing code_cell rendered">
+<div class="input">
+<div class="prompt input_prompt">In [1]:</div>
+<div class="inner_cell">
+ <div class="input_area">
+<div class=" highlight hl-ipython3"><pre><span class="kn">import</span> <span class="nn">pandas</span> <span class="k">as</span> <span class="nn">pd</span>
+<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
+
+<span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">seed</span><span class="p">(</span><span class="mi">24</span><span class="p">)</span>
+<span class="n">df</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">DataFrame</span><span class="p">({</span><span class="s">'A'</span><span class="p">:</span> <span class="n">np</span><span class="o">.</span><span class="n">linspace</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">10</span><span class="p">,</span> <span class="mi">10</span><span class="p">)})</span>
+<span class="n">df</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">concat</span><span class="p">([</span><span class="n">df</span><span class="p">,</span> <span class="n">pd</span><span class="o">.</span><span class="n">DataFrame</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">randn</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">4</span><span class="p">),</span> <span class="n">columns</span><span class="o">=</span><span class="nb">list</span><span class="p">(</span><span class="s">'BCDE'</span><span class="p">))],</span>
+ <span class="n">axis</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
+<span class="n">df</span><span class="o">.</span><span class="n">iloc</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">]</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">nan</span>
+</pre></div>
+
+</div>
+</div>
+</div>
+
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<p>Here's a boring example of rendering a DataFrame, without any (visible) styles:</p>
+
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing code_cell rendered">
+<div class="input">
+<div class="prompt input_prompt">In [2]:</div>
+<div class="inner_cell">
+ <div class="input_area">
+<div class=" highlight hl-ipython3"><pre><span class="n">df</span><span class="o">.</span><span class="n">style</span>
+</pre></div>
+
+</div>
+</div>
+</div>
+
+<div class="output_wrapper">
+<div class="output">
+
+
+<div class="output_area"><div class="prompt output_prompt">Out[2]:</div>
+
+<div class="output_html rendered_html output_subarea output_execute_result">
+
+ <style type="text/css" >
+
+
+ </style>
+
+ <table id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fb">
+
+
+ <thead>
+
+ <tr>
+
+ <th class="blank">
+
+ <th class="col_heading level0 col0">A
+
+ <th class="col_heading level0 col1">B
+
+ <th class="col_heading level0 col2">C
+
+ <th class="col_heading level0 col3">D
+
+ <th class="col_heading level0 col4">E
+
+ </tr>
+
+ </thead>
+ <tbody>
+
+ <tr>
+
+ <th id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fb" class="row_heading level4 row0">
+
+ 0
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow0_col0" class="data row0 col0">
+
+ 1.0
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow0_col1" class="data row0 col1">
+
+ 1.329212
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow0_col2" class="data row0 col2">
+
+ nan
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow0_col3" class="data row0 col3">
+
+ -0.31628
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow0_col4" class="data row0 col4">
+
+ -0.99081
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fb" class="row_heading level4 row1">
+
+ 1
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow1_col0" class="data row1 col0">
+
+ 2.0
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow1_col1" class="data row1 col1">
+
+ -1.070816
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow1_col2" class="data row1 col2">
+
+ -1.438713
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow1_col3" class="data row1 col3">
+
+ 0.564417
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow1_col4" class="data row1 col4">
+
+ 0.295722
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fb" class="row_heading level4 row2">
+
+ 2
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow2_col0" class="data row2 col0">
+
+ 3.0
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow2_col1" class="data row2 col1">
+
+ -1.626404
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow2_col2" class="data row2 col2">
+
+ 0.219565
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow2_col3" class="data row2 col3">
+
+ 0.678805
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow2_col4" class="data row2 col4">
+
+ 1.889273
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fb" class="row_heading level4 row3">
+
+ 3
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow3_col0" class="data row3 col0">
+
+ 4.0
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow3_col1" class="data row3 col1">
+
+ 0.961538
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow3_col2" class="data row3 col2">
+
+ 0.104011
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow3_col3" class="data row3 col3">
+
+ -0.481165
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow3_col4" class="data row3 col4">
+
+ 0.850229
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fb" class="row_heading level4 row4">
+
+ 4
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow4_col0" class="data row4 col0">
+
+ 5.0
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow4_col1" class="data row4 col1">
+
+ 1.453425
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow4_col2" class="data row4 col2">
+
+ 1.057737
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow4_col3" class="data row4 col3">
+
+ 0.165562
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow4_col4" class="data row4 col4">
+
+ 0.515018
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fb" class="row_heading level4 row5">
+
+ 5
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow5_col0" class="data row5 col0">
+
+ 6.0
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow5_col1" class="data row5 col1">
+
+ -1.336936
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow5_col2" class="data row5 col2">
+
+ 0.562861
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow5_col3" class="data row5 col3">
+
+ 1.392855
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow5_col4" class="data row5 col4">
+
+ -0.063328
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fb" class="row_heading level4 row6">
+
+ 6
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow6_col0" class="data row6 col0">
+
+ 7.0
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow6_col1" class="data row6 col1">
+
+ 0.121668
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow6_col2" class="data row6 col2">
+
+ 1.207603
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow6_col3" class="data row6 col3">
+
+ -0.00204
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow6_col4" class="data row6 col4">
+
+ 1.627796
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fb" class="row_heading level4 row7">
+
+ 7
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow7_col0" class="data row7 col0">
+
+ 8.0
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow7_col1" class="data row7 col1">
+
+ 0.354493
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow7_col2" class="data row7 col2">
+
+ 1.037528
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow7_col3" class="data row7 col3">
+
+ -0.385684
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow7_col4" class="data row7 col4">
+
+ 0.519818
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fb" class="row_heading level4 row8">
+
+ 8
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow8_col0" class="data row8 col0">
+
+ 9.0
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow8_col1" class="data row8 col1">
+
+ 1.686583
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow8_col2" class="data row8 col2">
+
+ -1.325963
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow8_col3" class="data row8 col3">
+
+ 1.428984
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow8_col4" class="data row8 col4">
+
+ -2.089354
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fb" class="row_heading level4 row9">
+
+ 9
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow9_col0" class="data row9 col0">
+
+ 10.0
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow9_col1" class="data row9 col1">
+
+ -0.12982
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow9_col2" class="data row9 col2">
+
+ 0.631523
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow9_col3" class="data row9 col3">
+
+ -0.586538
+
+
+ <td id="T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow9_col4" class="data row9 col4">
+
+ 0.29072
+
+
+ </tr>
+
+ </tbody>
+ </table>
+
+</div>
+
+</div>
+
+</div>
+</div>
+
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<p><em>Note</em>: The <code>DataFrame.style</code> attribute is a propetry that returns a <code>Styler</code> object. <code>Styler</code> has a <code>_repr_html_</code> method defined on it so they are rendered automatically. If you want the actual HTML back for further processing or for writing to file call the <code>.render()</code> method which returns a string.</p>
+<p>The above output looks very similar to the standard DataFrame HTML representation. But we've done some work behind the scenes to attach CSS classes to each cell. We can view these by calling the <code>.render</code> method.</p>
+
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing code_cell rendered">
+<div class="input">
+<div class="prompt input_prompt">In [3]:</div>
+<div class="inner_cell">
+ <div class="input_area">
+<div class=" highlight hl-ipython3"><pre><span class="n">df</span><span class="o">.</span><span class="n">style</span><span class="o">.</span><span class="n">highlight_null</span><span class="p">()</span><span class="o">.</span><span class="n">render</span><span class="p">()</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">'</span><span class="se">\n</span><span class="s">'</span><span class="p">)[:</span><span class="mi">10</span><span class="p">]</span>
+</pre></div>
+
+</div>
+</div>
+</div>
+
+<div class="output_wrapper">
+<div class="output">
+
+
+<div class="output_area"><div class="prompt output_prompt">Out[3]:</div>
+
+
+<div class="output_text output_subarea output_execute_result">
+<pre>['',
+ ' <style type="text/css" >',
+ ' ',
+ ' ',
+ ' #T_e7c1f51a_8bd5_11e5_803e_a45e60bd97fbrow0_col2 {',
+ ' ',
+ ' background-color: red;',
+ ' ',
+ ' }',
+ ' ']</pre>
+</div>
+
+</div>
+
+</div>
+</div>
+
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<p>The <code>row0_col2</code> is the identifier for that particular cell. We've also prepended each row/column identifier with a UUID unique to each DataFrame so that the style from one doesn't collied with the styling from another within the same notebook or page (you can set the <code>uuid</code> if you'd like to tie together the styling of two DataFrames).</p>
+<p>When writing style functions, you take care of producing the CSS attribute / value pairs you want. Pandas matches those up with the CSS classes that identify each cell.</p>
+
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<p>Let's write a simple style function that will color negative numbers red and positive numbers black.</p>
+
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing code_cell rendered">
+<div class="input">
+<div class="prompt input_prompt">In [4]:</div>
+<div class="inner_cell">
+ <div class="input_area">
+<div class=" highlight hl-ipython3"><pre><span class="k">def</span> <span class="nf">color_negative_red</span><span class="p">(</span><span class="n">val</span><span class="p">):</span>
+ <span class="sd">"""</span>
+<span class="sd"> Takes a scalar and returns a string with</span>
+<span class="sd"> the css property `'color: red'` for negative</span>
+<span class="sd"> strings, black otherwise.</span>
+<span class="sd"> """</span>
+ <span class="n">color</span> <span class="o">=</span> <span class="s">'red'</span> <span class="k">if</span> <span class="n">val</span> <span class="o"><</span> <span class="mi">0</span> <span class="k">else</span> <span class="s">'black'</span>
+ <span class="k">return</span> <span class="s">'color: %s'</span> <span class="o">%</span> <span class="n">color</span>
+</pre></div>
+
+</div>
+</div>
+</div>
+
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<p>In this case, the cell's style depends only on it's own value.
+That means we should use the <code>Styler.applymap</code> method which works elementwise.</p>
+
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing code_cell rendered">
+<div class="input">
+<div class="prompt input_prompt">In [5]:</div>
+<div class="inner_cell">
+ <div class="input_area">
+<div class=" highlight hl-ipython3"><pre><span class="n">s</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">style</span><span class="o">.</span><span class="n">applymap</span><span class="p">(</span><span class="n">color_negative_red</span><span class="p">)</span>
+<span class="n">s</span>
+</pre></div>
+
+</div>
+</div>
+</div>
+
+<div class="output_wrapper">
+<div class="output">
+
+
+<div class="output_area"><div class="prompt output_prompt">Out[5]:</div>
+
+<div class="output_html rendered_html output_subarea output_execute_result">
+
+ <style type="text/css" >
+
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow0_col0 {
+
+ color: black;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow0_col1 {
+
+ color: black;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow0_col2 {
+
+ color: black;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow0_col3 {
+
+ color: red;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow0_col4 {
+
+ color: red;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow1_col0 {
+
+ color: black;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow1_col1 {
+
+ color: red;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow1_col2 {
+
+ color: red;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow1_col3 {
+
+ color: black;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow1_col4 {
+
+ color: black;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow2_col0 {
+
+ color: black;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow2_col1 {
+
+ color: red;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow2_col2 {
+
+ color: black;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow2_col3 {
+
+ color: black;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow2_col4 {
+
+ color: black;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow3_col0 {
+
+ color: black;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow3_col1 {
+
+ color: black;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow3_col2 {
+
+ color: black;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow3_col3 {
+
+ color: red;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow3_col4 {
+
+ color: black;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow4_col0 {
+
+ color: black;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow4_col1 {
+
+ color: black;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow4_col2 {
+
+ color: black;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow4_col3 {
+
+ color: black;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow4_col4 {
+
+ color: black;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow5_col0 {
+
+ color: black;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow5_col1 {
+
+ color: red;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow5_col2 {
+
+ color: black;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow5_col3 {
+
+ color: black;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow5_col4 {
+
+ color: red;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow6_col0 {
+
+ color: black;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow6_col1 {
+
+ color: black;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow6_col2 {
+
+ color: black;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow6_col3 {
+
+ color: red;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow6_col4 {
+
+ color: black;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow7_col0 {
+
+ color: black;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow7_col1 {
+
+ color: black;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow7_col2 {
+
+ color: black;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow7_col3 {
+
+ color: red;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow7_col4 {
+
+ color: black;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow8_col0 {
+
+ color: black;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow8_col1 {
+
+ color: black;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow8_col2 {
+
+ color: red;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow8_col3 {
+
+ color: black;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow8_col4 {
+
+ color: red;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow9_col0 {
+
+ color: black;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow9_col1 {
+
+ color: red;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow9_col2 {
+
+ color: black;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow9_col3 {
+
+ color: red;
+
+ }
+
+ #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow9_col4 {
+
+ color: black;
+
+ }
+
+ </style>
+
+ <table id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fb">
+
+
+ <thead>
+
+ <tr>
+
+ <th class="blank">
+
+ <th class="col_heading level0 col0">A
+
+ <th class="col_heading level0 col1">B
+
+ <th class="col_heading level0 col2">C
+
+ <th class="col_heading level0 col3">D
+
+ <th class="col_heading level0 col4">E
+
+ </tr>
+
+ </thead>
+ <tbody>
+
+ <tr>
+
+ <th id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fb" class="row_heading level4 row0">
+
+ 0
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow0_col0" class="data row0 col0">
+
+ 1.0
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow0_col1" class="data row0 col1">
+
+ 1.329212
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow0_col2" class="data row0 col2">
+
+ nan
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow0_col3" class="data row0 col3">
+
+ -0.31628
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow0_col4" class="data row0 col4">
+
+ -0.99081
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fb" class="row_heading level4 row1">
+
+ 1
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow1_col0" class="data row1 col0">
+
+ 2.0
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow1_col1" class="data row1 col1">
+
+ -1.070816
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow1_col2" class="data row1 col2">
+
+ -1.438713
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow1_col3" class="data row1 col3">
+
+ 0.564417
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow1_col4" class="data row1 col4">
+
+ 0.295722
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fb" class="row_heading level4 row2">
+
+ 2
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow2_col0" class="data row2 col0">
+
+ 3.0
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow2_col1" class="data row2 col1">
+
+ -1.626404
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow2_col2" class="data row2 col2">
+
+ 0.219565
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow2_col3" class="data row2 col3">
+
+ 0.678805
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow2_col4" class="data row2 col4">
+
+ 1.889273
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fb" class="row_heading level4 row3">
+
+ 3
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow3_col0" class="data row3 col0">
+
+ 4.0
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow3_col1" class="data row3 col1">
+
+ 0.961538
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow3_col2" class="data row3 col2">
+
+ 0.104011
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow3_col3" class="data row3 col3">
+
+ -0.481165
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow3_col4" class="data row3 col4">
+
+ 0.850229
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fb" class="row_heading level4 row4">
+
+ 4
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow4_col0" class="data row4 col0">
+
+ 5.0
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow4_col1" class="data row4 col1">
+
+ 1.453425
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow4_col2" class="data row4 col2">
+
+ 1.057737
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow4_col3" class="data row4 col3">
+
+ 0.165562
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow4_col4" class="data row4 col4">
+
+ 0.515018
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fb" class="row_heading level4 row5">
+
+ 5
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow5_col0" class="data row5 col0">
+
+ 6.0
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow5_col1" class="data row5 col1">
+
+ -1.336936
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow5_col2" class="data row5 col2">
+
+ 0.562861
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow5_col3" class="data row5 col3">
+
+ 1.392855
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow5_col4" class="data row5 col4">
+
+ -0.063328
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fb" class="row_heading level4 row6">
+
+ 6
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow6_col0" class="data row6 col0">
+
+ 7.0
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow6_col1" class="data row6 col1">
+
+ 0.121668
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow6_col2" class="data row6 col2">
+
+ 1.207603
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow6_col3" class="data row6 col3">
+
+ -0.00204
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow6_col4" class="data row6 col4">
+
+ 1.627796
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fb" class="row_heading level4 row7">
+
+ 7
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow7_col0" class="data row7 col0">
+
+ 8.0
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow7_col1" class="data row7 col1">
+
+ 0.354493
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow7_col2" class="data row7 col2">
+
+ 1.037528
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow7_col3" class="data row7 col3">
+
+ -0.385684
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow7_col4" class="data row7 col4">
+
+ 0.519818
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fb" class="row_heading level4 row8">
+
+ 8
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow8_col0" class="data row8 col0">
+
+ 9.0
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow8_col1" class="data row8 col1">
+
+ 1.686583
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow8_col2" class="data row8 col2">
+
+ -1.325963
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow8_col3" class="data row8 col3">
+
+ 1.428984
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow8_col4" class="data row8 col4">
+
+ -2.089354
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fb" class="row_heading level4 row9">
+
+ 9
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow9_col0" class="data row9 col0">
+
+ 10.0
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow9_col1" class="data row9 col1">
+
+ -0.12982
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow9_col2" class="data row9 col2">
+
+ 0.631523
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow9_col3" class="data row9 col3">
+
+ -0.586538
+
+
+ <td id="T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow9_col4" class="data row9 col4">
+
+ 0.29072
+
+
+ </tr>
+
+ </tbody>
+ </table>
+
+</div>
+
+</div>
+
+</div>
+</div>
+
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<p>Notice the similarity with the standard <code>df.applymap</code>, which operates on DataFrames elementwise. We want you to be able to resuse your existing knowledge of how to interact with DataFrames.</p>
+<p>Notice also that our function returned a string containing the CSS attribute and value, separated by a colon just like in a <code><style></code> tag. This will be a common theme.</p>
+
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<p>Now suppose you wanted to highlight the maximum value in each column.
+We can't use <code>.applymap</code> anymore since that operated elementwise.
+Instead, we'll turn to <code>.apply</code> which operates columnwise (or rowwise using the <code>axis</code> keyword). Later on we'll see that something like <code>highlight_max</code> is already defined on <code>Styler</code> so you wouldn't need to write this yourself.</p>
+
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing code_cell rendered">
+<div class="input">
+<div class="prompt input_prompt">In [6]:</div>
+<div class="inner_cell">
+ <div class="input_area">
+<div class=" highlight hl-ipython3"><pre><span class="k">def</span> <span class="nf">highlight_max</span><span class="p">(</span><span class="n">s</span><span class="p">):</span>
+ <span class="sd">'''</span>
+<span class="sd"> highlight the maximum in a Series yellow.</span>
+<span class="sd"> '''</span>
+ <span class="n">is_max</span> <span class="o">=</span> <span class="n">s</span> <span class="o">==</span> <span class="n">s</span><span class="o">.</span><span class="n">max</span><span class="p">()</span>
+ <span class="k">return</span> <span class="p">[</span><span class="s">'background-color: yellow'</span> <span class="k">if</span> <span class="n">v</span> <span class="k">else</span> <span class="s">''</span> <span class="k">for</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">is_max</span><span class="p">]</span>
+</pre></div>
+
+</div>
+</div>
+</div>
+
+</div>
+<div class="cell border-box-sizing code_cell rendered">
+<div class="input">
+<div class="prompt input_prompt">In [7]:</div>
+<div class="inner_cell">
+ <div class="input_area">
+<div class=" highlight hl-ipython3"><pre><span class="n">df</span><span class="o">.</span><span class="n">style</span><span class="o">.</span><span class="n">apply</span><span class="p">(</span><span class="n">highlight_max</span><span class="p">)</span>
+</pre></div>
+
+</div>
+</div>
+</div>
+
+<div class="output_wrapper">
+<div class="output">
+
+
+<div class="output_area"><div class="prompt output_prompt">Out[7]:</div>
+
+<div class="output_html rendered_html output_subarea output_execute_result">
+
+ <style type="text/css" >
+
+
+ #T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow2_col4 {
+
+ background-color: yellow;
+
+ }
+
+ #T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow6_col2 {
+
+ background-color: yellow;
+
+ }
+
+ #T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow8_col1 {
+
+ background-color: yellow;
+
+ }
+
+ #T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow8_col3 {
+
+ background-color: yellow;
+
+ }
+
+ #T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow9_col0 {
+
+ background-color: yellow;
+
+ }
+
+ </style>
+
+ <table id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fb">
+
+
+ <thead>
+
+ <tr>
+
+ <th class="blank">
+
+ <th class="col_heading level0 col0">A
+
+ <th class="col_heading level0 col1">B
+
+ <th class="col_heading level0 col2">C
+
+ <th class="col_heading level0 col3">D
+
+ <th class="col_heading level0 col4">E
+
+ </tr>
+
+ </thead>
+ <tbody>
+
+ <tr>
+
+ <th id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fb" class="row_heading level4 row0">
+
+ 0
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow0_col0" class="data row0 col0">
+
+ 1.0
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow0_col1" class="data row0 col1">
+
+ 1.329212
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow0_col2" class="data row0 col2">
+
+ nan
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow0_col3" class="data row0 col3">
+
+ -0.31628
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow0_col4" class="data row0 col4">
+
+ -0.99081
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fb" class="row_heading level4 row1">
+
+ 1
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow1_col0" class="data row1 col0">
+
+ 2.0
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow1_col1" class="data row1 col1">
+
+ -1.070816
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow1_col2" class="data row1 col2">
+
+ -1.438713
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow1_col3" class="data row1 col3">
+
+ 0.564417
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow1_col4" class="data row1 col4">
+
+ 0.295722
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fb" class="row_heading level4 row2">
+
+ 2
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow2_col0" class="data row2 col0">
+
+ 3.0
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow2_col1" class="data row2 col1">
+
+ -1.626404
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow2_col2" class="data row2 col2">
+
+ 0.219565
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow2_col3" class="data row2 col3">
+
+ 0.678805
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow2_col4" class="data row2 col4">
+
+ 1.889273
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fb" class="row_heading level4 row3">
+
+ 3
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow3_col0" class="data row3 col0">
+
+ 4.0
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow3_col1" class="data row3 col1">
+
+ 0.961538
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow3_col2" class="data row3 col2">
+
+ 0.104011
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow3_col3" class="data row3 col3">
+
+ -0.481165
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow3_col4" class="data row3 col4">
+
+ 0.850229
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fb" class="row_heading level4 row4">
+
+ 4
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow4_col0" class="data row4 col0">
+
+ 5.0
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow4_col1" class="data row4 col1">
+
+ 1.453425
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow4_col2" class="data row4 col2">
+
+ 1.057737
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow4_col3" class="data row4 col3">
+
+ 0.165562
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow4_col4" class="data row4 col4">
+
+ 0.515018
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fb" class="row_heading level4 row5">
+
+ 5
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow5_col0" class="data row5 col0">
+
+ 6.0
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow5_col1" class="data row5 col1">
+
+ -1.336936
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow5_col2" class="data row5 col2">
+
+ 0.562861
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow5_col3" class="data row5 col3">
+
+ 1.392855
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow5_col4" class="data row5 col4">
+
+ -0.063328
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fb" class="row_heading level4 row6">
+
+ 6
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow6_col0" class="data row6 col0">
+
+ 7.0
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow6_col1" class="data row6 col1">
+
+ 0.121668
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow6_col2" class="data row6 col2">
+
+ 1.207603
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow6_col3" class="data row6 col3">
+
+ -0.00204
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow6_col4" class="data row6 col4">
+
+ 1.627796
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fb" class="row_heading level4 row7">
+
+ 7
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow7_col0" class="data row7 col0">
+
+ 8.0
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow7_col1" class="data row7 col1">
+
+ 0.354493
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow7_col2" class="data row7 col2">
+
+ 1.037528
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow7_col3" class="data row7 col3">
+
+ -0.385684
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow7_col4" class="data row7 col4">
+
+ 0.519818
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fb" class="row_heading level4 row8">
+
+ 8
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow8_col0" class="data row8 col0">
+
+ 9.0
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow8_col1" class="data row8 col1">
+
+ 1.686583
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow8_col2" class="data row8 col2">
+
+ -1.325963
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow8_col3" class="data row8 col3">
+
+ 1.428984
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow8_col4" class="data row8 col4">
+
+ -2.089354
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fb" class="row_heading level4 row9">
+
+ 9
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow9_col0" class="data row9 col0">
+
+ 10.0
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow9_col1" class="data row9 col1">
+
+ -0.12982
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow9_col2" class="data row9 col2">
+
+ 0.631523
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow9_col3" class="data row9 col3">
+
+ -0.586538
+
+
+ <td id="T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow9_col4" class="data row9 col4">
+
+ 0.29072
+
+
+ </tr>
+
+ </tbody>
+ </table>
+
+</div>
+
+</div>
+
+</div>
+</div>
+
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<p>We encourage you to use method chains to build up a style piecewise, before finally rending at the end of the chain.</p>
+
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing code_cell rendered">
+<div class="input">
+<div class="prompt input_prompt">In [8]:</div>
+<div class="inner_cell">
+ <div class="input_area">
+<div class=" highlight hl-ipython3"><pre><span class="n">df</span><span class="o">.</span><span class="n">style</span><span class="o">.</span>\
+ <span class="n">applymap</span><span class="p">(</span><span class="n">color_negative_red</span><span class="p">)</span><span class="o">.</span>\
+ <span class="n">apply</span><span class="p">(</span><span class="n">highlight_max</span><span class="p">)</span>
+</pre></div>
+
+</div>
+</div>
+</div>
+
+<div class="output_wrapper">
+<div class="output">
+
+
+<div class="output_area"><div class="prompt output_prompt">Out[8]:</div>
+
+<div class="output_html rendered_html output_subarea output_execute_result">
+
+ <style type="text/css" >
+
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow0_col0 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow0_col1 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow0_col2 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow0_col3 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow0_col4 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow1_col0 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow1_col1 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow1_col2 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow1_col3 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow1_col4 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow2_col0 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow2_col1 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow2_col2 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow2_col3 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow2_col4 {
+
+ color: black;
+
+ background-color: yellow;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow3_col0 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow3_col1 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow3_col2 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow3_col3 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow3_col4 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow4_col0 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow4_col1 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow4_col2 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow4_col3 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow4_col4 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow5_col0 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow5_col1 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow5_col2 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow5_col3 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow5_col4 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow6_col0 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow6_col1 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow6_col2 {
+
+ color: black;
+
+ background-color: yellow;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow6_col3 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow6_col4 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow7_col0 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow7_col1 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow7_col2 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow7_col3 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow7_col4 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow8_col0 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow8_col1 {
+
+ color: black;
+
+ background-color: yellow;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow8_col2 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow8_col3 {
+
+ color: black;
+
+ background-color: yellow;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow8_col4 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow9_col0 {
+
+ color: black;
+
+ background-color: yellow;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow9_col1 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow9_col2 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow9_col3 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow9_col4 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ </style>
+
+ <table id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fb">
+
+
+ <thead>
+
+ <tr>
+
+ <th class="blank">
+
+ <th class="col_heading level0 col0">A
+
+ <th class="col_heading level0 col1">B
+
+ <th class="col_heading level0 col2">C
+
+ <th class="col_heading level0 col3">D
+
+ <th class="col_heading level0 col4">E
+
+ </tr>
+
+ </thead>
+ <tbody>
+
+ <tr>
+
+ <th id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fb" class="row_heading level4 row0">
+
+ 0
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow0_col0" class="data row0 col0">
+
+ 1.0
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow0_col1" class="data row0 col1">
+
+ 1.329212
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow0_col2" class="data row0 col2">
+
+ nan
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow0_col3" class="data row0 col3">
+
+ -0.31628
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow0_col4" class="data row0 col4">
+
+ -0.99081
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fb" class="row_heading level4 row1">
+
+ 1
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow1_col0" class="data row1 col0">
+
+ 2.0
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow1_col1" class="data row1 col1">
+
+ -1.070816
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow1_col2" class="data row1 col2">
+
+ -1.438713
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow1_col3" class="data row1 col3">
+
+ 0.564417
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow1_col4" class="data row1 col4">
+
+ 0.295722
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fb" class="row_heading level4 row2">
+
+ 2
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow2_col0" class="data row2 col0">
+
+ 3.0
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow2_col1" class="data row2 col1">
+
+ -1.626404
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow2_col2" class="data row2 col2">
+
+ 0.219565
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow2_col3" class="data row2 col3">
+
+ 0.678805
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow2_col4" class="data row2 col4">
+
+ 1.889273
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fb" class="row_heading level4 row3">
+
+ 3
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow3_col0" class="data row3 col0">
+
+ 4.0
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow3_col1" class="data row3 col1">
+
+ 0.961538
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow3_col2" class="data row3 col2">
+
+ 0.104011
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow3_col3" class="data row3 col3">
+
+ -0.481165
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow3_col4" class="data row3 col4">
+
+ 0.850229
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fb" class="row_heading level4 row4">
+
+ 4
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow4_col0" class="data row4 col0">
+
+ 5.0
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow4_col1" class="data row4 col1">
+
+ 1.453425
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow4_col2" class="data row4 col2">
+
+ 1.057737
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow4_col3" class="data row4 col3">
+
+ 0.165562
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow4_col4" class="data row4 col4">
+
+ 0.515018
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fb" class="row_heading level4 row5">
+
+ 5
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow5_col0" class="data row5 col0">
+
+ 6.0
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow5_col1" class="data row5 col1">
+
+ -1.336936
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow5_col2" class="data row5 col2">
+
+ 0.562861
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow5_col3" class="data row5 col3">
+
+ 1.392855
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow5_col4" class="data row5 col4">
+
+ -0.063328
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fb" class="row_heading level4 row6">
+
+ 6
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow6_col0" class="data row6 col0">
+
+ 7.0
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow6_col1" class="data row6 col1">
+
+ 0.121668
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow6_col2" class="data row6 col2">
+
+ 1.207603
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow6_col3" class="data row6 col3">
+
+ -0.00204
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow6_col4" class="data row6 col4">
+
+ 1.627796
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fb" class="row_heading level4 row7">
+
+ 7
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow7_col0" class="data row7 col0">
+
+ 8.0
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow7_col1" class="data row7 col1">
+
+ 0.354493
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow7_col2" class="data row7 col2">
+
+ 1.037528
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow7_col3" class="data row7 col3">
+
+ -0.385684
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow7_col4" class="data row7 col4">
+
+ 0.519818
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fb" class="row_heading level4 row8">
+
+ 8
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow8_col0" class="data row8 col0">
+
+ 9.0
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow8_col1" class="data row8 col1">
+
+ 1.686583
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow8_col2" class="data row8 col2">
+
+ -1.325963
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow8_col3" class="data row8 col3">
+
+ 1.428984
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow8_col4" class="data row8 col4">
+
+ -2.089354
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fb" class="row_heading level4 row9">
+
+ 9
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow9_col0" class="data row9 col0">
+
+ 10.0
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow9_col1" class="data row9 col1">
+
+ -0.12982
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow9_col2" class="data row9 col2">
+
+ 0.631523
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow9_col3" class="data row9 col3">
+
+ -0.586538
+
+
+ <td id="T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow9_col4" class="data row9 col4">
+
+ 0.29072
+
+
+ </tr>
+
+ </tbody>
+ </table>
+
+</div>
+
+</div>
+
+</div>
+</div>
+
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<p>Above we used <code>Styler.apply</code> to pass in each column one at a time.</p>
+<p style="background-color: #DEDEBE">*Debugging Tip*: If you're having trouble writing your style function, try just passing it into <code style="background-color: #DEDEBE">df.apply</code>. <code style="background-color: #DEDEBE">Styler.apply</code> uses that internally, so the result should be the same.</p><p>What if you wanted to highlight just the maximum value in the entire table?
+Use <code>.apply(function, axis=None)</code> to indicate that your function wants the entire table, not one column or row at a time. Let's try that next.</p>
+<p>We'll rewrite our <code>highlight-max</code> to handle either Series (from <code>.apply(axis=0 or 1)</code>) or DataFrames (from <code>.apply(axis=None)</code>). We'll also allow the color to be adjustable, to demonstrate that <code>.apply</code>, and <code>.applymap</code> pass along keyword arguments.</p>
+
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing code_cell rendered">
+<div class="input">
+<div class="prompt input_prompt">In [9]:</div>
+<div class="inner_cell">
+ <div class="input_area">
+<div class=" highlight hl-ipython3"><pre><span class="k">def</span> <span class="nf">highlight_max</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'yellow'</span><span class="p">):</span>
+ <span class="sd">'''</span>
+<span class="sd"> highlight the maximum in a Series or DataFrame</span>
+<span class="sd"> '''</span>
+ <span class="n">attr</span> <span class="o">=</span> <span class="s">'background-color: {}'</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">color</span><span class="p">)</span>
+ <span class="k">if</span> <span class="n">data</span><span class="o">.</span><span class="n">ndim</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span> <span class="c"># Series from .apply(axis=0) or axis=1</span>
+ <span class="n">is_max</span> <span class="o">=</span> <span class="n">data</span> <span class="o">==</span> <span class="n">data</span><span class="o">.</span><span class="n">max</span><span class="p">()</span>
+ <span class="k">return</span> <span class="p">[</span><span class="n">attr</span> <span class="k">if</span> <span class="n">v</span> <span class="k">else</span> <span class="s">''</span> <span class="k">for</span> <span class="n">v</span> <span class="ow">in</span> <span class="n">is_max</span><span class="p">]</span>
+ <span class="k">else</span><span class="p">:</span> <span class="c"># from .apply(axis=None)</span>
+ <span class="n">is_max</span> <span class="o">=</span> <span class="n">data</span> <span class="o">==</span> <span class="n">data</span><span class="o">.</span><span class="n">max</span><span class="p">()</span><span class="o">.</span><span class="n">max</span><span class="p">()</span>
+ <span class="k">return</span> <span class="n">pd</span><span class="o">.</span><span class="n">DataFrame</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">where</span><span class="p">(</span><span class="n">is_max</span><span class="p">,</span> <span class="n">attr</span><span class="p">,</span> <span class="s">''</span><span class="p">),</span>
+ <span class="n">index</span><span class="o">=</span><span class="n">data</span><span class="o">.</span><span class="n">index</span><span class="p">,</span> <span class="n">columns</span><span class="o">=</span><span class="n">data</span><span class="o">.</span><span class="n">columns</span><span class="p">)</span>
+</pre></div>
+
+</div>
+</div>
+</div>
+
+</div>
+<div class="cell border-box-sizing code_cell rendered">
+<div class="input">
+<div class="prompt input_prompt">In [10]:</div>
+<div class="inner_cell">
+ <div class="input_area">
+<div class=" highlight hl-ipython3"><pre><span class="n">df</span><span class="o">.</span><span class="n">style</span><span class="o">.</span><span class="n">apply</span><span class="p">(</span><span class="n">highlight_max</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="s">'darkorange'</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="k">None</span><span class="p">)</span>
+</pre></div>
+
+</div>
+</div>
+</div>
+
+<div class="output_wrapper">
+<div class="output">
+
+
+<div class="output_area"><div class="prompt output_prompt">Out[10]:</div>
+
+<div class="output_html rendered_html output_subarea output_execute_result">
+
+ <style type="text/css" >
+
+
+ #T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow9_col0 {
+
+ background-color: darkorange;
+
+ }
+
+ </style>
+
+ <table id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fb">
+
+
+ <thead>
+
+ <tr>
+
+ <th class="blank">
+
+ <th class="col_heading level0 col0">A
+
+ <th class="col_heading level0 col1">B
+
+ <th class="col_heading level0 col2">C
+
+ <th class="col_heading level0 col3">D
+
+ <th class="col_heading level0 col4">E
+
+ </tr>
+
+ </thead>
+ <tbody>
+
+ <tr>
+
+ <th id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fb" class="row_heading level4 row0">
+
+ 0
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow0_col0" class="data row0 col0">
+
+ 1.0
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow0_col1" class="data row0 col1">
+
+ 1.329212
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow0_col2" class="data row0 col2">
+
+ nan
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow0_col3" class="data row0 col3">
+
+ -0.31628
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow0_col4" class="data row0 col4">
+
+ -0.99081
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fb" class="row_heading level4 row1">
+
+ 1
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow1_col0" class="data row1 col0">
+
+ 2.0
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow1_col1" class="data row1 col1">
+
+ -1.070816
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow1_col2" class="data row1 col2">
+
+ -1.438713
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow1_col3" class="data row1 col3">
+
+ 0.564417
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow1_col4" class="data row1 col4">
+
+ 0.295722
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fb" class="row_heading level4 row2">
+
+ 2
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow2_col0" class="data row2 col0">
+
+ 3.0
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow2_col1" class="data row2 col1">
+
+ -1.626404
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow2_col2" class="data row2 col2">
+
+ 0.219565
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow2_col3" class="data row2 col3">
+
+ 0.678805
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow2_col4" class="data row2 col4">
+
+ 1.889273
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fb" class="row_heading level4 row3">
+
+ 3
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow3_col0" class="data row3 col0">
+
+ 4.0
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow3_col1" class="data row3 col1">
+
+ 0.961538
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow3_col2" class="data row3 col2">
+
+ 0.104011
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow3_col3" class="data row3 col3">
+
+ -0.481165
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow3_col4" class="data row3 col4">
+
+ 0.850229
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fb" class="row_heading level4 row4">
+
+ 4
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow4_col0" class="data row4 col0">
+
+ 5.0
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow4_col1" class="data row4 col1">
+
+ 1.453425
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow4_col2" class="data row4 col2">
+
+ 1.057737
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow4_col3" class="data row4 col3">
+
+ 0.165562
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow4_col4" class="data row4 col4">
+
+ 0.515018
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fb" class="row_heading level4 row5">
+
+ 5
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow5_col0" class="data row5 col0">
+
+ 6.0
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow5_col1" class="data row5 col1">
+
+ -1.336936
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow5_col2" class="data row5 col2">
+
+ 0.562861
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow5_col3" class="data row5 col3">
+
+ 1.392855
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow5_col4" class="data row5 col4">
+
+ -0.063328
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fb" class="row_heading level4 row6">
+
+ 6
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow6_col0" class="data row6 col0">
+
+ 7.0
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow6_col1" class="data row6 col1">
+
+ 0.121668
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow6_col2" class="data row6 col2">
+
+ 1.207603
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow6_col3" class="data row6 col3">
+
+ -0.00204
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow6_col4" class="data row6 col4">
+
+ 1.627796
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fb" class="row_heading level4 row7">
+
+ 7
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow7_col0" class="data row7 col0">
+
+ 8.0
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow7_col1" class="data row7 col1">
+
+ 0.354493
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow7_col2" class="data row7 col2">
+
+ 1.037528
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow7_col3" class="data row7 col3">
+
+ -0.385684
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow7_col4" class="data row7 col4">
+
+ 0.519818
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fb" class="row_heading level4 row8">
+
+ 8
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow8_col0" class="data row8 col0">
+
+ 9.0
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow8_col1" class="data row8 col1">
+
+ 1.686583
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow8_col2" class="data row8 col2">
+
+ -1.325963
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow8_col3" class="data row8 col3">
+
+ 1.428984
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow8_col4" class="data row8 col4">
+
+ -2.089354
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fb" class="row_heading level4 row9">
+
+ 9
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow9_col0" class="data row9 col0">
+
+ 10.0
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow9_col1" class="data row9 col1">
+
+ -0.12982
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow9_col2" class="data row9 col2">
+
+ 0.631523
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow9_col3" class="data row9 col3">
+
+ -0.586538
+
+
+ <td id="T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow9_col4" class="data row9 col4">
+
+ 0.29072
+
+
+ </tr>
+
+ </tbody>
+ </table>
+
+</div>
+
+</div>
+
+</div>
+</div>
+
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<h3 id="Building-Styles-Summary">Building Styles Summary<a class="anchor-link" href="#Building-Styles-Summary">¶</a></h3><p>Style functions should return strings with one or more CSS <code>attribute: value</code> delimited by semicolons. Use</p>
+<ul>
+<li><code>Styler.applymap(func)</code> for elementwise styles</li>
+<li><code>Styler.apply(func, axis=0)</code> for columnwise styles</li>
+<li><code>Styler.apply(func, axis=1)</code> for rowwise styles</li>
+<li><code>Styler.apply(func, axis=None)</code> for tablewise styles</li>
+</ul>
+
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<h2 id="Finer-Control:-Slicing">Finer Control: Slicing<a class="anchor-link" href="#Finer-Control:-Slicing">¶</a></h2>
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<p>Both <code>Styler.apply</code>, and <code>Styler.applymap</code> accept a <code>subset</code> keyword.
+This allows you to apply styles to specific rows or columns, without having to code that logic into your <code>style</code> function.</p>
+<p>The value passed to <code>subset</code> behaves simlar to slicing a DataFrame.</p>
+<ul>
+<li>A scalar is treated as a column label</li>
+<li>A list (or series or numpy array)</li>
+<li>A tuple is treated as <code>(row_indexer, column_indexer)</code></li>
+</ul>
+<p>Consider using <code>pd.IndexSlice</code> to construct the tuple for the last one.</p>
+
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing code_cell rendered">
+<div class="input">
+<div class="prompt input_prompt">In [11]:</div>
+<div class="inner_cell">
+ <div class="input_area">
+<div class=" highlight hl-ipython3"><pre><span class="n">df</span><span class="o">.</span><span class="n">style</span><span class="o">.</span><span class="n">apply</span><span class="p">(</span><span class="n">highlight_max</span><span class="p">,</span> <span class="n">subset</span><span class="o">=</span><span class="p">[</span><span class="s">'B'</span><span class="p">,</span> <span class="s">'C'</span><span class="p">,</span> <span class="s">'D'</span><span class="p">])</span>
+</pre></div>
+
+</div>
+</div>
+</div>
+
+<div class="output_wrapper">
+<div class="output">
+
+
+<div class="output_area"><div class="prompt output_prompt">Out[11]:</div>
+
+<div class="output_html rendered_html output_subarea output_execute_result">
+
+ <style type="text/css" >
+
+
+ #T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow6_col2 {
+
+ background-color: yellow;
+
+ }
+
+ #T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow8_col1 {
+
+ background-color: yellow;
+
+ }
+
+ #T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow8_col3 {
+
+ background-color: yellow;
+
+ }
+
+ </style>
+
+ <table id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fb">
+
+
+ <thead>
+
+ <tr>
+
+ <th class="blank">
+
+ <th class="col_heading level0 col0">A
+
+ <th class="col_heading level0 col1">B
+
+ <th class="col_heading level0 col2">C
+
+ <th class="col_heading level0 col3">D
+
+ <th class="col_heading level0 col4">E
+
+ </tr>
+
+ </thead>
+ <tbody>
+
+ <tr>
+
+ <th id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fb" class="row_heading level4 row0">
+
+ 0
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow0_col0" class="data row0 col0">
+
+ 1.0
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow0_col1" class="data row0 col1">
+
+ 1.329212
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow0_col2" class="data row0 col2">
+
+ nan
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow0_col3" class="data row0 col3">
+
+ -0.31628
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow0_col4" class="data row0 col4">
+
+ -0.99081
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fb" class="row_heading level4 row1">
+
+ 1
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow1_col0" class="data row1 col0">
+
+ 2.0
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow1_col1" class="data row1 col1">
+
+ -1.070816
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow1_col2" class="data row1 col2">
+
+ -1.438713
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow1_col3" class="data row1 col3">
+
+ 0.564417
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow1_col4" class="data row1 col4">
+
+ 0.295722
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fb" class="row_heading level4 row2">
+
+ 2
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow2_col0" class="data row2 col0">
+
+ 3.0
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow2_col1" class="data row2 col1">
+
+ -1.626404
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow2_col2" class="data row2 col2">
+
+ 0.219565
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow2_col3" class="data row2 col3">
+
+ 0.678805
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow2_col4" class="data row2 col4">
+
+ 1.889273
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fb" class="row_heading level4 row3">
+
+ 3
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow3_col0" class="data row3 col0">
+
+ 4.0
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow3_col1" class="data row3 col1">
+
+ 0.961538
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow3_col2" class="data row3 col2">
+
+ 0.104011
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow3_col3" class="data row3 col3">
+
+ -0.481165
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow3_col4" class="data row3 col4">
+
+ 0.850229
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fb" class="row_heading level4 row4">
+
+ 4
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow4_col0" class="data row4 col0">
+
+ 5.0
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow4_col1" class="data row4 col1">
+
+ 1.453425
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow4_col2" class="data row4 col2">
+
+ 1.057737
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow4_col3" class="data row4 col3">
+
+ 0.165562
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow4_col4" class="data row4 col4">
+
+ 0.515018
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fb" class="row_heading level4 row5">
+
+ 5
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow5_col0" class="data row5 col0">
+
+ 6.0
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow5_col1" class="data row5 col1">
+
+ -1.336936
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow5_col2" class="data row5 col2">
+
+ 0.562861
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow5_col3" class="data row5 col3">
+
+ 1.392855
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow5_col4" class="data row5 col4">
+
+ -0.063328
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fb" class="row_heading level4 row6">
+
+ 6
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow6_col0" class="data row6 col0">
+
+ 7.0
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow6_col1" class="data row6 col1">
+
+ 0.121668
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow6_col2" class="data row6 col2">
+
+ 1.207603
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow6_col3" class="data row6 col3">
+
+ -0.00204
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow6_col4" class="data row6 col4">
+
+ 1.627796
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fb" class="row_heading level4 row7">
+
+ 7
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow7_col0" class="data row7 col0">
+
+ 8.0
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow7_col1" class="data row7 col1">
+
+ 0.354493
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow7_col2" class="data row7 col2">
+
+ 1.037528
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow7_col3" class="data row7 col3">
+
+ -0.385684
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow7_col4" class="data row7 col4">
+
+ 0.519818
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fb" class="row_heading level4 row8">
+
+ 8
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow8_col0" class="data row8 col0">
+
+ 9.0
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow8_col1" class="data row8 col1">
+
+ 1.686583
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow8_col2" class="data row8 col2">
+
+ -1.325963
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow8_col3" class="data row8 col3">
+
+ 1.428984
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow8_col4" class="data row8 col4">
+
+ -2.089354
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fb" class="row_heading level4 row9">
+
+ 9
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow9_col0" class="data row9 col0">
+
+ 10.0
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow9_col1" class="data row9 col1">
+
+ -0.12982
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow9_col2" class="data row9 col2">
+
+ 0.631523
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow9_col3" class="data row9 col3">
+
+ -0.586538
+
+
+ <td id="T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow9_col4" class="data row9 col4">
+
+ 0.29072
+
+
+ </tr>
+
+ </tbody>
+ </table>
+
+</div>
+
+</div>
+
+</div>
+</div>
+
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<p>For row and column slicing, any valid indexer to <code>.loc</code> will work.</p>
+
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing code_cell rendered">
+<div class="input">
+<div class="prompt input_prompt">In [12]:</div>
+<div class="inner_cell">
+ <div class="input_area">
+<div class=" highlight hl-ipython3"><pre><span class="n">df</span><span class="o">.</span><span class="n">style</span><span class="o">.</span><span class="n">applymap</span><span class="p">(</span><span class="n">color_negative_red</span><span class="p">,</span>
+ <span class="n">subset</span><span class="o">=</span><span class="n">pd</span><span class="o">.</span><span class="n">IndexSlice</span><span class="p">[</span><span class="mi">2</span><span class="p">:</span><span class="mi">5</span><span class="p">,</span> <span class="p">[</span><span class="s">'B'</span><span class="p">,</span> <span class="s">'D'</span><span class="p">]])</span>
+</pre></div>
+
+</div>
+</div>
+</div>
+
+<div class="output_wrapper">
+<div class="output">
+
+
+<div class="output_area"><div class="prompt output_prompt">Out[12]:</div>
+
+<div class="output_html rendered_html output_subarea output_execute_result">
+
+ <style type="text/css" >
+
+
+ #T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow2_col1 {
+
+ color: red;
+
+ }
+
+ #T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow2_col3 {
+
+ color: black;
+
+ }
+
+ #T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow3_col1 {
+
+ color: black;
+
+ }
+
+ #T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow3_col3 {
+
+ color: red;
+
+ }
+
+ #T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow4_col1 {
+
+ color: black;
+
+ }
+
+ #T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow4_col3 {
+
+ color: black;
+
+ }
+
+ #T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow5_col1 {
+
+ color: red;
+
+ }
+
+ #T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow5_col3 {
+
+ color: black;
+
+ }
+
+ </style>
+
+ <table id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fb">
+
+
+ <thead>
+
+ <tr>
+
+ <th class="blank">
+
+ <th class="col_heading level0 col0">A
+
+ <th class="col_heading level0 col1">B
+
+ <th class="col_heading level0 col2">C
+
+ <th class="col_heading level0 col3">D
+
+ <th class="col_heading level0 col4">E
+
+ </tr>
+
+ </thead>
+ <tbody>
+
+ <tr>
+
+ <th id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fb" class="row_heading level4 row0">
+
+ 0
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow0_col0" class="data row0 col0">
+
+ 1.0
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow0_col1" class="data row0 col1">
+
+ 1.329212
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow0_col2" class="data row0 col2">
+
+ nan
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow0_col3" class="data row0 col3">
+
+ -0.31628
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow0_col4" class="data row0 col4">
+
+ -0.99081
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fb" class="row_heading level4 row1">
+
+ 1
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow1_col0" class="data row1 col0">
+
+ 2.0
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow1_col1" class="data row1 col1">
+
+ -1.070816
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow1_col2" class="data row1 col2">
+
+ -1.438713
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow1_col3" class="data row1 col3">
+
+ 0.564417
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow1_col4" class="data row1 col4">
+
+ 0.295722
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fb" class="row_heading level4 row2">
+
+ 2
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow2_col0" class="data row2 col0">
+
+ 3.0
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow2_col1" class="data row2 col1">
+
+ -1.626404
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow2_col2" class="data row2 col2">
+
+ 0.219565
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow2_col3" class="data row2 col3">
+
+ 0.678805
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow2_col4" class="data row2 col4">
+
+ 1.889273
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fb" class="row_heading level4 row3">
+
+ 3
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow3_col0" class="data row3 col0">
+
+ 4.0
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow3_col1" class="data row3 col1">
+
+ 0.961538
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow3_col2" class="data row3 col2">
+
+ 0.104011
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow3_col3" class="data row3 col3">
+
+ -0.481165
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow3_col4" class="data row3 col4">
+
+ 0.850229
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fb" class="row_heading level4 row4">
+
+ 4
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow4_col0" class="data row4 col0">
+
+ 5.0
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow4_col1" class="data row4 col1">
+
+ 1.453425
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow4_col2" class="data row4 col2">
+
+ 1.057737
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow4_col3" class="data row4 col3">
+
+ 0.165562
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow4_col4" class="data row4 col4">
+
+ 0.515018
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fb" class="row_heading level4 row5">
+
+ 5
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow5_col0" class="data row5 col0">
+
+ 6.0
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow5_col1" class="data row5 col1">
+
+ -1.336936
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow5_col2" class="data row5 col2">
+
+ 0.562861
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow5_col3" class="data row5 col3">
+
+ 1.392855
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow5_col4" class="data row5 col4">
+
+ -0.063328
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fb" class="row_heading level4 row6">
+
+ 6
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow6_col0" class="data row6 col0">
+
+ 7.0
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow6_col1" class="data row6 col1">
+
+ 0.121668
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow6_col2" class="data row6 col2">
+
+ 1.207603
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow6_col3" class="data row6 col3">
+
+ -0.00204
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow6_col4" class="data row6 col4">
+
+ 1.627796
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fb" class="row_heading level4 row7">
+
+ 7
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow7_col0" class="data row7 col0">
+
+ 8.0
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow7_col1" class="data row7 col1">
+
+ 0.354493
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow7_col2" class="data row7 col2">
+
+ 1.037528
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow7_col3" class="data row7 col3">
+
+ -0.385684
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow7_col4" class="data row7 col4">
+
+ 0.519818
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fb" class="row_heading level4 row8">
+
+ 8
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow8_col0" class="data row8 col0">
+
+ 9.0
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow8_col1" class="data row8 col1">
+
+ 1.686583
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow8_col2" class="data row8 col2">
+
+ -1.325963
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow8_col3" class="data row8 col3">
+
+ 1.428984
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow8_col4" class="data row8 col4">
+
+ -2.089354
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fb" class="row_heading level4 row9">
+
+ 9
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow9_col0" class="data row9 col0">
+
+ 10.0
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow9_col1" class="data row9 col1">
+
+ -0.12982
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow9_col2" class="data row9 col2">
+
+ 0.631523
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow9_col3" class="data row9 col3">
+
+ -0.586538
+
+
+ <td id="T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow9_col4" class="data row9 col4">
+
+ 0.29072
+
+
+ </tr>
+
+ </tbody>
+ </table>
+
+</div>
+
+</div>
+
+</div>
+</div>
+
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<p>Only label-based slicing is supported right now, not positional.</p>
+<p>If your style function uses a <code>subset</code> or <code>axis</code> keyword argument, consider wrapping your function in a <code>functools.partial</code>, partialing out that keyword.</p>
+<div class="highlight"><pre><span class="n">my_func2</span> <span class="o">=</span> <span class="n">functools</span><span class="o">.</span><span class="n">partial</span><span class="p">(</span><span class="n">my_func</span><span class="p">,</span> <span class="n">subset</span><span class="o">=</span><span class="mi">42</span><span class="p">)</span>
+</pre></div>
+
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<h2 id="Builtin-Styles">Builtin Styles<a class="anchor-link" href="#Builtin-Styles">¶</a></h2>
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<p>Finally, we expect certain styling functions to be common enough that we've included a few "built-in" to the <code>Styler</code>, so you don't have to write them yourself.</p>
+
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing code_cell rendered">
+<div class="input">
+<div class="prompt input_prompt">In [13]:</div>
+<div class="inner_cell">
+ <div class="input_area">
+<div class=" highlight hl-ipython3"><pre><span class="n">df</span><span class="o">.</span><span class="n">style</span><span class="o">.</span><span class="n">highlight_null</span><span class="p">(</span><span class="n">null_color</span><span class="o">=</span><span class="s">'red'</span><span class="p">)</span>
+</pre></div>
+
+</div>
+</div>
+</div>
+
+<div class="output_wrapper">
+<div class="output">
+
+
+<div class="output_area"><div class="prompt output_prompt">Out[13]:</div>
+
+<div class="output_html rendered_html output_subarea output_execute_result">
+
+ <style type="text/css" >
+
+
+ #T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow0_col2 {
+
+ background-color: red;
+
+ }
+
+ </style>
+
+ <table id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fb">
+
+
+ <thead>
+
+ <tr>
+
+ <th class="blank">
+
+ <th class="col_heading level0 col0">A
+
+ <th class="col_heading level0 col1">B
+
+ <th class="col_heading level0 col2">C
+
+ <th class="col_heading level0 col3">D
+
+ <th class="col_heading level0 col4">E
+
+ </tr>
+
+ </thead>
+ <tbody>
+
+ <tr>
+
+ <th id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fb" class="row_heading level4 row0">
+
+ 0
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow0_col0" class="data row0 col0">
+
+ 1.0
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow0_col1" class="data row0 col1">
+
+ 1.329212
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow0_col2" class="data row0 col2">
+
+ nan
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow0_col3" class="data row0 col3">
+
+ -0.31628
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow0_col4" class="data row0 col4">
+
+ -0.99081
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fb" class="row_heading level4 row1">
+
+ 1
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow1_col0" class="data row1 col0">
+
+ 2.0
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow1_col1" class="data row1 col1">
+
+ -1.070816
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow1_col2" class="data row1 col2">
+
+ -1.438713
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow1_col3" class="data row1 col3">
+
+ 0.564417
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow1_col4" class="data row1 col4">
+
+ 0.295722
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fb" class="row_heading level4 row2">
+
+ 2
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow2_col0" class="data row2 col0">
+
+ 3.0
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow2_col1" class="data row2 col1">
+
+ -1.626404
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow2_col2" class="data row2 col2">
+
+ 0.219565
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow2_col3" class="data row2 col3">
+
+ 0.678805
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow2_col4" class="data row2 col4">
+
+ 1.889273
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fb" class="row_heading level4 row3">
+
+ 3
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow3_col0" class="data row3 col0">
+
+ 4.0
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow3_col1" class="data row3 col1">
+
+ 0.961538
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow3_col2" class="data row3 col2">
+
+ 0.104011
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow3_col3" class="data row3 col3">
+
+ -0.481165
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow3_col4" class="data row3 col4">
+
+ 0.850229
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fb" class="row_heading level4 row4">
+
+ 4
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow4_col0" class="data row4 col0">
+
+ 5.0
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow4_col1" class="data row4 col1">
+
+ 1.453425
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow4_col2" class="data row4 col2">
+
+ 1.057737
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow4_col3" class="data row4 col3">
+
+ 0.165562
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow4_col4" class="data row4 col4">
+
+ 0.515018
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fb" class="row_heading level4 row5">
+
+ 5
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow5_col0" class="data row5 col0">
+
+ 6.0
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow5_col1" class="data row5 col1">
+
+ -1.336936
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow5_col2" class="data row5 col2">
+
+ 0.562861
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow5_col3" class="data row5 col3">
+
+ 1.392855
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow5_col4" class="data row5 col4">
+
+ -0.063328
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fb" class="row_heading level4 row6">
+
+ 6
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow6_col0" class="data row6 col0">
+
+ 7.0
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow6_col1" class="data row6 col1">
+
+ 0.121668
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow6_col2" class="data row6 col2">
+
+ 1.207603
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow6_col3" class="data row6 col3">
+
+ -0.00204
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow6_col4" class="data row6 col4">
+
+ 1.627796
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fb" class="row_heading level4 row7">
+
+ 7
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow7_col0" class="data row7 col0">
+
+ 8.0
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow7_col1" class="data row7 col1">
+
+ 0.354493
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow7_col2" class="data row7 col2">
+
+ 1.037528
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow7_col3" class="data row7 col3">
+
+ -0.385684
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow7_col4" class="data row7 col4">
+
+ 0.519818
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fb" class="row_heading level4 row8">
+
+ 8
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow8_col0" class="data row8 col0">
+
+ 9.0
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow8_col1" class="data row8 col1">
+
+ 1.686583
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow8_col2" class="data row8 col2">
+
+ -1.325963
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow8_col3" class="data row8 col3">
+
+ 1.428984
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow8_col4" class="data row8 col4">
+
+ -2.089354
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fb" class="row_heading level4 row9">
+
+ 9
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow9_col0" class="data row9 col0">
+
+ 10.0
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow9_col1" class="data row9 col1">
+
+ -0.12982
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow9_col2" class="data row9 col2">
+
+ 0.631523
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow9_col3" class="data row9 col3">
+
+ -0.586538
+
+
+ <td id="T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow9_col4" class="data row9 col4">
+
+ 0.29072
+
+
+ </tr>
+
+ </tbody>
+ </table>
+
+</div>
+
+</div>
+
+</div>
+</div>
+
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<p>You can create "heatmaps" with the <code>background_gradient</code> method. These require matplotlib, and we'll use <a href="http://stanford.edu/~mwaskom/software/seaborn/">Seaborn</a> to get a nice colormap.</p>
+
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing code_cell rendered">
+<div class="input">
+<div class="prompt input_prompt">In [14]:</div>
+<div class="inner_cell">
+ <div class="input_area">
+<div class=" highlight hl-ipython3"><pre><span class="kn">import</span> <span class="nn">seaborn</span> <span class="k">as</span> <span class="nn">sns</span>
+
+<span class="n">cm</span> <span class="o">=</span> <span class="n">sns</span><span class="o">.</span><span class="n">light_palette</span><span class="p">(</span><span class="s">"green"</span><span class="p">,</span> <span class="n">as_cmap</span><span class="o">=</span><span class="k">True</span><span class="p">)</span>
+
+<span class="n">s</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">style</span><span class="o">.</span><span class="n">background_gradient</span><span class="p">(</span><span class="n">cmap</span><span class="o">=</span><span class="n">cm</span><span class="p">)</span>
+<span class="n">s</span>
+</pre></div>
+
+</div>
+</div>
+</div>
+
+<div class="output_wrapper">
+<div class="output">
+
+
+<div class="output_area"><div class="prompt output_prompt">Out[14]:</div>
+
+<div class="output_html rendered_html output_subarea output_execute_result">
+
+ <style type="text/css" >
+
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow0_col0 {
+
+ background-color: #e5ffe5;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow0_col1 {
+
+ background-color: #188d18;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow0_col2 {
+
+ background-color: #e5ffe5;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow0_col3 {
+
+ background-color: #c7eec7;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow0_col4 {
+
+ background-color: #a6dca6;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow1_col0 {
+
+ background-color: #ccf1cc;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow1_col1 {
+
+ background-color: #c0eac0;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow1_col2 {
+
+ background-color: #e5ffe5;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow1_col3 {
+
+ background-color: #62b662;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow1_col4 {
+
+ background-color: #5cb35c;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow2_col0 {
+
+ background-color: #b3e3b3;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow2_col1 {
+
+ background-color: #e5ffe5;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow2_col2 {
+
+ background-color: #56af56;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow2_col3 {
+
+ background-color: #56af56;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow2_col4 {
+
+ background-color: #008000;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow3_col0 {
+
+ background-color: #99d599;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow3_col1 {
+
+ background-color: #329c32;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow3_col2 {
+
+ background-color: #5fb55f;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow3_col3 {
+
+ background-color: #daf9da;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow3_col4 {
+
+ background-color: #3ba13b;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow4_col0 {
+
+ background-color: #80c780;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow4_col1 {
+
+ background-color: #108910;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow4_col2 {
+
+ background-color: #0d870d;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow4_col3 {
+
+ background-color: #90d090;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow4_col4 {
+
+ background-color: #4fac4f;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow5_col0 {
+
+ background-color: #66b866;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow5_col1 {
+
+ background-color: #d2f4d2;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow5_col2 {
+
+ background-color: #389f38;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow5_col3 {
+
+ background-color: #048204;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow5_col4 {
+
+ background-color: #70be70;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow6_col0 {
+
+ background-color: #4daa4d;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow6_col1 {
+
+ background-color: #6cbc6c;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow6_col2 {
+
+ background-color: #008000;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow6_col3 {
+
+ background-color: #a3daa3;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow6_col4 {
+
+ background-color: #0e880e;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow7_col0 {
+
+ background-color: #329c32;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow7_col1 {
+
+ background-color: #5cb35c;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow7_col2 {
+
+ background-color: #0e880e;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow7_col3 {
+
+ background-color: #cff3cf;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow7_col4 {
+
+ background-color: #4fac4f;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow8_col0 {
+
+ background-color: #198e19;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow8_col1 {
+
+ background-color: #008000;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow8_col2 {
+
+ background-color: #dcfadc;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow8_col3 {
+
+ background-color: #008000;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow8_col4 {
+
+ background-color: #e5ffe5;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow9_col0 {
+
+ background-color: #008000;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow9_col1 {
+
+ background-color: #7ec67e;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow9_col2 {
+
+ background-color: #319b31;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow9_col3 {
+
+ background-color: #e5ffe5;
+
+ }
+
+ #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow9_col4 {
+
+ background-color: #5cb35c;
+
+ }
+
+ </style>
+
+ <table id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fb">
+
+
+ <thead>
+
+ <tr>
+
+ <th class="blank">
+
+ <th class="col_heading level0 col0">A
+
+ <th class="col_heading level0 col1">B
+
+ <th class="col_heading level0 col2">C
+
+ <th class="col_heading level0 col3">D
+
+ <th class="col_heading level0 col4">E
+
+ </tr>
+
+ </thead>
+ <tbody>
+
+ <tr>
+
+ <th id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fb" class="row_heading level4 row0">
+
+ 0
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow0_col0" class="data row0 col0">
+
+ 1.0
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow0_col1" class="data row0 col1">
+
+ 1.329212
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow0_col2" class="data row0 col2">
+
+ nan
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow0_col3" class="data row0 col3">
+
+ -0.31628
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow0_col4" class="data row0 col4">
+
+ -0.99081
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fb" class="row_heading level4 row1">
+
+ 1
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow1_col0" class="data row1 col0">
+
+ 2.0
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow1_col1" class="data row1 col1">
+
+ -1.070816
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow1_col2" class="data row1 col2">
+
+ -1.438713
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow1_col3" class="data row1 col3">
+
+ 0.564417
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow1_col4" class="data row1 col4">
+
+ 0.295722
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fb" class="row_heading level4 row2">
+
+ 2
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow2_col0" class="data row2 col0">
+
+ 3.0
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow2_col1" class="data row2 col1">
+
+ -1.626404
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow2_col2" class="data row2 col2">
+
+ 0.219565
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow2_col3" class="data row2 col3">
+
+ 0.678805
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow2_col4" class="data row2 col4">
+
+ 1.889273
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fb" class="row_heading level4 row3">
+
+ 3
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow3_col0" class="data row3 col0">
+
+ 4.0
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow3_col1" class="data row3 col1">
+
+ 0.961538
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow3_col2" class="data row3 col2">
+
+ 0.104011
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow3_col3" class="data row3 col3">
+
+ -0.481165
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow3_col4" class="data row3 col4">
+
+ 0.850229
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fb" class="row_heading level4 row4">
+
+ 4
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow4_col0" class="data row4 col0">
+
+ 5.0
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow4_col1" class="data row4 col1">
+
+ 1.453425
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow4_col2" class="data row4 col2">
+
+ 1.057737
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow4_col3" class="data row4 col3">
+
+ 0.165562
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow4_col4" class="data row4 col4">
+
+ 0.515018
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fb" class="row_heading level4 row5">
+
+ 5
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow5_col0" class="data row5 col0">
+
+ 6.0
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow5_col1" class="data row5 col1">
+
+ -1.336936
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow5_col2" class="data row5 col2">
+
+ 0.562861
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow5_col3" class="data row5 col3">
+
+ 1.392855
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow5_col4" class="data row5 col4">
+
+ -0.063328
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fb" class="row_heading level4 row6">
+
+ 6
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow6_col0" class="data row6 col0">
+
+ 7.0
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow6_col1" class="data row6 col1">
+
+ 0.121668
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow6_col2" class="data row6 col2">
+
+ 1.207603
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow6_col3" class="data row6 col3">
+
+ -0.00204
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow6_col4" class="data row6 col4">
+
+ 1.627796
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fb" class="row_heading level4 row7">
+
+ 7
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow7_col0" class="data row7 col0">
+
+ 8.0
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow7_col1" class="data row7 col1">
+
+ 0.354493
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow7_col2" class="data row7 col2">
+
+ 1.037528
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow7_col3" class="data row7 col3">
+
+ -0.385684
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow7_col4" class="data row7 col4">
+
+ 0.519818
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fb" class="row_heading level4 row8">
+
+ 8
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow8_col0" class="data row8 col0">
+
+ 9.0
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow8_col1" class="data row8 col1">
+
+ 1.686583
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow8_col2" class="data row8 col2">
+
+ -1.325963
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow8_col3" class="data row8 col3">
+
+ 1.428984
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow8_col4" class="data row8 col4">
+
+ -2.089354
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fb" class="row_heading level4 row9">
+
+ 9
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow9_col0" class="data row9 col0">
+
+ 10.0
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow9_col1" class="data row9 col1">
+
+ -0.12982
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow9_col2" class="data row9 col2">
+
+ 0.631523
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow9_col3" class="data row9 col3">
+
+ -0.586538
+
+
+ <td id="T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow9_col4" class="data row9 col4">
+
+ 0.29072
+
+
+ </tr>
+
+ </tbody>
+ </table>
+
+</div>
+
+</div>
+
+</div>
+</div>
+
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<p><code>Styler.background_gradient</code> takes the keyword arguments <code>low</code> and <code>high</code>. Roughly speaking these extend the range of your data by <code>low</code> and <code>high</code> percent so that when we convert the colors, the colormap's entire range isn't used. This is useful so that you can actually read the text still.</p>
+
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing code_cell rendered">
+<div class="input">
+<div class="prompt input_prompt">In [15]:</div>
+<div class="inner_cell">
+ <div class="input_area">
+<div class=" highlight hl-ipython3"><pre><span class="c"># Uses the full color range</span>
+<span class="n">df</span><span class="o">.</span><span class="n">loc</span><span class="p">[:</span><span class="mi">4</span><span class="p">]</span><span class="o">.</span><span class="n">style</span><span class="o">.</span><span class="n">background_gradient</span><span class="p">(</span><span class="n">cmap</span><span class="o">=</span><span class="s">'viridis'</span><span class="p">)</span>
+</pre></div>
+
+</div>
+</div>
+</div>
+
+<div class="output_wrapper">
+<div class="output">
+
+
+<div class="output_area"><div class="prompt output_prompt">Out[15]:</div>
+
+<div class="output_html rendered_html output_subarea output_execute_result">
+
+ <style type="text/css" >
+
+
+ #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow0_col0 {
+
+ background-color: #440154;
+
+ }
+
+ #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow0_col1 {
+
+ background-color: #e5e419;
+
+ }
+
+ #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow0_col2 {
+
+ background-color: #440154;
+
+ }
+
+ #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow0_col3 {
+
+ background-color: #46327e;
+
+ }
+
+ #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow0_col4 {
+
+ background-color: #440154;
+
+ }
+
+ #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow1_col0 {
+
+ background-color: #3b528b;
+
+ }
+
+ #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow1_col1 {
+
+ background-color: #433e85;
+
+ }
+
+ #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow1_col2 {
+
+ background-color: #440154;
+
+ }
+
+ #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow1_col3 {
+
+ background-color: #bddf26;
+
+ }
+
+ #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow1_col4 {
+
+ background-color: #25838e;
+
+ }
+
+ #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow2_col0 {
+
+ background-color: #21918c;
+
+ }
+
+ #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow2_col1 {
+
+ background-color: #440154;
+
+ }
+
+ #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow2_col2 {
+
+ background-color: #35b779;
+
+ }
+
+ #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow2_col3 {
+
+ background-color: #fde725;
+
+ }
+
+ #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow2_col4 {
+
+ background-color: #fde725;
+
+ }
+
+ #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow3_col0 {
+
+ background-color: #5ec962;
+
+ }
+
+ #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow3_col1 {
+
+ background-color: #95d840;
+
+ }
+
+ #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow3_col2 {
+
+ background-color: #26ad81;
+
+ }
+
+ #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow3_col3 {
+
+ background-color: #440154;
+
+ }
+
+ #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow3_col4 {
+
+ background-color: #2cb17e;
+
+ }
+
+ #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow4_col0 {
+
+ background-color: #fde725;
+
+ }
+
+ #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow4_col1 {
+
+ background-color: #fde725;
+
+ }
+
+ #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow4_col2 {
+
+ background-color: #fde725;
+
+ }
+
+ #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow4_col3 {
+
+ background-color: #1f9e89;
+
+ }
+
+ #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow4_col4 {
+
+ background-color: #1f958b;
+
+ }
+
+ </style>
+
+ <table id="T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fb">
+
+
+ <thead>
+
+ <tr>
+
+ <th class="blank">
+
+ <th class="col_heading level0 col0">A
+
+ <th class="col_heading level0 col1">B
+
+ <th class="col_heading level0 col2">C
+
+ <th class="col_heading level0 col3">D
+
+ <th class="col_heading level0 col4">E
+
+ </tr>
+
+ </thead>
+ <tbody>
+
+ <tr>
+
+ <th id="T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fb" class="row_heading level4 row0">
+
+ 0
+
+
+ <td id="T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow0_col0" class="data row0 col0">
+
+ 1.0
+
+
+ <td id="T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow0_col1" class="data row0 col1">
+
+ 1.329212
+
+
+ <td id="T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow0_col2" class="data row0 col2">
+
+ nan
+
+
+ <td id="T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow0_col3" class="data row0 col3">
+
+ -0.31628
+
+
+ <td id="T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow0_col4" class="data row0 col4">
+
+ -0.99081
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fb" class="row_heading level4 row1">
+
+ 1
+
+
+ <td id="T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow1_col0" class="data row1 col0">
+
+ 2.0
+
+
+ <td id="T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow1_col1" class="data row1 col1">
+
+ -1.070816
+
+
+ <td id="T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow1_col2" class="data row1 col2">
+
+ -1.438713
+
+
+ <td id="T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow1_col3" class="data row1 col3">
+
+ 0.564417
+
+
+ <td id="T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow1_col4" class="data row1 col4">
+
+ 0.295722
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fb" class="row_heading level4 row2">
+
+ 2
+
+
+ <td id="T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow2_col0" class="data row2 col0">
+
+ 3.0
+
+
+ <td id="T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow2_col1" class="data row2 col1">
+
+ -1.626404
+
+
+ <td id="T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow2_col2" class="data row2 col2">
+
+ 0.219565
+
+
+ <td id="T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow2_col3" class="data row2 col3">
+
+ 0.678805
+
+
+ <td id="T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow2_col4" class="data row2 col4">
+
+ 1.889273
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fb" class="row_heading level4 row3">
+
+ 3
+
+
+ <td id="T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow3_col0" class="data row3 col0">
+
+ 4.0
+
+
+ <td id="T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow3_col1" class="data row3 col1">
+
+ 0.961538
+
+
+ <td id="T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow3_col2" class="data row3 col2">
+
+ 0.104011
+
+
+ <td id="T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow3_col3" class="data row3 col3">
+
+ -0.481165
+
+
+ <td id="T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow3_col4" class="data row3 col4">
+
+ 0.850229
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fb" class="row_heading level4 row4">
+
+ 4
+
+
+ <td id="T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow4_col0" class="data row4 col0">
+
+ 5.0
+
+
+ <td id="T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow4_col1" class="data row4 col1">
+
+ 1.453425
+
+
+ <td id="T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow4_col2" class="data row4 col2">
+
+ 1.057737
+
+
+ <td id="T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow4_col3" class="data row4 col3">
+
+ 0.165562
+
+
+ <td id="T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow4_col4" class="data row4 col4">
+
+ 0.515018
+
+
+ </tr>
+
+ </tbody>
+ </table>
+
+</div>
+
+</div>
+
+</div>
+</div>
+
+</div>
+<div class="cell border-box-sizing code_cell rendered">
+<div class="input">
+<div class="prompt input_prompt">In [16]:</div>
+<div class="inner_cell">
+ <div class="input_area">
+<div class=" highlight hl-ipython3"><pre><span class="c"># Compreess the color range</span>
+<span class="p">(</span><span class="n">df</span><span class="o">.</span><span class="n">loc</span><span class="p">[:</span><span class="mi">4</span><span class="p">]</span>
+ <span class="o">.</span><span class="n">style</span>
+ <span class="o">.</span><span class="n">background_gradient</span><span class="p">(</span><span class="n">cmap</span><span class="o">=</span><span class="s">'viridis'</span><span class="p">,</span> <span class="n">low</span><span class="o">=.</span><span class="mi">5</span><span class="p">,</span> <span class="n">high</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>
+ <span class="o">.</span><span class="n">highlight_null</span><span class="p">(</span><span class="s">'red'</span><span class="p">))</span>
+</pre></div>
+
+</div>
+</div>
+</div>
+
+<div class="output_wrapper">
+<div class="output">
+
+
+<div class="output_area"><div class="prompt output_prompt">Out[16]:</div>
+
+<div class="output_html rendered_html output_subarea output_execute_result">
+
+ <style type="text/css" >
+
+
+ #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow0_col0 {
+
+ background-color: #31688e;
+
+ : ;
+
+ }
+
+ #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow0_col1 {
+
+ background-color: #efe51c;
+
+ : ;
+
+ }
+
+ #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow0_col2 {
+
+ background-color: #440154;
+
+ background-color: red;
+
+ }
+
+ #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow0_col3 {
+
+ background-color: #277f8e;
+
+ : ;
+
+ }
+
+ #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow0_col4 {
+
+ background-color: #31688e;
+
+ : ;
+
+ }
+
+ #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow1_col0 {
+
+ background-color: #21918c;
+
+ : ;
+
+ }
+
+ #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow1_col1 {
+
+ background-color: #25858e;
+
+ : ;
+
+ }
+
+ #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow1_col2 {
+
+ background-color: #31688e;
+
+ : ;
+
+ }
+
+ #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow1_col3 {
+
+ background-color: #d5e21a;
+
+ : ;
+
+ }
+
+ #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow1_col4 {
+
+ background-color: #29af7f;
+
+ : ;
+
+ }
+
+ #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow2_col0 {
+
+ background-color: #35b779;
+
+ : ;
+
+ }
+
+ #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow2_col1 {
+
+ background-color: #31688e;
+
+ : ;
+
+ }
+
+ #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow2_col2 {
+
+ background-color: #6ccd5a;
+
+ : ;
+
+ }
+
+ #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow2_col3 {
+
+ background-color: #fde725;
+
+ : ;
+
+ }
+
+ #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow2_col4 {
+
+ background-color: #fde725;
+
+ : ;
+
+ }
+
+ #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow3_col0 {
+
+ background-color: #90d743;
+
+ : ;
+
+ }
+
+ #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow3_col1 {
+
+ background-color: #b8de29;
+
+ : ;
+
+ }
+
+ #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow3_col2 {
+
+ background-color: #5ac864;
+
+ : ;
+
+ }
+
+ #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow3_col3 {
+
+ background-color: #31688e;
+
+ : ;
+
+ }
+
+ #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow3_col4 {
+
+ background-color: #63cb5f;
+
+ : ;
+
+ }
+
+ #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow4_col0 {
+
+ background-color: #fde725;
+
+ : ;
+
+ }
+
+ #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow4_col1 {
+
+ background-color: #fde725;
+
+ : ;
+
+ }
+
+ #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow4_col2 {
+
+ background-color: #fde725;
+
+ : ;
+
+ }
+
+ #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow4_col3 {
+
+ background-color: #46c06f;
+
+ : ;
+
+ }
+
+ #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow4_col4 {
+
+ background-color: #3bbb75;
+
+ : ;
+
+ }
+
+ </style>
+
+ <table id="T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fb">
+
+
+ <thead>
+
+ <tr>
+
+ <th class="blank">
+
+ <th class="col_heading level0 col0">A
+
+ <th class="col_heading level0 col1">B
+
+ <th class="col_heading level0 col2">C
+
+ <th class="col_heading level0 col3">D
+
+ <th class="col_heading level0 col4">E
+
+ </tr>
+
+ </thead>
+ <tbody>
+
+ <tr>
+
+ <th id="T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fb" class="row_heading level4 row0">
+
+ 0
+
+
+ <td id="T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow0_col0" class="data row0 col0">
+
+ 1.0
+
+
+ <td id="T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow0_col1" class="data row0 col1">
+
+ 1.329212
+
+
+ <td id="T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow0_col2" class="data row0 col2">
+
+ nan
+
+
+ <td id="T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow0_col3" class="data row0 col3">
+
+ -0.31628
+
+
+ <td id="T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow0_col4" class="data row0 col4">
+
+ -0.99081
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fb" class="row_heading level4 row1">
+
+ 1
+
+
+ <td id="T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow1_col0" class="data row1 col0">
+
+ 2.0
+
+
+ <td id="T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow1_col1" class="data row1 col1">
+
+ -1.070816
+
+
+ <td id="T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow1_col2" class="data row1 col2">
+
+ -1.438713
+
+
+ <td id="T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow1_col3" class="data row1 col3">
+
+ 0.564417
+
+
+ <td id="T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow1_col4" class="data row1 col4">
+
+ 0.295722
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fb" class="row_heading level4 row2">
+
+ 2
+
+
+ <td id="T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow2_col0" class="data row2 col0">
+
+ 3.0
+
+
+ <td id="T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow2_col1" class="data row2 col1">
+
+ -1.626404
+
+
+ <td id="T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow2_col2" class="data row2 col2">
+
+ 0.219565
+
+
+ <td id="T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow2_col3" class="data row2 col3">
+
+ 0.678805
+
+
+ <td id="T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow2_col4" class="data row2 col4">
+
+ 1.889273
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fb" class="row_heading level4 row3">
+
+ 3
+
+
+ <td id="T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow3_col0" class="data row3 col0">
+
+ 4.0
+
+
+ <td id="T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow3_col1" class="data row3 col1">
+
+ 0.961538
+
+
+ <td id="T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow3_col2" class="data row3 col2">
+
+ 0.104011
+
+
+ <td id="T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow3_col3" class="data row3 col3">
+
+ -0.481165
+
+
+ <td id="T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow3_col4" class="data row3 col4">
+
+ 0.850229
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fb" class="row_heading level4 row4">
+
+ 4
+
+
+ <td id="T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow4_col0" class="data row4 col0">
+
+ 5.0
+
+
+ <td id="T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow4_col1" class="data row4 col1">
+
+ 1.453425
+
+
+ <td id="T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow4_col2" class="data row4 col2">
+
+ 1.057737
+
+
+ <td id="T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow4_col3" class="data row4 col3">
+
+ 0.165562
+
+
+ <td id="T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow4_col4" class="data row4 col4">
+
+ 0.515018
+
+
+ </tr>
+
+ </tbody>
+ </table>
+
+</div>
+
+</div>
+
+</div>
+</div>
+
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<p>You can include "bar charts" in your DataFrame.</p>
+
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing code_cell rendered">
+<div class="input">
+<div class="prompt input_prompt">In [17]:</div>
+<div class="inner_cell">
+ <div class="input_area">
+<div class=" highlight hl-ipython3"><pre><span class="n">df</span><span class="o">.</span><span class="n">style</span><span class="o">.</span><span class="n">bar</span><span class="p">(</span><span class="n">subset</span><span class="o">=</span><span class="p">[</span><span class="s">'A'</span><span class="p">,</span> <span class="s">'B'</span><span class="p">],</span> <span class="n">color</span><span class="o">=</span><span class="s">'#d65f5f'</span><span class="p">)</span>
+</pre></div>
+
+</div>
+</div>
+</div>
+
+<div class="output_wrapper">
+<div class="output">
+
+
+<div class="output_area"><div class="prompt output_prompt">Out[17]:</div>
+
+<div class="output_html rendered_html output_subarea output_execute_result">
+
+ <style type="text/css" >
+
+
+ #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow0_col0 {
+
+ width: 10em;
+
+ height: 80%;
+
+ background: linear-gradient(90deg,#d65f5f 0.0%, transparent 0%);
+
+ }
+
+ #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow0_col1 {
+
+ width: 10em;
+
+ height: 80%;
+
+ background: linear-gradient(90deg,#d65f5f 89.21303639960456%, transparent 0%);
+
+ }
+
+ #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow1_col0 {
+
+ width: 10em;
+
+ height: 80%;
+
+ background: linear-gradient(90deg,#d65f5f 11.11111111111111%, transparent 0%);
+
+ }
+
+ #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow1_col1 {
+
+ width: 10em;
+
+ height: 80%;
+
+ background: linear-gradient(90deg,#d65f5f 16.77000113307442%, transparent 0%);
+
+ }
+
+ #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow2_col0 {
+
+ width: 10em;
+
+ height: 80%;
+
+ background: linear-gradient(90deg,#d65f5f 22.22222222222222%, transparent 0%);
+
+ }
+
+ #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow2_col1 {
+
+ width: 10em;
+
+ height: 80%;
+
+ background: linear-gradient(90deg,#d65f5f 0.0%, transparent 0%);
+
+ }
+
+ #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow3_col0 {
+
+ width: 10em;
+
+ height: 80%;
+
+ background: linear-gradient(90deg,#d65f5f 33.333333333333336%, transparent 0%);
+
+ }
+
+ #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow3_col1 {
+
+ width: 10em;
+
+ height: 80%;
+
+ background: linear-gradient(90deg,#d65f5f 78.1150827834652%, transparent 0%);
+
+ }
+
+ #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow4_col0 {
+
+ width: 10em;
+
+ height: 80%;
+
+ background: linear-gradient(90deg,#d65f5f 44.44444444444444%, transparent 0%);
+
+ }
+
+ #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow4_col1 {
+
+ width: 10em;
+
+ height: 80%;
+
+ background: linear-gradient(90deg,#d65f5f 92.96229618327422%, transparent 0%);
+
+ }
+
+ #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow5_col0 {
+
+ width: 10em;
+
+ height: 80%;
+
+ background: linear-gradient(90deg,#d65f5f 55.55555555555556%, transparent 0%);
+
+ }
+
+ #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow5_col1 {
+
+ width: 10em;
+
+ height: 80%;
+
+ background: linear-gradient(90deg,#d65f5f 8.737388253449494%, transparent 0%);
+
+ }
+
+ #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow6_col0 {
+
+ width: 10em;
+
+ height: 80%;
+
+ background: linear-gradient(90deg,#d65f5f 66.66666666666667%, transparent 0%);
+
+ }
+
+ #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow6_col1 {
+
+ width: 10em;
+
+ height: 80%;
+
+ background: linear-gradient(90deg,#d65f5f 52.764243600289866%, transparent 0%);
+
+ }
+
+ #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow7_col0 {
+
+ width: 10em;
+
+ height: 80%;
+
+ background: linear-gradient(90deg,#d65f5f 77.77777777777777%, transparent 0%);
+
+ }
+
+ #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow7_col1 {
+
+ width: 10em;
+
+ height: 80%;
+
+ background: linear-gradient(90deg,#d65f5f 59.79187201238315%, transparent 0%);
+
+ }
+
+ #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow8_col0 {
+
+ width: 10em;
+
+ height: 80%;
+
+ background: linear-gradient(90deg,#d65f5f 88.88888888888889%, transparent 0%);
+
+ }
+
+ #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow8_col1 {
+
+ width: 10em;
+
+ height: 80%;
+
+ background: linear-gradient(90deg,#d65f5f 100.00000000000001%, transparent 0%);
+
+ }
+
+ #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow9_col0 {
+
+ width: 10em;
+
+ height: 80%;
+
+ background: linear-gradient(90deg,#d65f5f 100.0%, transparent 0%);
+
+ }
+
+ #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow9_col1 {
+
+ width: 10em;
+
+ height: 80%;
+
+ background: linear-gradient(90deg,#d65f5f 45.17326030334935%, transparent 0%);
+
+ }
+
+ </style>
+
+ <table id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fb">
+
+
+ <thead>
+
+ <tr>
+
+ <th class="blank">
+
+ <th class="col_heading level0 col0">A
+
+ <th class="col_heading level0 col1">B
+
+ <th class="col_heading level0 col2">C
+
+ <th class="col_heading level0 col3">D
+
+ <th class="col_heading level0 col4">E
+
+ </tr>
+
+ </thead>
+ <tbody>
+
+ <tr>
+
+ <th id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fb" class="row_heading level4 row0">
+
+ 0
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow0_col0" class="data row0 col0">
+
+ 1.0
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow0_col1" class="data row0 col1">
+
+ 1.329212
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow0_col2" class="data row0 col2">
+
+ nan
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow0_col3" class="data row0 col3">
+
+ -0.31628
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow0_col4" class="data row0 col4">
+
+ -0.99081
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fb" class="row_heading level4 row1">
+
+ 1
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow1_col0" class="data row1 col0">
+
+ 2.0
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow1_col1" class="data row1 col1">
+
+ -1.070816
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow1_col2" class="data row1 col2">
+
+ -1.438713
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow1_col3" class="data row1 col3">
+
+ 0.564417
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow1_col4" class="data row1 col4">
+
+ 0.295722
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fb" class="row_heading level4 row2">
+
+ 2
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow2_col0" class="data row2 col0">
+
+ 3.0
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow2_col1" class="data row2 col1">
+
+ -1.626404
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow2_col2" class="data row2 col2">
+
+ 0.219565
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow2_col3" class="data row2 col3">
+
+ 0.678805
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow2_col4" class="data row2 col4">
+
+ 1.889273
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fb" class="row_heading level4 row3">
+
+ 3
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow3_col0" class="data row3 col0">
+
+ 4.0
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow3_col1" class="data row3 col1">
+
+ 0.961538
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow3_col2" class="data row3 col2">
+
+ 0.104011
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow3_col3" class="data row3 col3">
+
+ -0.481165
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow3_col4" class="data row3 col4">
+
+ 0.850229
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fb" class="row_heading level4 row4">
+
+ 4
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow4_col0" class="data row4 col0">
+
+ 5.0
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow4_col1" class="data row4 col1">
+
+ 1.453425
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow4_col2" class="data row4 col2">
+
+ 1.057737
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow4_col3" class="data row4 col3">
+
+ 0.165562
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow4_col4" class="data row4 col4">
+
+ 0.515018
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fb" class="row_heading level4 row5">
+
+ 5
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow5_col0" class="data row5 col0">
+
+ 6.0
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow5_col1" class="data row5 col1">
+
+ -1.336936
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow5_col2" class="data row5 col2">
+
+ 0.562861
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow5_col3" class="data row5 col3">
+
+ 1.392855
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow5_col4" class="data row5 col4">
+
+ -0.063328
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fb" class="row_heading level4 row6">
+
+ 6
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow6_col0" class="data row6 col0">
+
+ 7.0
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow6_col1" class="data row6 col1">
+
+ 0.121668
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow6_col2" class="data row6 col2">
+
+ 1.207603
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow6_col3" class="data row6 col3">
+
+ -0.00204
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow6_col4" class="data row6 col4">
+
+ 1.627796
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fb" class="row_heading level4 row7">
+
+ 7
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow7_col0" class="data row7 col0">
+
+ 8.0
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow7_col1" class="data row7 col1">
+
+ 0.354493
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow7_col2" class="data row7 col2">
+
+ 1.037528
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow7_col3" class="data row7 col3">
+
+ -0.385684
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow7_col4" class="data row7 col4">
+
+ 0.519818
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fb" class="row_heading level4 row8">
+
+ 8
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow8_col0" class="data row8 col0">
+
+ 9.0
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow8_col1" class="data row8 col1">
+
+ 1.686583
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow8_col2" class="data row8 col2">
+
+ -1.325963
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow8_col3" class="data row8 col3">
+
+ 1.428984
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow8_col4" class="data row8 col4">
+
+ -2.089354
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fb" class="row_heading level4 row9">
+
+ 9
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow9_col0" class="data row9 col0">
+
+ 10.0
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow9_col1" class="data row9 col1">
+
+ -0.12982
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow9_col2" class="data row9 col2">
+
+ 0.631523
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow9_col3" class="data row9 col3">
+
+ -0.586538
+
+
+ <td id="T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow9_col4" class="data row9 col4">
+
+ 0.29072
+
+
+ </tr>
+
+ </tbody>
+ </table>
+
+</div>
+
+</div>
+
+</div>
+</div>
+
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<p>There's also <code>.highlight_min</code> and <code>.highlight_max</code>.</p>
+
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing code_cell rendered">
+<div class="input">
+<div class="prompt input_prompt">In [18]:</div>
+<div class="inner_cell">
+ <div class="input_area">
+<div class=" highlight hl-ipython3"><pre><span class="n">df</span><span class="o">.</span><span class="n">style</span><span class="o">.</span><span class="n">highlight_max</span><span class="p">(</span><span class="n">axis</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>
+</pre></div>
+
+</div>
+</div>
+</div>
+
+<div class="output_wrapper">
+<div class="output">
+
+
+<div class="output_area"><div class="prompt output_prompt">Out[18]:</div>
+
+<div class="output_html rendered_html output_subarea output_execute_result">
+
+ <style type="text/css" >
+
+
+ #T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow2_col4 {
+
+ background-color: yellow;
+
+ }
+
+ #T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow6_col2 {
+
+ background-color: yellow;
+
+ }
+
+ #T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow8_col1 {
+
+ background-color: yellow;
+
+ }
+
+ #T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow8_col3 {
+
+ background-color: yellow;
+
+ }
+
+ #T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow9_col0 {
+
+ background-color: yellow;
+
+ }
+
+ </style>
+
+ <table id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fb">
+
+
+ <thead>
+
+ <tr>
+
+ <th class="blank">
+
+ <th class="col_heading level0 col0">A
+
+ <th class="col_heading level0 col1">B
+
+ <th class="col_heading level0 col2">C
+
+ <th class="col_heading level0 col3">D
+
+ <th class="col_heading level0 col4">E
+
+ </tr>
+
+ </thead>
+ <tbody>
+
+ <tr>
+
+ <th id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fb" class="row_heading level4 row0">
+
+ 0
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow0_col0" class="data row0 col0">
+
+ 1.0
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow0_col1" class="data row0 col1">
+
+ 1.329212
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow0_col2" class="data row0 col2">
+
+ nan
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow0_col3" class="data row0 col3">
+
+ -0.31628
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow0_col4" class="data row0 col4">
+
+ -0.99081
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fb" class="row_heading level4 row1">
+
+ 1
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow1_col0" class="data row1 col0">
+
+ 2.0
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow1_col1" class="data row1 col1">
+
+ -1.070816
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow1_col2" class="data row1 col2">
+
+ -1.438713
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow1_col3" class="data row1 col3">
+
+ 0.564417
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow1_col4" class="data row1 col4">
+
+ 0.295722
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fb" class="row_heading level4 row2">
+
+ 2
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow2_col0" class="data row2 col0">
+
+ 3.0
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow2_col1" class="data row2 col1">
+
+ -1.626404
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow2_col2" class="data row2 col2">
+
+ 0.219565
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow2_col3" class="data row2 col3">
+
+ 0.678805
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow2_col4" class="data row2 col4">
+
+ 1.889273
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fb" class="row_heading level4 row3">
+
+ 3
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow3_col0" class="data row3 col0">
+
+ 4.0
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow3_col1" class="data row3 col1">
+
+ 0.961538
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow3_col2" class="data row3 col2">
+
+ 0.104011
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow3_col3" class="data row3 col3">
+
+ -0.481165
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow3_col4" class="data row3 col4">
+
+ 0.850229
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fb" class="row_heading level4 row4">
+
+ 4
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow4_col0" class="data row4 col0">
+
+ 5.0
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow4_col1" class="data row4 col1">
+
+ 1.453425
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow4_col2" class="data row4 col2">
+
+ 1.057737
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow4_col3" class="data row4 col3">
+
+ 0.165562
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow4_col4" class="data row4 col4">
+
+ 0.515018
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fb" class="row_heading level4 row5">
+
+ 5
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow5_col0" class="data row5 col0">
+
+ 6.0
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow5_col1" class="data row5 col1">
+
+ -1.336936
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow5_col2" class="data row5 col2">
+
+ 0.562861
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow5_col3" class="data row5 col3">
+
+ 1.392855
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow5_col4" class="data row5 col4">
+
+ -0.063328
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fb" class="row_heading level4 row6">
+
+ 6
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow6_col0" class="data row6 col0">
+
+ 7.0
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow6_col1" class="data row6 col1">
+
+ 0.121668
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow6_col2" class="data row6 col2">
+
+ 1.207603
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow6_col3" class="data row6 col3">
+
+ -0.00204
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow6_col4" class="data row6 col4">
+
+ 1.627796
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fb" class="row_heading level4 row7">
+
+ 7
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow7_col0" class="data row7 col0">
+
+ 8.0
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow7_col1" class="data row7 col1">
+
+ 0.354493
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow7_col2" class="data row7 col2">
+
+ 1.037528
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow7_col3" class="data row7 col3">
+
+ -0.385684
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow7_col4" class="data row7 col4">
+
+ 0.519818
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fb" class="row_heading level4 row8">
+
+ 8
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow8_col0" class="data row8 col0">
+
+ 9.0
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow8_col1" class="data row8 col1">
+
+ 1.686583
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow8_col2" class="data row8 col2">
+
+ -1.325963
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow8_col3" class="data row8 col3">
+
+ 1.428984
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow8_col4" class="data row8 col4">
+
+ -2.089354
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fb" class="row_heading level4 row9">
+
+ 9
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow9_col0" class="data row9 col0">
+
+ 10.0
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow9_col1" class="data row9 col1">
+
+ -0.12982
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow9_col2" class="data row9 col2">
+
+ 0.631523
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow9_col3" class="data row9 col3">
+
+ -0.586538
+
+
+ <td id="T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow9_col4" class="data row9 col4">
+
+ 0.29072
+
+
+ </tr>
+
+ </tbody>
+ </table>
+
+</div>
+
+</div>
+
+</div>
+</div>
+
+</div>
+<div class="cell border-box-sizing code_cell rendered">
+<div class="input">
+<div class="prompt input_prompt">In [19]:</div>
+<div class="inner_cell">
+ <div class="input_area">
+<div class=" highlight hl-ipython3"><pre><span class="n">df</span><span class="o">.</span><span class="n">style</span><span class="o">.</span><span class="n">highlight_min</span><span class="p">(</span><span class="n">axis</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>
+</pre></div>
+
+</div>
+</div>
+</div>
+
+<div class="output_wrapper">
+<div class="output">
+
+
+<div class="output_area"><div class="prompt output_prompt">Out[19]:</div>
+
+<div class="output_html rendered_html output_subarea output_execute_result">
+
+ <style type="text/css" >
+
+
+ #T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow0_col0 {
+
+ background-color: yellow;
+
+ }
+
+ #T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow1_col2 {
+
+ background-color: yellow;
+
+ }
+
+ #T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow2_col1 {
+
+ background-color: yellow;
+
+ }
+
+ #T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow8_col4 {
+
+ background-color: yellow;
+
+ }
+
+ #T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow9_col3 {
+
+ background-color: yellow;
+
+ }
+
+ </style>
+
+ <table id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fb">
+
+
+ <thead>
+
+ <tr>
+
+ <th class="blank">
+
+ <th class="col_heading level0 col0">A
+
+ <th class="col_heading level0 col1">B
+
+ <th class="col_heading level0 col2">C
+
+ <th class="col_heading level0 col3">D
+
+ <th class="col_heading level0 col4">E
+
+ </tr>
+
+ </thead>
+ <tbody>
+
+ <tr>
+
+ <th id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fb" class="row_heading level4 row0">
+
+ 0
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow0_col0" class="data row0 col0">
+
+ 1.0
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow0_col1" class="data row0 col1">
+
+ 1.329212
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow0_col2" class="data row0 col2">
+
+ nan
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow0_col3" class="data row0 col3">
+
+ -0.31628
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow0_col4" class="data row0 col4">
+
+ -0.99081
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fb" class="row_heading level4 row1">
+
+ 1
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow1_col0" class="data row1 col0">
+
+ 2.0
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow1_col1" class="data row1 col1">
+
+ -1.070816
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow1_col2" class="data row1 col2">
+
+ -1.438713
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow1_col3" class="data row1 col3">
+
+ 0.564417
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow1_col4" class="data row1 col4">
+
+ 0.295722
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fb" class="row_heading level4 row2">
+
+ 2
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow2_col0" class="data row2 col0">
+
+ 3.0
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow2_col1" class="data row2 col1">
+
+ -1.626404
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow2_col2" class="data row2 col2">
+
+ 0.219565
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow2_col3" class="data row2 col3">
+
+ 0.678805
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow2_col4" class="data row2 col4">
+
+ 1.889273
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fb" class="row_heading level4 row3">
+
+ 3
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow3_col0" class="data row3 col0">
+
+ 4.0
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow3_col1" class="data row3 col1">
+
+ 0.961538
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow3_col2" class="data row3 col2">
+
+ 0.104011
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow3_col3" class="data row3 col3">
+
+ -0.481165
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow3_col4" class="data row3 col4">
+
+ 0.850229
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fb" class="row_heading level4 row4">
+
+ 4
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow4_col0" class="data row4 col0">
+
+ 5.0
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow4_col1" class="data row4 col1">
+
+ 1.453425
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow4_col2" class="data row4 col2">
+
+ 1.057737
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow4_col3" class="data row4 col3">
+
+ 0.165562
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow4_col4" class="data row4 col4">
+
+ 0.515018
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fb" class="row_heading level4 row5">
+
+ 5
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow5_col0" class="data row5 col0">
+
+ 6.0
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow5_col1" class="data row5 col1">
+
+ -1.336936
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow5_col2" class="data row5 col2">
+
+ 0.562861
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow5_col3" class="data row5 col3">
+
+ 1.392855
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow5_col4" class="data row5 col4">
+
+ -0.063328
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fb" class="row_heading level4 row6">
+
+ 6
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow6_col0" class="data row6 col0">
+
+ 7.0
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow6_col1" class="data row6 col1">
+
+ 0.121668
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow6_col2" class="data row6 col2">
+
+ 1.207603
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow6_col3" class="data row6 col3">
+
+ -0.00204
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow6_col4" class="data row6 col4">
+
+ 1.627796
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fb" class="row_heading level4 row7">
+
+ 7
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow7_col0" class="data row7 col0">
+
+ 8.0
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow7_col1" class="data row7 col1">
+
+ 0.354493
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow7_col2" class="data row7 col2">
+
+ 1.037528
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow7_col3" class="data row7 col3">
+
+ -0.385684
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow7_col4" class="data row7 col4">
+
+ 0.519818
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fb" class="row_heading level4 row8">
+
+ 8
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow8_col0" class="data row8 col0">
+
+ 9.0
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow8_col1" class="data row8 col1">
+
+ 1.686583
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow8_col2" class="data row8 col2">
+
+ -1.325963
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow8_col3" class="data row8 col3">
+
+ 1.428984
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow8_col4" class="data row8 col4">
+
+ -2.089354
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fb" class="row_heading level4 row9">
+
+ 9
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow9_col0" class="data row9 col0">
+
+ 10.0
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow9_col1" class="data row9 col1">
+
+ -0.12982
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow9_col2" class="data row9 col2">
+
+ 0.631523
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow9_col3" class="data row9 col3">
+
+ -0.586538
+
+
+ <td id="T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow9_col4" class="data row9 col4">
+
+ 0.29072
+
+
+ </tr>
+
+ </tbody>
+ </table>
+
+</div>
+
+</div>
+
+</div>
+</div>
+
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<p>Use <code>Styler.set_properties</code> when the style doesn't actually depend on the values.</p>
+
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing code_cell rendered">
+<div class="input">
+<div class="prompt input_prompt">In [20]:</div>
+<div class="inner_cell">
+ <div class="input_area">
+<div class=" highlight hl-ipython3"><pre><span class="n">df</span><span class="o">.</span><span class="n">style</span><span class="o">.</span><span class="n">set_properties</span><span class="p">(</span><span class="o">**</span><span class="p">{</span><span class="s">'background-color'</span><span class="p">:</span> <span class="s">'black'</span><span class="p">,</span>
+ <span class="s">'color'</span><span class="p">:</span> <span class="s">'lawngreen'</span><span class="p">,</span>
+ <span class="s">'border-color'</span><span class="p">:</span> <span class="s">'white'</span><span class="p">})</span>
+</pre></div>
+
+</div>
+</div>
+</div>
+
+<div class="output_wrapper">
+<div class="output">
+
+
+<div class="output_area"><div class="prompt output_prompt">Out[20]:</div>
+
+<div class="output_html rendered_html output_subarea output_execute_result">
+
+ <style type="text/css" >
+
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow0_col0 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow0_col1 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow0_col2 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow0_col3 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow0_col4 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow1_col0 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow1_col1 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow1_col2 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow1_col3 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow1_col4 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow2_col0 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow2_col1 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow2_col2 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow2_col3 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow2_col4 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow3_col0 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow3_col1 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow3_col2 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow3_col3 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow3_col4 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow4_col0 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow4_col1 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow4_col2 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow4_col3 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow4_col4 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow5_col0 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow5_col1 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow5_col2 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow5_col3 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow5_col4 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow6_col0 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow6_col1 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow6_col2 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow6_col3 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow6_col4 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow7_col0 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow7_col1 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow7_col2 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow7_col3 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow7_col4 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow8_col0 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow8_col1 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow8_col2 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow8_col3 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow8_col4 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow9_col0 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow9_col1 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow9_col2 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow9_col3 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow9_col4 {
+
+ color: lawngreen;
+
+ background-color: black;
+
+ border-color: white;
+
+ }
+
+ </style>
+
+ <table id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fb">
+
+
+ <thead>
+
+ <tr>
+
+ <th class="blank">
+
+ <th class="col_heading level0 col0">A
+
+ <th class="col_heading level0 col1">B
+
+ <th class="col_heading level0 col2">C
+
+ <th class="col_heading level0 col3">D
+
+ <th class="col_heading level0 col4">E
+
+ </tr>
+
+ </thead>
+ <tbody>
+
+ <tr>
+
+ <th id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fb" class="row_heading level4 row0">
+
+ 0
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow0_col0" class="data row0 col0">
+
+ 1.0
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow0_col1" class="data row0 col1">
+
+ 1.329212
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow0_col2" class="data row0 col2">
+
+ nan
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow0_col3" class="data row0 col3">
+
+ -0.31628
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow0_col4" class="data row0 col4">
+
+ -0.99081
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fb" class="row_heading level4 row1">
+
+ 1
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow1_col0" class="data row1 col0">
+
+ 2.0
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow1_col1" class="data row1 col1">
+
+ -1.070816
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow1_col2" class="data row1 col2">
+
+ -1.438713
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow1_col3" class="data row1 col3">
+
+ 0.564417
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow1_col4" class="data row1 col4">
+
+ 0.295722
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fb" class="row_heading level4 row2">
+
+ 2
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow2_col0" class="data row2 col0">
+
+ 3.0
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow2_col1" class="data row2 col1">
+
+ -1.626404
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow2_col2" class="data row2 col2">
+
+ 0.219565
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow2_col3" class="data row2 col3">
+
+ 0.678805
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow2_col4" class="data row2 col4">
+
+ 1.889273
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fb" class="row_heading level4 row3">
+
+ 3
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow3_col0" class="data row3 col0">
+
+ 4.0
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow3_col1" class="data row3 col1">
+
+ 0.961538
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow3_col2" class="data row3 col2">
+
+ 0.104011
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow3_col3" class="data row3 col3">
+
+ -0.481165
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow3_col4" class="data row3 col4">
+
+ 0.850229
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fb" class="row_heading level4 row4">
+
+ 4
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow4_col0" class="data row4 col0">
+
+ 5.0
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow4_col1" class="data row4 col1">
+
+ 1.453425
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow4_col2" class="data row4 col2">
+
+ 1.057737
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow4_col3" class="data row4 col3">
+
+ 0.165562
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow4_col4" class="data row4 col4">
+
+ 0.515018
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fb" class="row_heading level4 row5">
+
+ 5
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow5_col0" class="data row5 col0">
+
+ 6.0
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow5_col1" class="data row5 col1">
+
+ -1.336936
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow5_col2" class="data row5 col2">
+
+ 0.562861
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow5_col3" class="data row5 col3">
+
+ 1.392855
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow5_col4" class="data row5 col4">
+
+ -0.063328
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fb" class="row_heading level4 row6">
+
+ 6
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow6_col0" class="data row6 col0">
+
+ 7.0
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow6_col1" class="data row6 col1">
+
+ 0.121668
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow6_col2" class="data row6 col2">
+
+ 1.207603
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow6_col3" class="data row6 col3">
+
+ -0.00204
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow6_col4" class="data row6 col4">
+
+ 1.627796
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fb" class="row_heading level4 row7">
+
+ 7
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow7_col0" class="data row7 col0">
+
+ 8.0
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow7_col1" class="data row7 col1">
+
+ 0.354493
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow7_col2" class="data row7 col2">
+
+ 1.037528
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow7_col3" class="data row7 col3">
+
+ -0.385684
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow7_col4" class="data row7 col4">
+
+ 0.519818
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fb" class="row_heading level4 row8">
+
+ 8
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow8_col0" class="data row8 col0">
+
+ 9.0
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow8_col1" class="data row8 col1">
+
+ 1.686583
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow8_col2" class="data row8 col2">
+
+ -1.325963
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow8_col3" class="data row8 col3">
+
+ 1.428984
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow8_col4" class="data row8 col4">
+
+ -2.089354
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fb" class="row_heading level4 row9">
+
+ 9
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow9_col0" class="data row9 col0">
+
+ 10.0
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow9_col1" class="data row9 col1">
+
+ -0.12982
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow9_col2" class="data row9 col2">
+
+ 0.631523
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow9_col3" class="data row9 col3">
+
+ -0.586538
+
+
+ <td id="T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow9_col4" class="data row9 col4">
+
+ 0.29072
+
+
+ </tr>
+
+ </tbody>
+ </table>
+
+</div>
+
+</div>
+
+</div>
+</div>
+
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<h2 id="Sharing-Styles">Sharing Styles<a class="anchor-link" href="#Sharing-Styles">¶</a></h2>
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<p>Say you have a lovely style built up for a DataFrame, and now you want to apply the same style to a second DataFrame. Export the style with <code>df1.style.export</code>, and import it on the second DataFrame with <code>df1.style.set</code></p>
+
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing code_cell rendered">
+<div class="input">
+<div class="prompt input_prompt">In [21]:</div>
+<div class="inner_cell">
+ <div class="input_area">
+<div class=" highlight hl-ipython3"><pre><span class="n">df2</span> <span class="o">=</span> <span class="o">-</span><span class="n">df</span>
+<span class="n">style1</span> <span class="o">=</span> <span class="n">df</span><span class="o">.</span><span class="n">style</span><span class="o">.</span><span class="n">applymap</span><span class="p">(</span><span class="n">color_negative_red</span><span class="p">)</span>
+<span class="n">style1</span>
+</pre></div>
+
+</div>
+</div>
+</div>
+
+<div class="output_wrapper">
+<div class="output">
+
+
+<div class="output_area"><div class="prompt output_prompt">Out[21]:</div>
+
+<div class="output_html rendered_html output_subarea output_execute_result">
+
+ <style type="text/css" >
+
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow0_col0 {
+
+ color: black;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow0_col1 {
+
+ color: black;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow0_col2 {
+
+ color: black;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow0_col3 {
+
+ color: red;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow0_col4 {
+
+ color: red;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow1_col0 {
+
+ color: black;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow1_col1 {
+
+ color: red;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow1_col2 {
+
+ color: red;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow1_col3 {
+
+ color: black;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow1_col4 {
+
+ color: black;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow2_col0 {
+
+ color: black;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow2_col1 {
+
+ color: red;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow2_col2 {
+
+ color: black;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow2_col3 {
+
+ color: black;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow2_col4 {
+
+ color: black;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow3_col0 {
+
+ color: black;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow3_col1 {
+
+ color: black;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow3_col2 {
+
+ color: black;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow3_col3 {
+
+ color: red;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow3_col4 {
+
+ color: black;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow4_col0 {
+
+ color: black;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow4_col1 {
+
+ color: black;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow4_col2 {
+
+ color: black;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow4_col3 {
+
+ color: black;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow4_col4 {
+
+ color: black;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow5_col0 {
+
+ color: black;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow5_col1 {
+
+ color: red;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow5_col2 {
+
+ color: black;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow5_col3 {
+
+ color: black;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow5_col4 {
+
+ color: red;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow6_col0 {
+
+ color: black;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow6_col1 {
+
+ color: black;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow6_col2 {
+
+ color: black;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow6_col3 {
+
+ color: red;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow6_col4 {
+
+ color: black;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow7_col0 {
+
+ color: black;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow7_col1 {
+
+ color: black;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow7_col2 {
+
+ color: black;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow7_col3 {
+
+ color: red;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow7_col4 {
+
+ color: black;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow8_col0 {
+
+ color: black;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow8_col1 {
+
+ color: black;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow8_col2 {
+
+ color: red;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow8_col3 {
+
+ color: black;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow8_col4 {
+
+ color: red;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow9_col0 {
+
+ color: black;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow9_col1 {
+
+ color: red;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow9_col2 {
+
+ color: black;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow9_col3 {
+
+ color: red;
+
+ }
+
+ #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow9_col4 {
+
+ color: black;
+
+ }
+
+ </style>
+
+ <table id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fb">
+
+
+ <thead>
+
+ <tr>
+
+ <th class="blank">
+
+ <th class="col_heading level0 col0">A
+
+ <th class="col_heading level0 col1">B
+
+ <th class="col_heading level0 col2">C
+
+ <th class="col_heading level0 col3">D
+
+ <th class="col_heading level0 col4">E
+
+ </tr>
+
+ </thead>
+ <tbody>
+
+ <tr>
+
+ <th id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fb" class="row_heading level4 row0">
+
+ 0
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow0_col0" class="data row0 col0">
+
+ 1.0
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow0_col1" class="data row0 col1">
+
+ 1.329212
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow0_col2" class="data row0 col2">
+
+ nan
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow0_col3" class="data row0 col3">
+
+ -0.31628
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow0_col4" class="data row0 col4">
+
+ -0.99081
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fb" class="row_heading level4 row1">
+
+ 1
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow1_col0" class="data row1 col0">
+
+ 2.0
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow1_col1" class="data row1 col1">
+
+ -1.070816
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow1_col2" class="data row1 col2">
+
+ -1.438713
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow1_col3" class="data row1 col3">
+
+ 0.564417
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow1_col4" class="data row1 col4">
+
+ 0.295722
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fb" class="row_heading level4 row2">
+
+ 2
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow2_col0" class="data row2 col0">
+
+ 3.0
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow2_col1" class="data row2 col1">
+
+ -1.626404
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow2_col2" class="data row2 col2">
+
+ 0.219565
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow2_col3" class="data row2 col3">
+
+ 0.678805
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow2_col4" class="data row2 col4">
+
+ 1.889273
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fb" class="row_heading level4 row3">
+
+ 3
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow3_col0" class="data row3 col0">
+
+ 4.0
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow3_col1" class="data row3 col1">
+
+ 0.961538
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow3_col2" class="data row3 col2">
+
+ 0.104011
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow3_col3" class="data row3 col3">
+
+ -0.481165
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow3_col4" class="data row3 col4">
+
+ 0.850229
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fb" class="row_heading level4 row4">
+
+ 4
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow4_col0" class="data row4 col0">
+
+ 5.0
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow4_col1" class="data row4 col1">
+
+ 1.453425
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow4_col2" class="data row4 col2">
+
+ 1.057737
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow4_col3" class="data row4 col3">
+
+ 0.165562
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow4_col4" class="data row4 col4">
+
+ 0.515018
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fb" class="row_heading level4 row5">
+
+ 5
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow5_col0" class="data row5 col0">
+
+ 6.0
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow5_col1" class="data row5 col1">
+
+ -1.336936
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow5_col2" class="data row5 col2">
+
+ 0.562861
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow5_col3" class="data row5 col3">
+
+ 1.392855
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow5_col4" class="data row5 col4">
+
+ -0.063328
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fb" class="row_heading level4 row6">
+
+ 6
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow6_col0" class="data row6 col0">
+
+ 7.0
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow6_col1" class="data row6 col1">
+
+ 0.121668
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow6_col2" class="data row6 col2">
+
+ 1.207603
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow6_col3" class="data row6 col3">
+
+ -0.00204
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow6_col4" class="data row6 col4">
+
+ 1.627796
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fb" class="row_heading level4 row7">
+
+ 7
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow7_col0" class="data row7 col0">
+
+ 8.0
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow7_col1" class="data row7 col1">
+
+ 0.354493
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow7_col2" class="data row7 col2">
+
+ 1.037528
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow7_col3" class="data row7 col3">
+
+ -0.385684
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow7_col4" class="data row7 col4">
+
+ 0.519818
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fb" class="row_heading level4 row8">
+
+ 8
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow8_col0" class="data row8 col0">
+
+ 9.0
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow8_col1" class="data row8 col1">
+
+ 1.686583
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow8_col2" class="data row8 col2">
+
+ -1.325963
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow8_col3" class="data row8 col3">
+
+ 1.428984
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow8_col4" class="data row8 col4">
+
+ -2.089354
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fb" class="row_heading level4 row9">
+
+ 9
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow9_col0" class="data row9 col0">
+
+ 10.0
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow9_col1" class="data row9 col1">
+
+ -0.12982
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow9_col2" class="data row9 col2">
+
+ 0.631523
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow9_col3" class="data row9 col3">
+
+ -0.586538
+
+
+ <td id="T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow9_col4" class="data row9 col4">
+
+ 0.29072
+
+
+ </tr>
+
+ </tbody>
+ </table>
+
+</div>
+
+</div>
+
+</div>
+</div>
+
+</div>
+<div class="cell border-box-sizing code_cell rendered">
+<div class="input">
+<div class="prompt input_prompt">In [22]:</div>
+<div class="inner_cell">
+ <div class="input_area">
+<div class=" highlight hl-ipython3"><pre><span class="n">style2</span> <span class="o">=</span> <span class="n">df2</span><span class="o">.</span><span class="n">style</span>
+<span class="n">style2</span><span class="o">.</span><span class="n">use</span><span class="p">(</span><span class="n">style1</span><span class="o">.</span><span class="n">export</span><span class="p">())</span>
+<span class="n">style2</span>
+</pre></div>
+
+</div>
+</div>
+</div>
+
+<div class="output_wrapper">
+<div class="output">
+
+
+<div class="output_area"><div class="prompt output_prompt">Out[22]:</div>
+
+<div class="output_html rendered_html output_subarea output_execute_result">
+
+ <style type="text/css" >
+
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow0_col0 {
+
+ color: red;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow0_col1 {
+
+ color: red;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow0_col2 {
+
+ color: black;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow0_col3 {
+
+ color: black;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow0_col4 {
+
+ color: black;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow1_col0 {
+
+ color: red;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow1_col1 {
+
+ color: black;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow1_col2 {
+
+ color: black;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow1_col3 {
+
+ color: red;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow1_col4 {
+
+ color: red;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow2_col0 {
+
+ color: red;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow2_col1 {
+
+ color: black;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow2_col2 {
+
+ color: red;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow2_col3 {
+
+ color: red;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow2_col4 {
+
+ color: red;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow3_col0 {
+
+ color: red;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow3_col1 {
+
+ color: red;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow3_col2 {
+
+ color: red;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow3_col3 {
+
+ color: black;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow3_col4 {
+
+ color: red;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow4_col0 {
+
+ color: red;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow4_col1 {
+
+ color: red;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow4_col2 {
+
+ color: red;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow4_col3 {
+
+ color: red;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow4_col4 {
+
+ color: red;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow5_col0 {
+
+ color: red;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow5_col1 {
+
+ color: black;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow5_col2 {
+
+ color: red;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow5_col3 {
+
+ color: red;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow5_col4 {
+
+ color: black;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow6_col0 {
+
+ color: red;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow6_col1 {
+
+ color: red;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow6_col2 {
+
+ color: red;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow6_col3 {
+
+ color: black;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow6_col4 {
+
+ color: red;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow7_col0 {
+
+ color: red;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow7_col1 {
+
+ color: red;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow7_col2 {
+
+ color: red;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow7_col3 {
+
+ color: black;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow7_col4 {
+
+ color: red;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow8_col0 {
+
+ color: red;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow8_col1 {
+
+ color: red;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow8_col2 {
+
+ color: black;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow8_col3 {
+
+ color: red;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow8_col4 {
+
+ color: black;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow9_col0 {
+
+ color: red;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow9_col1 {
+
+ color: black;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow9_col2 {
+
+ color: red;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow9_col3 {
+
+ color: black;
+
+ }
+
+ #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow9_col4 {
+
+ color: red;
+
+ }
+
+ </style>
+
+ <table id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fb">
+
+
+ <thead>
+
+ <tr>
+
+ <th class="blank">
+
+ <th class="col_heading level0 col0">A
+
+ <th class="col_heading level0 col1">B
+
+ <th class="col_heading level0 col2">C
+
+ <th class="col_heading level0 col3">D
+
+ <th class="col_heading level0 col4">E
+
+ </tr>
+
+ </thead>
+ <tbody>
+
+ <tr>
+
+ <th id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fb" class="row_heading level4 row0">
+
+ 0
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow0_col0" class="data row0 col0">
+
+ -1.0
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow0_col1" class="data row0 col1">
+
+ -1.329212
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow0_col2" class="data row0 col2">
+
+ nan
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow0_col3" class="data row0 col3">
+
+ 0.31628
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow0_col4" class="data row0 col4">
+
+ 0.99081
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fb" class="row_heading level4 row1">
+
+ 1
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow1_col0" class="data row1 col0">
+
+ -2.0
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow1_col1" class="data row1 col1">
+
+ 1.070816
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow1_col2" class="data row1 col2">
+
+ 1.438713
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow1_col3" class="data row1 col3">
+
+ -0.564417
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow1_col4" class="data row1 col4">
+
+ -0.295722
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fb" class="row_heading level4 row2">
+
+ 2
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow2_col0" class="data row2 col0">
+
+ -3.0
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow2_col1" class="data row2 col1">
+
+ 1.626404
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow2_col2" class="data row2 col2">
+
+ -0.219565
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow2_col3" class="data row2 col3">
+
+ -0.678805
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow2_col4" class="data row2 col4">
+
+ -1.889273
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fb" class="row_heading level4 row3">
+
+ 3
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow3_col0" class="data row3 col0">
+
+ -4.0
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow3_col1" class="data row3 col1">
+
+ -0.961538
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow3_col2" class="data row3 col2">
+
+ -0.104011
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow3_col3" class="data row3 col3">
+
+ 0.481165
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow3_col4" class="data row3 col4">
+
+ -0.850229
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fb" class="row_heading level4 row4">
+
+ 4
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow4_col0" class="data row4 col0">
+
+ -5.0
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow4_col1" class="data row4 col1">
+
+ -1.453425
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow4_col2" class="data row4 col2">
+
+ -1.057737
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow4_col3" class="data row4 col3">
+
+ -0.165562
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow4_col4" class="data row4 col4">
+
+ -0.515018
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fb" class="row_heading level4 row5">
+
+ 5
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow5_col0" class="data row5 col0">
+
+ -6.0
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow5_col1" class="data row5 col1">
+
+ 1.336936
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow5_col2" class="data row5 col2">
+
+ -0.562861
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow5_col3" class="data row5 col3">
+
+ -1.392855
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow5_col4" class="data row5 col4">
+
+ 0.063328
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fb" class="row_heading level4 row6">
+
+ 6
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow6_col0" class="data row6 col0">
+
+ -7.0
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow6_col1" class="data row6 col1">
+
+ -0.121668
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow6_col2" class="data row6 col2">
+
+ -1.207603
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow6_col3" class="data row6 col3">
+
+ 0.00204
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow6_col4" class="data row6 col4">
+
+ -1.627796
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fb" class="row_heading level4 row7">
+
+ 7
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow7_col0" class="data row7 col0">
+
+ -8.0
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow7_col1" class="data row7 col1">
+
+ -0.354493
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow7_col2" class="data row7 col2">
+
+ -1.037528
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow7_col3" class="data row7 col3">
+
+ 0.385684
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow7_col4" class="data row7 col4">
+
+ -0.519818
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fb" class="row_heading level4 row8">
+
+ 8
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow8_col0" class="data row8 col0">
+
+ -9.0
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow8_col1" class="data row8 col1">
+
+ -1.686583
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow8_col2" class="data row8 col2">
+
+ 1.325963
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow8_col3" class="data row8 col3">
+
+ -1.428984
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow8_col4" class="data row8 col4">
+
+ 2.089354
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fb" class="row_heading level4 row9">
+
+ 9
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow9_col0" class="data row9 col0">
+
+ -10.0
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow9_col1" class="data row9 col1">
+
+ 0.12982
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow9_col2" class="data row9 col2">
+
+ -0.631523
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow9_col3" class="data row9 col3">
+
+ 0.586538
+
+
+ <td id="T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow9_col4" class="data row9 col4">
+
+ -0.29072
+
+
+ </tr>
+
+ </tbody>
+ </table>
+
+</div>
+
+</div>
+
+</div>
+</div>
+
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<h2 id="Other-options">Other options<a class="anchor-link" href="#Other-options">¶</a></h2><p>You've seen a few methods for data-driven styling.
+<code>Styler</code> also provides a few other options for styles that don't depend on the data.</p>
+<ul>
+<li>precision</li>
+<li>captions</li>
+<li>table-wide styles</li>
+</ul>
+<p>Each of these can be specified in two ways:</p>
+<ul>
+<li>A keyword argument to <code>pandas.core.Styler</code></li>
+<li>A call to one of the <code>.set_</code> methods, e.g. <code>.set_caption</code></li>
+</ul>
+<p>The best method to use depends on the context. Use the <code>Styler</code> constructor when building many styled DataFrames that should all share the same properties. For interactive use, the<code>.set_</code> methods are more convenient.</p>
+
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<h2 id="Precision">Precision<a class="anchor-link" href="#Precision">¶</a></h2>
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<p>You can control the precision of floats using pandas' regular <code>display.precision</code> option.</p>
+
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing code_cell rendered">
+<div class="input">
+<div class="prompt input_prompt">In [23]:</div>
+<div class="inner_cell">
+ <div class="input_area">
+<div class=" highlight hl-ipython3"><pre><span class="k">with</span> <span class="n">pd</span><span class="o">.</span><span class="n">option_context</span><span class="p">(</span><span class="s">'display.precision'</span><span class="p">,</span> <span class="mi">2</span><span class="p">):</span>
+ <span class="n">html</span> <span class="o">=</span> <span class="p">(</span><span class="n">df</span><span class="o">.</span><span class="n">style</span>
+ <span class="o">.</span><span class="n">applymap</span><span class="p">(</span><span class="n">color_negative_red</span><span class="p">)</span>
+ <span class="o">.</span><span class="n">apply</span><span class="p">(</span><span class="n">highlight_max</span><span class="p">))</span>
+<span class="n">html</span>
+</pre></div>
+
+</div>
+</div>
+</div>
+
+<div class="output_wrapper">
+<div class="output">
+
+
+<div class="output_area"><div class="prompt output_prompt">Out[23]:</div>
+
+<div class="output_html rendered_html output_subarea output_execute_result">
+
+ <style type="text/css" >
+
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow0_col0 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow0_col1 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow0_col2 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow0_col3 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow0_col4 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow1_col0 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow1_col1 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow1_col2 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow1_col3 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow1_col4 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow2_col0 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow2_col1 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow2_col2 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow2_col3 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow2_col4 {
+
+ color: black;
+
+ background-color: yellow;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow3_col0 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow3_col1 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow3_col2 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow3_col3 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow3_col4 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow4_col0 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow4_col1 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow4_col2 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow4_col3 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow4_col4 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow5_col0 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow5_col1 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow5_col2 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow5_col3 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow5_col4 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow6_col0 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow6_col1 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow6_col2 {
+
+ color: black;
+
+ background-color: yellow;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow6_col3 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow6_col4 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow7_col0 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow7_col1 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow7_col2 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow7_col3 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow7_col4 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow8_col0 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow8_col1 {
+
+ color: black;
+
+ background-color: yellow;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow8_col2 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow8_col3 {
+
+ color: black;
+
+ background-color: yellow;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow8_col4 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow9_col0 {
+
+ color: black;
+
+ background-color: yellow;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow9_col1 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow9_col2 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow9_col3 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow9_col4 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ </style>
+
+ <table id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fb">
+
+
+ <thead>
+
+ <tr>
+
+ <th class="blank">
+
+ <th class="col_heading level0 col0">A
+
+ <th class="col_heading level0 col1">B
+
+ <th class="col_heading level0 col2">C
+
+ <th class="col_heading level0 col3">D
+
+ <th class="col_heading level0 col4">E
+
+ </tr>
+
+ </thead>
+ <tbody>
+
+ <tr>
+
+ <th id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fb" class="row_heading level4 row0">
+
+ 0
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow0_col0" class="data row0 col0">
+
+ 1.0
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow0_col1" class="data row0 col1">
+
+ 1.33
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow0_col2" class="data row0 col2">
+
+ nan
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow0_col3" class="data row0 col3">
+
+ -0.32
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow0_col4" class="data row0 col4">
+
+ -0.99
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fb" class="row_heading level4 row1">
+
+ 1
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow1_col0" class="data row1 col0">
+
+ 2.0
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow1_col1" class="data row1 col1">
+
+ -1.07
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow1_col2" class="data row1 col2">
+
+ -1.44
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow1_col3" class="data row1 col3">
+
+ 0.56
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow1_col4" class="data row1 col4">
+
+ 0.3
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fb" class="row_heading level4 row2">
+
+ 2
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow2_col0" class="data row2 col0">
+
+ 3.0
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow2_col1" class="data row2 col1">
+
+ -1.63
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow2_col2" class="data row2 col2">
+
+ 0.22
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow2_col3" class="data row2 col3">
+
+ 0.68
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow2_col4" class="data row2 col4">
+
+ 1.89
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fb" class="row_heading level4 row3">
+
+ 3
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow3_col0" class="data row3 col0">
+
+ 4.0
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow3_col1" class="data row3 col1">
+
+ 0.96
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow3_col2" class="data row3 col2">
+
+ 0.1
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow3_col3" class="data row3 col3">
+
+ -0.48
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow3_col4" class="data row3 col4">
+
+ 0.85
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fb" class="row_heading level4 row4">
+
+ 4
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow4_col0" class="data row4 col0">
+
+ 5.0
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow4_col1" class="data row4 col1">
+
+ 1.45
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow4_col2" class="data row4 col2">
+
+ 1.06
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow4_col3" class="data row4 col3">
+
+ 0.17
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow4_col4" class="data row4 col4">
+
+ 0.52
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fb" class="row_heading level4 row5">
+
+ 5
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow5_col0" class="data row5 col0">
+
+ 6.0
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow5_col1" class="data row5 col1">
+
+ -1.34
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow5_col2" class="data row5 col2">
+
+ 0.56
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow5_col3" class="data row5 col3">
+
+ 1.39
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow5_col4" class="data row5 col4">
+
+ -0.06
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fb" class="row_heading level4 row6">
+
+ 6
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow6_col0" class="data row6 col0">
+
+ 7.0
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow6_col1" class="data row6 col1">
+
+ 0.12
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow6_col2" class="data row6 col2">
+
+ 1.21
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow6_col3" class="data row6 col3">
+
+ -0.0
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow6_col4" class="data row6 col4">
+
+ 1.63
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fb" class="row_heading level4 row7">
+
+ 7
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow7_col0" class="data row7 col0">
+
+ 8.0
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow7_col1" class="data row7 col1">
+
+ 0.35
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow7_col2" class="data row7 col2">
+
+ 1.04
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow7_col3" class="data row7 col3">
+
+ -0.39
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow7_col4" class="data row7 col4">
+
+ 0.52
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fb" class="row_heading level4 row8">
+
+ 8
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow8_col0" class="data row8 col0">
+
+ 9.0
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow8_col1" class="data row8 col1">
+
+ 1.69
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow8_col2" class="data row8 col2">
+
+ -1.33
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow8_col3" class="data row8 col3">
+
+ 1.43
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow8_col4" class="data row8 col4">
+
+ -2.09
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fb" class="row_heading level4 row9">
+
+ 9
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow9_col0" class="data row9 col0">
+
+ 10.0
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow9_col1" class="data row9 col1">
+
+ -0.13
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow9_col2" class="data row9 col2">
+
+ 0.63
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow9_col3" class="data row9 col3">
+
+ -0.59
+
+
+ <td id="T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow9_col4" class="data row9 col4">
+
+ 0.29
+
+
+ </tr>
+
+ </tbody>
+ </table>
+
+</div>
+
+</div>
+
+</div>
+</div>
+
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<p>Or through a <code>set_precision</code> method.</p>
+
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing code_cell rendered">
+<div class="input">
+<div class="prompt input_prompt">In [24]:</div>
+<div class="inner_cell">
+ <div class="input_area">
+<div class=" highlight hl-ipython3"><pre><span class="n">df</span><span class="o">.</span><span class="n">style</span>\
+ <span class="o">.</span><span class="n">applymap</span><span class="p">(</span><span class="n">color_negative_red</span><span class="p">)</span>\
+ <span class="o">.</span><span class="n">apply</span><span class="p">(</span><span class="n">highlight_max</span><span class="p">)</span>\
+ <span class="o">.</span><span class="n">set_precision</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span>
+</pre></div>
+
+</div>
+</div>
+</div>
+
+<div class="output_wrapper">
+<div class="output">
+
+
+<div class="output_area"><div class="prompt output_prompt">Out[24]:</div>
+
+<div class="output_html rendered_html output_subarea output_execute_result">
+
+ <style type="text/css" >
+
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow0_col0 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow0_col1 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow0_col2 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow0_col3 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow0_col4 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow1_col0 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow1_col1 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow1_col2 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow1_col3 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow1_col4 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow2_col0 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow2_col1 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow2_col2 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow2_col3 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow2_col4 {
+
+ color: black;
+
+ background-color: yellow;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow3_col0 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow3_col1 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow3_col2 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow3_col3 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow3_col4 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow4_col0 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow4_col1 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow4_col2 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow4_col3 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow4_col4 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow5_col0 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow5_col1 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow5_col2 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow5_col3 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow5_col4 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow6_col0 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow6_col1 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow6_col2 {
+
+ color: black;
+
+ background-color: yellow;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow6_col3 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow6_col4 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow7_col0 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow7_col1 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow7_col2 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow7_col3 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow7_col4 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow8_col0 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow8_col1 {
+
+ color: black;
+
+ background-color: yellow;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow8_col2 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow8_col3 {
+
+ color: black;
+
+ background-color: yellow;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow8_col4 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow9_col0 {
+
+ color: black;
+
+ background-color: yellow;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow9_col1 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow9_col2 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow9_col3 {
+
+ color: red;
+
+ : ;
+
+ }
+
+ #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow9_col4 {
+
+ color: black;
+
+ : ;
+
+ }
+
+ </style>
+
+ <table id="T_e8394654_8bd5_11e5_b698_a45e60bd97fb">
+
+
+ <thead>
+
+ <tr>
+
+ <th class="blank">
+
+ <th class="col_heading level0 col0">A
+
+ <th class="col_heading level0 col1">B
+
+ <th class="col_heading level0 col2">C
+
+ <th class="col_heading level0 col3">D
+
+ <th class="col_heading level0 col4">E
+
+ </tr>
+
+ </thead>
+ <tbody>
+
+ <tr>
+
+ <th id="T_e8394654_8bd5_11e5_b698_a45e60bd97fb" class="row_heading level4 row0">
+
+ 0
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow0_col0" class="data row0 col0">
+
+ 1.0
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow0_col1" class="data row0 col1">
+
+ 1.33
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow0_col2" class="data row0 col2">
+
+ nan
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow0_col3" class="data row0 col3">
+
+ -0.32
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow0_col4" class="data row0 col4">
+
+ -0.99
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8394654_8bd5_11e5_b698_a45e60bd97fb" class="row_heading level4 row1">
+
+ 1
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow1_col0" class="data row1 col0">
+
+ 2.0
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow1_col1" class="data row1 col1">
+
+ -1.07
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow1_col2" class="data row1 col2">
+
+ -1.44
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow1_col3" class="data row1 col3">
+
+ 0.56
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow1_col4" class="data row1 col4">
+
+ 0.3
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8394654_8bd5_11e5_b698_a45e60bd97fb" class="row_heading level4 row2">
+
+ 2
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow2_col0" class="data row2 col0">
+
+ 3.0
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow2_col1" class="data row2 col1">
+
+ -1.63
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow2_col2" class="data row2 col2">
+
+ 0.22
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow2_col3" class="data row2 col3">
+
+ 0.68
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow2_col4" class="data row2 col4">
+
+ 1.89
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8394654_8bd5_11e5_b698_a45e60bd97fb" class="row_heading level4 row3">
+
+ 3
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow3_col0" class="data row3 col0">
+
+ 4.0
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow3_col1" class="data row3 col1">
+
+ 0.96
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow3_col2" class="data row3 col2">
+
+ 0.1
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow3_col3" class="data row3 col3">
+
+ -0.48
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow3_col4" class="data row3 col4">
+
+ 0.85
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8394654_8bd5_11e5_b698_a45e60bd97fb" class="row_heading level4 row4">
+
+ 4
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow4_col0" class="data row4 col0">
+
+ 5.0
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow4_col1" class="data row4 col1">
+
+ 1.45
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow4_col2" class="data row4 col2">
+
+ 1.06
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow4_col3" class="data row4 col3">
+
+ 0.17
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow4_col4" class="data row4 col4">
+
+ 0.52
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8394654_8bd5_11e5_b698_a45e60bd97fb" class="row_heading level4 row5">
+
+ 5
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow5_col0" class="data row5 col0">
+
+ 6.0
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow5_col1" class="data row5 col1">
+
+ -1.34
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow5_col2" class="data row5 col2">
+
+ 0.56
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow5_col3" class="data row5 col3">
+
+ 1.39
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow5_col4" class="data row5 col4">
+
+ -0.06
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8394654_8bd5_11e5_b698_a45e60bd97fb" class="row_heading level4 row6">
+
+ 6
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow6_col0" class="data row6 col0">
+
+ 7.0
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow6_col1" class="data row6 col1">
+
+ 0.12
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow6_col2" class="data row6 col2">
+
+ 1.21
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow6_col3" class="data row6 col3">
+
+ -0.0
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow6_col4" class="data row6 col4">
+
+ 1.63
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8394654_8bd5_11e5_b698_a45e60bd97fb" class="row_heading level4 row7">
+
+ 7
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow7_col0" class="data row7 col0">
+
+ 8.0
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow7_col1" class="data row7 col1">
+
+ 0.35
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow7_col2" class="data row7 col2">
+
+ 1.04
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow7_col3" class="data row7 col3">
+
+ -0.39
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow7_col4" class="data row7 col4">
+
+ 0.52
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8394654_8bd5_11e5_b698_a45e60bd97fb" class="row_heading level4 row8">
+
+ 8
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow8_col0" class="data row8 col0">
+
+ 9.0
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow8_col1" class="data row8 col1">
+
+ 1.69
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow8_col2" class="data row8 col2">
+
+ -1.33
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow8_col3" class="data row8 col3">
+
+ 1.43
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow8_col4" class="data row8 col4">
+
+ -2.09
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8394654_8bd5_11e5_b698_a45e60bd97fb" class="row_heading level4 row9">
+
+ 9
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow9_col0" class="data row9 col0">
+
+ 10.0
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow9_col1" class="data row9 col1">
+
+ -0.13
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow9_col2" class="data row9 col2">
+
+ 0.63
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow9_col3" class="data row9 col3">
+
+ -0.59
+
+
+ <td id="T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow9_col4" class="data row9 col4">
+
+ 0.29
+
+
+ </tr>
+
+ </tbody>
+ </table>
+
+</div>
+
+</div>
+
+</div>
+</div>
+
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<p>Setting the precision only affects the printed number; the full-precision values are always passed to your style functions. You can always use <code>df.round(2).style</code> if you'd prefer to round from the start.</p>
+
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<h3 id="Captions">Captions<a class="anchor-link" href="#Captions">¶</a></h3>
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<p>Regular table captions can be added in a few ways.</p>
+
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing code_cell rendered">
+<div class="input">
+<div class="prompt input_prompt">In [25]:</div>
+<div class="inner_cell">
+ <div class="input_area">
+<div class=" highlight hl-ipython3"><pre><span class="n">df</span><span class="o">.</span><span class="n">style</span><span class="o">.</span><span class="n">set_caption</span><span class="p">(</span><span class="s">'Colormaps, with a caption.'</span><span class="p">)</span>\
+ <span class="o">.</span><span class="n">background_gradient</span><span class="p">(</span><span class="n">cmap</span><span class="o">=</span><span class="n">cm</span><span class="p">)</span>
+</pre></div>
+
+</div>
+</div>
+</div>
+
+<div class="output_wrapper">
+<div class="output">
+
+
+<div class="output_area"><div class="prompt output_prompt">Out[25]:</div>
+
+<div class="output_html rendered_html output_subarea output_execute_result">
+
+ <style type="text/css" >
+
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow0_col0 {
+
+ background-color: #e5ffe5;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow0_col1 {
+
+ background-color: #188d18;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow0_col2 {
+
+ background-color: #e5ffe5;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow0_col3 {
+
+ background-color: #c7eec7;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow0_col4 {
+
+ background-color: #a6dca6;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow1_col0 {
+
+ background-color: #ccf1cc;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow1_col1 {
+
+ background-color: #c0eac0;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow1_col2 {
+
+ background-color: #e5ffe5;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow1_col3 {
+
+ background-color: #62b662;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow1_col4 {
+
+ background-color: #5cb35c;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow2_col0 {
+
+ background-color: #b3e3b3;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow2_col1 {
+
+ background-color: #e5ffe5;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow2_col2 {
+
+ background-color: #56af56;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow2_col3 {
+
+ background-color: #56af56;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow2_col4 {
+
+ background-color: #008000;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow3_col0 {
+
+ background-color: #99d599;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow3_col1 {
+
+ background-color: #329c32;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow3_col2 {
+
+ background-color: #5fb55f;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow3_col3 {
+
+ background-color: #daf9da;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow3_col4 {
+
+ background-color: #3ba13b;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow4_col0 {
+
+ background-color: #80c780;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow4_col1 {
+
+ background-color: #108910;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow4_col2 {
+
+ background-color: #0d870d;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow4_col3 {
+
+ background-color: #90d090;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow4_col4 {
+
+ background-color: #4fac4f;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow5_col0 {
+
+ background-color: #66b866;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow5_col1 {
+
+ background-color: #d2f4d2;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow5_col2 {
+
+ background-color: #389f38;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow5_col3 {
+
+ background-color: #048204;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow5_col4 {
+
+ background-color: #70be70;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow6_col0 {
+
+ background-color: #4daa4d;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow6_col1 {
+
+ background-color: #6cbc6c;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow6_col2 {
+
+ background-color: #008000;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow6_col3 {
+
+ background-color: #a3daa3;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow6_col4 {
+
+ background-color: #0e880e;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow7_col0 {
+
+ background-color: #329c32;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow7_col1 {
+
+ background-color: #5cb35c;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow7_col2 {
+
+ background-color: #0e880e;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow7_col3 {
+
+ background-color: #cff3cf;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow7_col4 {
+
+ background-color: #4fac4f;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow8_col0 {
+
+ background-color: #198e19;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow8_col1 {
+
+ background-color: #008000;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow8_col2 {
+
+ background-color: #dcfadc;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow8_col3 {
+
+ background-color: #008000;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow8_col4 {
+
+ background-color: #e5ffe5;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow9_col0 {
+
+ background-color: #008000;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow9_col1 {
+
+ background-color: #7ec67e;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow9_col2 {
+
+ background-color: #319b31;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow9_col3 {
+
+ background-color: #e5ffe5;
+
+ }
+
+ #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow9_col4 {
+
+ background-color: #5cb35c;
+
+ }
+
+ </style>
+
+ <table id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fb">
+
+ <caption>Colormaps, with a caption.</caption>
+
+
+ <thead>
+
+ <tr>
+
+ <th class="blank">
+
+ <th class="col_heading level0 col0">A
+
+ <th class="col_heading level0 col1">B
+
+ <th class="col_heading level0 col2">C
+
+ <th class="col_heading level0 col3">D
+
+ <th class="col_heading level0 col4">E
+
+ </tr>
+
+ </thead>
+ <tbody>
+
+ <tr>
+
+ <th id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fb" class="row_heading level4 row0">
+
+ 0
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow0_col0" class="data row0 col0">
+
+ 1.0
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow0_col1" class="data row0 col1">
+
+ 1.329212
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow0_col2" class="data row0 col2">
+
+ nan
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow0_col3" class="data row0 col3">
+
+ -0.31628
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow0_col4" class="data row0 col4">
+
+ -0.99081
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fb" class="row_heading level4 row1">
+
+ 1
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow1_col0" class="data row1 col0">
+
+ 2.0
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow1_col1" class="data row1 col1">
+
+ -1.070816
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow1_col2" class="data row1 col2">
+
+ -1.438713
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow1_col3" class="data row1 col3">
+
+ 0.564417
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow1_col4" class="data row1 col4">
+
+ 0.295722
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fb" class="row_heading level4 row2">
+
+ 2
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow2_col0" class="data row2 col0">
+
+ 3.0
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow2_col1" class="data row2 col1">
+
+ -1.626404
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow2_col2" class="data row2 col2">
+
+ 0.219565
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow2_col3" class="data row2 col3">
+
+ 0.678805
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow2_col4" class="data row2 col4">
+
+ 1.889273
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fb" class="row_heading level4 row3">
+
+ 3
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow3_col0" class="data row3 col0">
+
+ 4.0
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow3_col1" class="data row3 col1">
+
+ 0.961538
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow3_col2" class="data row3 col2">
+
+ 0.104011
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow3_col3" class="data row3 col3">
+
+ -0.481165
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow3_col4" class="data row3 col4">
+
+ 0.850229
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fb" class="row_heading level4 row4">
+
+ 4
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow4_col0" class="data row4 col0">
+
+ 5.0
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow4_col1" class="data row4 col1">
+
+ 1.453425
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow4_col2" class="data row4 col2">
+
+ 1.057737
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow4_col3" class="data row4 col3">
+
+ 0.165562
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow4_col4" class="data row4 col4">
+
+ 0.515018
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fb" class="row_heading level4 row5">
+
+ 5
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow5_col0" class="data row5 col0">
+
+ 6.0
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow5_col1" class="data row5 col1">
+
+ -1.336936
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow5_col2" class="data row5 col2">
+
+ 0.562861
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow5_col3" class="data row5 col3">
+
+ 1.392855
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow5_col4" class="data row5 col4">
+
+ -0.063328
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fb" class="row_heading level4 row6">
+
+ 6
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow6_col0" class="data row6 col0">
+
+ 7.0
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow6_col1" class="data row6 col1">
+
+ 0.121668
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow6_col2" class="data row6 col2">
+
+ 1.207603
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow6_col3" class="data row6 col3">
+
+ -0.00204
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow6_col4" class="data row6 col4">
+
+ 1.627796
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fb" class="row_heading level4 row7">
+
+ 7
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow7_col0" class="data row7 col0">
+
+ 8.0
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow7_col1" class="data row7 col1">
+
+ 0.354493
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow7_col2" class="data row7 col2">
+
+ 1.037528
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow7_col3" class="data row7 col3">
+
+ -0.385684
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow7_col4" class="data row7 col4">
+
+ 0.519818
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fb" class="row_heading level4 row8">
+
+ 8
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow8_col0" class="data row8 col0">
+
+ 9.0
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow8_col1" class="data row8 col1">
+
+ 1.686583
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow8_col2" class="data row8 col2">
+
+ -1.325963
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow8_col3" class="data row8 col3">
+
+ 1.428984
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow8_col4" class="data row8 col4">
+
+ -2.089354
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fb" class="row_heading level4 row9">
+
+ 9
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow9_col0" class="data row9 col0">
+
+ 10.0
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow9_col1" class="data row9 col1">
+
+ -0.12982
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow9_col2" class="data row9 col2">
+
+ 0.631523
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow9_col3" class="data row9 col3">
+
+ -0.586538
+
+
+ <td id="T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow9_col4" class="data row9 col4">
+
+ 0.29072
+
+
+ </tr>
+
+ </tbody>
+ </table>
+
+</div>
+
+</div>
+
+</div>
+</div>
+
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<h3 id="Table-Styles">Table Styles<a class="anchor-link" href="#Table-Styles">¶</a></h3>
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<p>The next option you have are "table styles".
+These are styles that apply to the table as a whole, but don't look at the data.
+Certain sytlings, including pseudo-selectors like <code>:hover</code> can only be used this way.</p>
+
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing code_cell rendered">
+<div class="input">
+<div class="prompt input_prompt">In [26]:</div>
+<div class="inner_cell">
+ <div class="input_area">
+<div class=" highlight hl-ipython3"><pre><span class="kn">from</span> <span class="nn">IPython.display</span> <span class="k">import</span> <span class="n">HTML</span>
+
+<span class="k">def</span> <span class="nf">hover</span><span class="p">(</span><span class="n">hover_color</span><span class="o">=</span><span class="s">"#ffff99"</span><span class="p">):</span>
+ <span class="k">return</span> <span class="nb">dict</span><span class="p">(</span><span class="n">selector</span><span class="o">=</span><span class="s">"tr:hover"</span><span class="p">,</span>
+ <span class="n">props</span><span class="o">=</span><span class="p">[(</span><span class="s">"background-color"</span><span class="p">,</span> <span class="s">"%s"</span> <span class="o">%</span> <span class="n">hover_color</span><span class="p">)])</span>
+
+<span class="n">styles</span> <span class="o">=</span> <span class="p">[</span>
+ <span class="n">hover</span><span class="p">(),</span>
+ <span class="nb">dict</span><span class="p">(</span><span class="n">selector</span><span class="o">=</span><span class="s">"th"</span><span class="p">,</span> <span class="n">props</span><span class="o">=</span><span class="p">[(</span><span class="s">"font-size"</span><span class="p">,</span> <span class="s">"150%"</span><span class="p">),</span>
+ <span class="p">(</span><span class="s">"text-align"</span><span class="p">,</span> <span class="s">"center"</span><span class="p">)]),</span>
+ <span class="nb">dict</span><span class="p">(</span><span class="n">selector</span><span class="o">=</span><span class="s">"caption"</span><span class="p">,</span> <span class="n">props</span><span class="o">=</span><span class="p">[(</span><span class="s">"caption-side"</span><span class="p">,</span> <span class="s">"bottom"</span><span class="p">)])</span>
+<span class="p">]</span>
+<span class="n">html</span> <span class="o">=</span> <span class="p">(</span><span class="n">df</span><span class="o">.</span><span class="n">style</span><span class="o">.</span><span class="n">set_table_styles</span><span class="p">(</span><span class="n">styles</span><span class="p">)</span>
+ <span class="o">.</span><span class="n">set_caption</span><span class="p">(</span><span class="s">"Hover to highlight."</span><span class="p">))</span>
+<span class="n">html</span>
+</pre></div>
+
+</div>
+</div>
+</div>
+
+<div class="output_wrapper">
+<div class="output">
+
+
+<div class="output_area"><div class="prompt output_prompt">Out[26]:</div>
+
+<div class="output_html rendered_html output_subarea output_execute_result">
+
+ <style type="text/css" >
+
+ #T_e8482f22_8bd5_11e5_9937_a45e60bd97fb tr:hover {
+
+ background-color: #ffff99;
+
+ }
+
+ #T_e8482f22_8bd5_11e5_9937_a45e60bd97fb th {
+
+ font-size: 150%;
+
+ text-align: center;
+
+ }
+
+ #T_e8482f22_8bd5_11e5_9937_a45e60bd97fb caption {
+
+ caption-side: bottom;
+
+ }
+
+
+ </style>
+
+ <table id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fb">
+
+ <caption>Hover to highlight.</caption>
+
+
+ <thead>
+
+ <tr>
+
+ <th class="blank">
+
+ <th class="col_heading level0 col0">A
+
+ <th class="col_heading level0 col1">B
+
+ <th class="col_heading level0 col2">C
+
+ <th class="col_heading level0 col3">D
+
+ <th class="col_heading level0 col4">E
+
+ </tr>
+
+ </thead>
+ <tbody>
+
+ <tr>
+
+ <th id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fb" class="row_heading level4 row0">
+
+ 0
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow0_col0" class="data row0 col0">
+
+ 1.0
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow0_col1" class="data row0 col1">
+
+ 1.329212
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow0_col2" class="data row0 col2">
+
+ nan
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow0_col3" class="data row0 col3">
+
+ -0.31628
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow0_col4" class="data row0 col4">
+
+ -0.99081
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fb" class="row_heading level4 row1">
+
+ 1
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow1_col0" class="data row1 col0">
+
+ 2.0
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow1_col1" class="data row1 col1">
+
+ -1.070816
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow1_col2" class="data row1 col2">
+
+ -1.438713
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow1_col3" class="data row1 col3">
+
+ 0.564417
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow1_col4" class="data row1 col4">
+
+ 0.295722
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fb" class="row_heading level4 row2">
+
+ 2
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow2_col0" class="data row2 col0">
+
+ 3.0
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow2_col1" class="data row2 col1">
+
+ -1.626404
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow2_col2" class="data row2 col2">
+
+ 0.219565
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow2_col3" class="data row2 col3">
+
+ 0.678805
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow2_col4" class="data row2 col4">
+
+ 1.889273
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fb" class="row_heading level4 row3">
+
+ 3
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow3_col0" class="data row3 col0">
+
+ 4.0
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow3_col1" class="data row3 col1">
+
+ 0.961538
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow3_col2" class="data row3 col2">
+
+ 0.104011
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow3_col3" class="data row3 col3">
+
+ -0.481165
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow3_col4" class="data row3 col4">
+
+ 0.850229
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fb" class="row_heading level4 row4">
+
+ 4
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow4_col0" class="data row4 col0">
+
+ 5.0
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow4_col1" class="data row4 col1">
+
+ 1.453425
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow4_col2" class="data row4 col2">
+
+ 1.057737
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow4_col3" class="data row4 col3">
+
+ 0.165562
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow4_col4" class="data row4 col4">
+
+ 0.515018
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fb" class="row_heading level4 row5">
+
+ 5
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow5_col0" class="data row5 col0">
+
+ 6.0
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow5_col1" class="data row5 col1">
+
+ -1.336936
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow5_col2" class="data row5 col2">
+
+ 0.562861
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow5_col3" class="data row5 col3">
+
+ 1.392855
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow5_col4" class="data row5 col4">
+
+ -0.063328
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fb" class="row_heading level4 row6">
+
+ 6
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow6_col0" class="data row6 col0">
+
+ 7.0
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow6_col1" class="data row6 col1">
+
+ 0.121668
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow6_col2" class="data row6 col2">
+
+ 1.207603
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow6_col3" class="data row6 col3">
+
+ -0.00204
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow6_col4" class="data row6 col4">
+
+ 1.627796
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fb" class="row_heading level4 row7">
+
+ 7
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow7_col0" class="data row7 col0">
+
+ 8.0
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow7_col1" class="data row7 col1">
+
+ 0.354493
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow7_col2" class="data row7 col2">
+
+ 1.037528
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow7_col3" class="data row7 col3">
+
+ -0.385684
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow7_col4" class="data row7 col4">
+
+ 0.519818
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fb" class="row_heading level4 row8">
+
+ 8
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow8_col0" class="data row8 col0">
+
+ 9.0
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow8_col1" class="data row8 col1">
+
+ 1.686583
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow8_col2" class="data row8 col2">
+
+ -1.325963
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow8_col3" class="data row8 col3">
+
+ 1.428984
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow8_col4" class="data row8 col4">
+
+ -2.089354
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fb" class="row_heading level4 row9">
+
+ 9
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow9_col0" class="data row9 col0">
+
+ 10.0
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow9_col1" class="data row9 col1">
+
+ -0.12982
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow9_col2" class="data row9 col2">
+
+ 0.631523
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow9_col3" class="data row9 col3">
+
+ -0.586538
+
+
+ <td id="T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow9_col4" class="data row9 col4">
+
+ 0.29072
+
+
+ </tr>
+
+ </tbody>
+ </table>
+
+</div>
+
+</div>
+
+</div>
+</div>
+
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<p><code>table_styles</code> should be a list of dictionaries.
+Each dictionary should have the <code>selector</code> and <code>props</code> keys.
+The value for <code>selector</code> should be a valid CSS selector.
+Recall that all the styles are already attached to an <code>id</code>, unique to
+each <code>Styler</code>. This selector is in addition to that <code>id</code>.
+The value for <code>props</code> should be a list of tuples of <code>('attribute', 'value')</code>.</p>
+<p><code>table_styles</code> are extremely flexible, but not as fun to type out by hand.
+We hope to collect some useful ones either in pandas, or preferable in a new package that <a href="#Extensibility">builds on top</a> the tools here.</p>
+
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<h1 id="Limitations">Limitations<a class="anchor-link" href="#Limitations">¶</a></h1><ul>
+<li>DataFrame only <code>(use Series.to_frame().style)</code></li>
+<li>The index and columns must be unique</li>
+<li>No large repr, and performance isn't great; this is intended for summary DataFrames</li>
+<li>You can only style the <em>values</em>, not the index or columns</li>
+<li>You can only apply styles, you can't insert new HTML entities</li>
+</ul>
+<p>Some of these will be addressed in the future.</p>
+
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<h1 id="Terms">Terms<a class="anchor-link" href="#Terms">¶</a></h1><ul>
+<li>Style function: a function that's passed into <code>Styler.apply</code> or <code>Styler.applymap</code> and returns values like <code>'css attribute: value'</code></li>
+<li>Builtin style functions: style functions that are methods on <code>Styler</code></li>
+<li>table style: a dictionary with the two keys <code>selector</code> and <code>props</code>. <code>selector</code> is the CSS selector that <code>props</code> will apply to. <code>props</code> is a list of <code>(attribute, value)</code> tuples. A list of table styles passed into <code>Styler</code>.</li>
+</ul>
+
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<h2 id="Fun-stuff">Fun stuff<a class="anchor-link" href="#Fun-stuff">¶</a></h2><p>Here are a few interesting examples.</p>
+<p><code>Styler</code> interacts pretty well with widgets. If you're viewing this online instead of running the notebook yourself, you're missing out on interactively adjusting the color palette.</p>
+
+</div>
+</div>
+</div>
+<div class="cell border-box-sizing code_cell rendered">
+<div class="input">
+<div class="prompt input_prompt">In [27]:</div>
+<div class="inner_cell">
+ <div class="input_area">
+<div class=" highlight hl-ipython3"><pre><span class="kn">from</span> <span class="nn">IPython.html</span> <span class="k">import</span> <span class="n">widgets</span>
+<span class="nd">@widgets</span><span class="o">.</span><span class="n">interact</span>
+<span class="k">def</span> <span class="nf">f</span><span class="p">(</span><span class="n">h_neg</span><span class="o">=</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">359</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">h_pos</span><span class="o">=</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">359</span><span class="p">),</span> <span class="n">s</span><span class="o">=</span><span class="p">(</span><span class="mf">0.</span><span class="p">,</span> <span class="mf">99.9</span><span class="p">),</span> <span class="n">l</span><span class="o">=</span><span class="p">(</span><span class="mf">0.</span><span class="p">,</span> <span class="mf">99.9</span><span class="p">)):</span>
+ <span class="k">return</span> <span class="n">df</span><span class="o">.</span><span class="n">style</span><span class="o">.</span><span class="n">background_gradient</span><span class="p">(</span>
+ <span class="n">cmap</span><span class="o">=</span><span class="n">sns</span><span class="o">.</span><span class="n">palettes</span><span class="o">.</span><span class="n">diverging_palette</span><span class="p">(</span><span class="n">h_neg</span><span class="o">=</span><span class="n">h_neg</span><span class="p">,</span> <span class="n">h_pos</span><span class="o">=</span><span class="n">h_pos</span><span class="p">,</span> <span class="n">s</span><span class="o">=</span><span class="n">s</span><span class="p">,</span> <span class="n">l</span><span class="o">=</span><span class="n">l</span><span class="p">,</span>
+ <span class="n">as_cmap</span><span class="o">=</span><span class="k">True</span><span class="p">)</span>
+ <span class="p">)</span>
+</pre></div>
+
+</div>
+</div>
+</div>
+
+<div class="output_wrapper">
+<div class="output">
+
+
+<div class="output_area"><div class="prompt"></div>
+
+<div class="output_html rendered_html output_subarea ">
+
+ <style type="text/css" >
+
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow0_col0 {
+
+ background-color: #557e79;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow0_col1 {
+
+ background-color: #779894;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow0_col2 {
+
+ background-color: #557e79;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow0_col3 {
+
+ background-color: #809f9b;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow0_col4 {
+
+ background-color: #aec2bf;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow1_col0 {
+
+ background-color: #799995;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow1_col1 {
+
+ background-color: #8ba7a3;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow1_col2 {
+
+ background-color: #557e79;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow1_col3 {
+
+ background-color: #dfe8e7;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow1_col4 {
+
+ background-color: #d7e2e0;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow2_col0 {
+
+ background-color: #9cb5b1;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow2_col1 {
+
+ background-color: #557e79;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow2_col2 {
+
+ background-color: #cedbd9;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow2_col3 {
+
+ background-color: #cedbd9;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow2_col4 {
+
+ background-color: #557e79;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow3_col0 {
+
+ background-color: #c1d1cf;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow3_col1 {
+
+ background-color: #9cb5b1;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow3_col2 {
+
+ background-color: #dce5e4;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow3_col3 {
+
+ background-color: #668b86;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow3_col4 {
+
+ background-color: #a9bebb;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow4_col0 {
+
+ background-color: #e5eceb;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow4_col1 {
+
+ background-color: #6c908b;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow4_col2 {
+
+ background-color: #678c87;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow4_col3 {
+
+ background-color: #cedbd9;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow4_col4 {
+
+ background-color: #c5d4d2;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow5_col0 {
+
+ background-color: #e5eceb;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow5_col1 {
+
+ background-color: #71948f;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow5_col2 {
+
+ background-color: #a4bbb8;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow5_col3 {
+
+ background-color: #5a827d;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow5_col4 {
+
+ background-color: #f2f2f2;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow6_col0 {
+
+ background-color: #c1d1cf;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow6_col1 {
+
+ background-color: #edf3f2;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow6_col2 {
+
+ background-color: #557e79;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow6_col3 {
+
+ background-color: #b3c6c4;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow6_col4 {
+
+ background-color: #698e89;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow7_col0 {
+
+ background-color: #9cb5b1;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow7_col1 {
+
+ background-color: #d7e2e0;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow7_col2 {
+
+ background-color: #698e89;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow7_col3 {
+
+ background-color: #759792;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow7_col4 {
+
+ background-color: #c5d4d2;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow8_col0 {
+
+ background-color: #799995;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow8_col1 {
+
+ background-color: #557e79;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow8_col2 {
+
+ background-color: #628882;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow8_col3 {
+
+ background-color: #557e79;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow8_col4 {
+
+ background-color: #557e79;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow9_col0 {
+
+ background-color: #557e79;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow9_col1 {
+
+ background-color: #e7eeed;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow9_col2 {
+
+ background-color: #9bb4b0;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow9_col3 {
+
+ background-color: #557e79;
+
+ }
+
+ #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow9_col4 {
+
+ background-color: #d7e2e0;
+
+ }
+
+ </style>
+
+ <table id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fb">
+
+
+ <thead>
+
+ <tr>
+
+ <th class="blank">
+
+ <th class="col_heading level0 col0">A
+
+ <th class="col_heading level0 col1">B
+
+ <th class="col_heading level0 col2">C
+
+ <th class="col_heading level0 col3">D
+
+ <th class="col_heading level0 col4">E
+
+ </tr>
+
+ </thead>
+ <tbody>
+
+ <tr>
+
+ <th id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fb" class="row_heading level4 row0">
+
+ 0
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow0_col0" class="data row0 col0">
+
+ 1.0
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow0_col1" class="data row0 col1">
+
+ 1.329212
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow0_col2" class="data row0 col2">
+
+ nan
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow0_col3" class="data row0 col3">
+
+ -0.31628
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow0_col4" class="data row0 col4">
+
+ -0.99081
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fb" class="row_heading level4 row1">
+
+ 1
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow1_col0" class="data row1 col0">
+
+ 2.0
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow1_col1" class="data row1 col1">
+
+ -1.070816
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow1_col2" class="data row1 col2">
+
+ -1.438713
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow1_col3" class="data row1 col3">
+
+ 0.564417
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow1_col4" class="data row1 col4">
+
+ 0.295722
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fb" class="row_heading level4 row2">
+
+ 2
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow2_col0" class="data row2 col0">
+
+ 3.0
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow2_col1" class="data row2 col1">
+
+ -1.626404
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow2_col2" class="data row2 col2">
+
+ 0.219565
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow2_col3" class="data row2 col3">
+
+ 0.678805
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow2_col4" class="data row2 col4">
+
+ 1.889273
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fb" class="row_heading level4 row3">
+
+ 3
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow3_col0" class="data row3 col0">
+
+ 4.0
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow3_col1" class="data row3 col1">
+
+ 0.961538
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow3_col2" class="data row3 col2">
+
+ 0.104011
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow3_col3" class="data row3 col3">
+
+ -0.481165
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow3_col4" class="data row3 col4">
+
+ 0.850229
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fb" class="row_heading level4 row4">
+
+ 4
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow4_col0" class="data row4 col0">
+
+ 5.0
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow4_col1" class="data row4 col1">
+
+ 1.453425
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow4_col2" class="data row4 col2">
+
+ 1.057737
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow4_col3" class="data row4 col3">
+
+ 0.165562
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow4_col4" class="data row4 col4">
+
+ 0.515018
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fb" class="row_heading level4 row5">
+
+ 5
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow5_col0" class="data row5 col0">
+
+ 6.0
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow5_col1" class="data row5 col1">
+
+ -1.336936
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow5_col2" class="data row5 col2">
+
+ 0.562861
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow5_col3" class="data row5 col3">
+
+ 1.392855
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow5_col4" class="data row5 col4">
+
+ -0.063328
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fb" class="row_heading level4 row6">
+
+ 6
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow6_col0" class="data row6 col0">
+
+ 7.0
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow6_col1" class="data row6 col1">
+
+ 0.121668
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow6_col2" class="data row6 col2">
+
+ 1.207603
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow6_col3" class="data row6 col3">
+
+ -0.00204
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow6_col4" class="data row6 col4">
+
+ 1.627796
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fb" class="row_heading level4 row7">
+
+ 7
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow7_col0" class="data row7 col0">
+
+ 8.0
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow7_col1" class="data row7 col1">
+
+ 0.354493
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow7_col2" class="data row7 col2">
+
+ 1.037528
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow7_col3" class="data row7 col3">
+
+ -0.385684
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow7_col4" class="data row7 col4">
+
+ 0.519818
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fb" class="row_heading level4 row8">
+
+ 8
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow8_col0" class="data row8 col0">
+
+ 9.0
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow8_col1" class="data row8 col1">
+
+ 1.686583
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow8_col2" class="data row8 col2">
+
+ -1.325963
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow8_col3" class="data row8 col3">
+
+ 1.428984
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow8_col4" class="data row8 col4">
+
+ -2.089354
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fb" class="row_heading level4 row9">
+
+ 9
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow9_col0" class="data row9 col0">
+
+ 10.0
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow9_col1" class="data row9 col1">
+
+ -0.12982
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow9_col2" class="data row9 col2">
+
+ 0.631523
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow9_col3" class="data row9 col3">
+
+ -0.586538
+
+
+ <td id="T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow9_col4" class="data row9 col4">
+
+ 0.29072
+
+
+ </tr>
+
+ </tbody>
+ </table>
+
+</div>
+
+</div>
+
+</div>
+</div>
+
+</div>
+<div class="cell border-box-sizing code_cell rendered">
+<div class="input">
+<div class="prompt input_prompt">In [28]:</div>
+<div class="inner_cell">
+ <div class="input_area">
+<div class=" highlight hl-ipython3"><pre><span class="k">def</span> <span class="nf">magnify</span><span class="p">():</span>
+ <span class="k">return</span> <span class="p">[</span><span class="nb">dict</span><span class="p">(</span><span class="n">selector</span><span class="o">=</span><span class="s">"th"</span><span class="p">,</span>
+ <span class="n">props</span><span class="o">=</span><span class="p">[(</span><span class="s">"font-size"</span><span class="p">,</span> <span class="s">"4pt"</span><span class="p">)]),</span>
+ <span class="nb">dict</span><span class="p">(</span><span class="n">selector</span><span class="o">=</span><span class="s">"th:hover"</span><span class="p">,</span>
+ <span class="n">props</span><span class="o">=</span><span class="p">[(</span><span class="s">"font-size"</span><span class="p">,</span> <span class="s">"12pt"</span><span class="p">)]),</span>
+ <span class="nb">dict</span><span class="p">(</span><span class="n">selector</span><span class="o">=</span><span class="s">"tr:hover td:hover"</span><span class="p">,</span>
+ <span class="n">props</span><span class="o">=</span><span class="p">[(</span><span class="s">'max-width'</span><span class="p">,</span> <span class="s">'200px'</span><span class="p">),</span>
+ <span class="p">(</span><span class="s">'font-size'</span><span class="p">,</span> <span class="s">'12pt'</span><span class="p">)])</span>
+<span class="p">]</span>
+</pre></div>
+
+</div>
+</div>
+</div>
+
+</div>
+<div class="cell border-box-sizing code_cell rendered">
+<div class="input">
+<div class="prompt input_prompt">In [29]:</div>
+<div class="inner_cell">
+ <div class="input_area">
+<div class=" highlight hl-ipython3"><pre><span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">seed</span><span class="p">(</span><span class="mi">25</span><span class="p">)</span>
+<span class="n">cmap</span> <span class="o">=</span> <span class="n">cmap</span><span class="o">=</span><span class="n">sns</span><span class="o">.</span><span class="n">diverging_palette</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">250</span><span class="p">,</span> <span class="n">as_cmap</span><span class="o">=</span><span class="k">True</span><span class="p">)</span>
+<span class="n">df</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">DataFrame</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">randn</span><span class="p">(</span><span class="mi">20</span><span class="p">,</span> <span class="mi">25</span><span class="p">))</span><span class="o">.</span><span class="n">cumsum</span><span class="p">()</span>
+
+<span class="n">df</span><span class="o">.</span><span class="n">style</span><span class="o">.</span><span class="n">background_gradient</span><span class="p">(</span><span class="n">cmap</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>\
+ <span class="o">.</span><span class="n">set_properties</span><span class="p">(</span><span class="o">**</span><span class="p">{</span><span class="s">'max-width'</span><span class="p">:</span> <span class="s">'80px'</span><span class="p">,</span> <span class="s">'font-size'</span><span class="p">:</span> <span class="s">'1pt'</span><span class="p">})</span>\
+ <span class="o">.</span><span class="n">set_caption</span><span class="p">(</span><span class="s">"Hover to magify"</span><span class="p">)</span>\
+ <span class="o">.</span><span class="n">set_precision</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span>\
+ <span class="o">.</span><span class="n">set_table_styles</span><span class="p">(</span><span class="n">magnify</span><span class="p">())</span>
+</pre></div>
+
+</div>
+</div>
+</div>
+
+<div class="output_wrapper">
+<div class="output">
+
+
+<div class="output_area"><div class="prompt output_prompt">Out[29]:</div>
+
+<div class="output_html rendered_html output_subarea output_execute_result">
+
+ <style type="text/css" >
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb th {
+
+ font-size: 4pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb th:hover {
+
+ font-size: 12pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb tr:hover td:hover {
+
+ max-width: 200px;
+
+ font-size: 12pt;
+
+ }
+
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col0 {
+
+ background-color: #ecf2f8;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col1 {
+
+ background-color: #b8cce5;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col2 {
+
+ background-color: #efb1be;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col3 {
+
+ background-color: #f3c2cc;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col4 {
+
+ background-color: #eeaab7;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col5 {
+
+ background-color: #f8dce2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col6 {
+
+ background-color: #f2c1cb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col7 {
+
+ background-color: #83a6d2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col8 {
+
+ background-color: #de5f79;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col9 {
+
+ background-color: #c3d4e9;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col10 {
+
+ background-color: #eeacba;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col11 {
+
+ background-color: #f7dae0;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col12 {
+
+ background-color: #6f98ca;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col13 {
+
+ background-color: #e890a1;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col14 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col15 {
+
+ background-color: #ea96a7;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col16 {
+
+ background-color: #adc4e1;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col17 {
+
+ background-color: #eca3b1;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col18 {
+
+ background-color: #b7cbe5;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col19 {
+
+ background-color: #f5ced6;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col20 {
+
+ background-color: #6590c7;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col21 {
+
+ background-color: #d73c5b;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col22 {
+
+ background-color: #4479bb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col23 {
+
+ background-color: #cfddee;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col24 {
+
+ background-color: #e58094;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col0 {
+
+ background-color: #e4798e;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col1 {
+
+ background-color: #aec5e1;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col2 {
+
+ background-color: #eb9ead;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col3 {
+
+ background-color: #ec9faf;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col4 {
+
+ background-color: #cbdaec;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col5 {
+
+ background-color: #f9e0e5;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col6 {
+
+ background-color: #db4f6b;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col7 {
+
+ background-color: #4479bb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col8 {
+
+ background-color: #e57f93;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col9 {
+
+ background-color: #bdd0e7;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col10 {
+
+ background-color: #f3c2cc;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col11 {
+
+ background-color: #f8dfe4;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col12 {
+
+ background-color: #b0c6e2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col13 {
+
+ background-color: #ec9faf;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col14 {
+
+ background-color: #e27389;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col15 {
+
+ background-color: #eb9dac;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col16 {
+
+ background-color: #f1b8c3;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col17 {
+
+ background-color: #efb1be;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col18 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col19 {
+
+ background-color: #f8dce2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col20 {
+
+ background-color: #a0bbdc;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col21 {
+
+ background-color: #d73c5b;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col22 {
+
+ background-color: #86a8d3;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col23 {
+
+ background-color: #d9e4f1;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col24 {
+
+ background-color: #ecf2f8;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col0 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col1 {
+
+ background-color: #5887c2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col2 {
+
+ background-color: #f2bfca;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col3 {
+
+ background-color: #c7d7eb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col4 {
+
+ background-color: #82a5d1;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col5 {
+
+ background-color: #ebf1f8;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col6 {
+
+ background-color: #e78a9d;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col7 {
+
+ background-color: #4479bb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col8 {
+
+ background-color: #f1bbc6;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col9 {
+
+ background-color: #779dcd;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col10 {
+
+ background-color: #d4e0ef;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col11 {
+
+ background-color: #e6edf6;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col12 {
+
+ background-color: #e0e9f4;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col13 {
+
+ background-color: #fbeaed;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col14 {
+
+ background-color: #e78a9d;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col15 {
+
+ background-color: #fae7eb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col16 {
+
+ background-color: #e6edf6;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col17 {
+
+ background-color: #e6edf6;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col18 {
+
+ background-color: #b9cde6;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col19 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col20 {
+
+ background-color: #a0bbdc;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col21 {
+
+ background-color: #d73c5b;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col22 {
+
+ background-color: #618ec5;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col23 {
+
+ background-color: #8faed6;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col24 {
+
+ background-color: #c3d4e9;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col0 {
+
+ background-color: #f6d5db;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col1 {
+
+ background-color: #5384c0;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col2 {
+
+ background-color: #f1bbc6;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col3 {
+
+ background-color: #c7d7eb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col4 {
+
+ background-color: #4479bb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col5 {
+
+ background-color: #e7eef6;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col6 {
+
+ background-color: #e58195;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col7 {
+
+ background-color: #4479bb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col8 {
+
+ background-color: #f2c1cb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col9 {
+
+ background-color: #b1c7e2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col10 {
+
+ background-color: #d4e0ef;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col11 {
+
+ background-color: #c1d3e8;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col12 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col13 {
+
+ background-color: #cedced;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col14 {
+
+ background-color: #e7899c;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col15 {
+
+ background-color: #eeacba;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col16 {
+
+ background-color: #e2eaf4;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col17 {
+
+ background-color: #f7d6dd;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col18 {
+
+ background-color: #a8c0df;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col19 {
+
+ background-color: #f5ccd4;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col20 {
+
+ background-color: #b7cbe5;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col21 {
+
+ background-color: #d73c5b;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col22 {
+
+ background-color: #739acc;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col23 {
+
+ background-color: #8dadd5;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col24 {
+
+ background-color: #cddbed;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col0 {
+
+ background-color: #ea9aaa;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col1 {
+
+ background-color: #5887c2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col2 {
+
+ background-color: #f4c9d2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col3 {
+
+ background-color: #f5ced6;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col4 {
+
+ background-color: #4479bb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col5 {
+
+ background-color: #fae4e9;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col6 {
+
+ background-color: #e78c9e;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col7 {
+
+ background-color: #5182bf;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col8 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col9 {
+
+ background-color: #c1d3e8;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col10 {
+
+ background-color: #e8eff7;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col11 {
+
+ background-color: #c9d8eb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col12 {
+
+ background-color: #eaf0f7;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col13 {
+
+ background-color: #f9e2e6;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col14 {
+
+ background-color: #e47c91;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col15 {
+
+ background-color: #eda8b6;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col16 {
+
+ background-color: #fae6ea;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col17 {
+
+ background-color: #f5ccd4;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col18 {
+
+ background-color: #b3c9e3;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col19 {
+
+ background-color: #f4cad3;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col20 {
+
+ background-color: #9fbadc;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col21 {
+
+ background-color: #d73c5b;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col22 {
+
+ background-color: #7da2cf;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col23 {
+
+ background-color: #95b3d8;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col24 {
+
+ background-color: #a2bcdd;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col0 {
+
+ background-color: #fbeaed;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col1 {
+
+ background-color: #6490c6;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col2 {
+
+ background-color: #f6d1d8;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col3 {
+
+ background-color: #f3c6cf;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col4 {
+
+ background-color: #4479bb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col5 {
+
+ background-color: #fae6ea;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col6 {
+
+ background-color: #e68598;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col7 {
+
+ background-color: #6d96ca;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col8 {
+
+ background-color: #f9e3e7;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col9 {
+
+ background-color: #fae7eb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col10 {
+
+ background-color: #bdd0e7;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col11 {
+
+ background-color: #e0e9f4;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col12 {
+
+ background-color: #f5ced6;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col13 {
+
+ background-color: #e6edf6;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col14 {
+
+ background-color: #e47a90;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col15 {
+
+ background-color: #fbeaed;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col16 {
+
+ background-color: #f3c5ce;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col17 {
+
+ background-color: #f7dae0;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col18 {
+
+ background-color: #cbdaec;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col19 {
+
+ background-color: #f6d2d9;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col20 {
+
+ background-color: #b5cae4;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col21 {
+
+ background-color: #d73c5b;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col22 {
+
+ background-color: #8faed6;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col23 {
+
+ background-color: #a3bddd;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col24 {
+
+ background-color: #7199cb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col0 {
+
+ background-color: #e6edf6;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col1 {
+
+ background-color: #4e80be;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col2 {
+
+ background-color: #f8dee3;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col3 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col4 {
+
+ background-color: #6a94c9;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col5 {
+
+ background-color: #fae4e9;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col6 {
+
+ background-color: #f3c2cc;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col7 {
+
+ background-color: #759ccd;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col8 {
+
+ background-color: #f2c1cb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col9 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col10 {
+
+ background-color: #cbdaec;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col11 {
+
+ background-color: #c5d5ea;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col12 {
+
+ background-color: #fae6ea;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col13 {
+
+ background-color: #c6d6ea;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col14 {
+
+ background-color: #eca3b1;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col15 {
+
+ background-color: #fae4e9;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col16 {
+
+ background-color: #eeacba;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col17 {
+
+ background-color: #f6d1d8;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col18 {
+
+ background-color: #d8e3f1;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col19 {
+
+ background-color: #eb9bab;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col20 {
+
+ background-color: #a3bddd;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col21 {
+
+ background-color: #d73c5b;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col22 {
+
+ background-color: #81a4d1;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col23 {
+
+ background-color: #95b3d8;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col24 {
+
+ background-color: #4479bb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col0 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col1 {
+
+ background-color: #759ccd;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col2 {
+
+ background-color: #f2bdc8;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col3 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col4 {
+
+ background-color: #5686c1;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col5 {
+
+ background-color: #f0b5c1;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col6 {
+
+ background-color: #f4c9d2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col7 {
+
+ background-color: #628fc6;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col8 {
+
+ background-color: #e68396;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col9 {
+
+ background-color: #eda7b5;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col10 {
+
+ background-color: #f5ccd4;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col11 {
+
+ background-color: #e8eff7;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col12 {
+
+ background-color: #eaf0f7;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col13 {
+
+ background-color: #ebf1f8;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col14 {
+
+ background-color: #de5c76;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col15 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col16 {
+
+ background-color: #dd5671;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col17 {
+
+ background-color: #e993a4;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col18 {
+
+ background-color: #dae5f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col19 {
+
+ background-color: #e991a3;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col20 {
+
+ background-color: #dce6f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col21 {
+
+ background-color: #d73c5b;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col22 {
+
+ background-color: #a0bbdc;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col23 {
+
+ background-color: #96b4d9;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col24 {
+
+ background-color: #4479bb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col0 {
+
+ background-color: #d3dfef;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col1 {
+
+ background-color: #487cbc;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col2 {
+
+ background-color: #ea9aaa;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col3 {
+
+ background-color: #fae7eb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col4 {
+
+ background-color: #4479bb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col5 {
+
+ background-color: #eb9ead;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col6 {
+
+ background-color: #f3c5ce;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col7 {
+
+ background-color: #4d7fbe;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col8 {
+
+ background-color: #e994a5;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col9 {
+
+ background-color: #f6d5db;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col10 {
+
+ background-color: #f5ccd4;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col11 {
+
+ background-color: #d5e1f0;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col12 {
+
+ background-color: #f0b4c0;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col13 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col14 {
+
+ background-color: #da4966;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col15 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col16 {
+
+ background-color: #d73c5b;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col17 {
+
+ background-color: #ea96a7;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col18 {
+
+ background-color: #ecf2f8;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col19 {
+
+ background-color: #e3748a;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col20 {
+
+ background-color: #dde7f3;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col21 {
+
+ background-color: #dc516d;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col22 {
+
+ background-color: #91b0d7;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col23 {
+
+ background-color: #a8c0df;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col24 {
+
+ background-color: #5c8ac4;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col0 {
+
+ background-color: #dce6f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col1 {
+
+ background-color: #6590c7;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col2 {
+
+ background-color: #ea99a9;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col3 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col4 {
+
+ background-color: #4479bb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col5 {
+
+ background-color: #f3c5ce;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col6 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col7 {
+
+ background-color: #6a94c9;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col8 {
+
+ background-color: #f6d5db;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col9 {
+
+ background-color: #ebf1f8;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col10 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col11 {
+
+ background-color: #dfe8f3;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col12 {
+
+ background-color: #efb2bf;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col13 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col14 {
+
+ background-color: #e27389;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col15 {
+
+ background-color: #f3c5ce;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col16 {
+
+ background-color: #d73c5b;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col17 {
+
+ background-color: #ea9aaa;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col18 {
+
+ background-color: #dae5f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col19 {
+
+ background-color: #e993a4;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col20 {
+
+ background-color: #b9cde6;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col21 {
+
+ background-color: #de5f79;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col22 {
+
+ background-color: #b3c9e3;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col23 {
+
+ background-color: #9fbadc;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col24 {
+
+ background-color: #6f98ca;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col0 {
+
+ background-color: #c6d6ea;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col1 {
+
+ background-color: #6f98ca;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col2 {
+
+ background-color: #ea96a7;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col3 {
+
+ background-color: #f7dae0;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col4 {
+
+ background-color: #4479bb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col5 {
+
+ background-color: #f0b7c2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col6 {
+
+ background-color: #fae4e9;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col7 {
+
+ background-color: #759ccd;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col8 {
+
+ background-color: #f2bdc8;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col9 {
+
+ background-color: #f9e2e6;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col10 {
+
+ background-color: #fae7eb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col11 {
+
+ background-color: #cbdaec;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col12 {
+
+ background-color: #efb1be;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col13 {
+
+ background-color: #eaf0f7;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col14 {
+
+ background-color: #e0657d;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col15 {
+
+ background-color: #eca1b0;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col16 {
+
+ background-color: #d73c5b;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col17 {
+
+ background-color: #e27087;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col18 {
+
+ background-color: #f9e2e6;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col19 {
+
+ background-color: #e68699;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col20 {
+
+ background-color: #fae6ea;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col21 {
+
+ background-color: #d73c5b;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col22 {
+
+ background-color: #d1deee;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col23 {
+
+ background-color: #82a5d1;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col24 {
+
+ background-color: #7099cb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col0 {
+
+ background-color: #a9c1e0;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col1 {
+
+ background-color: #6892c8;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col2 {
+
+ background-color: #f7d6dd;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col3 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col4 {
+
+ background-color: #4479bb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col5 {
+
+ background-color: #e4ecf5;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col6 {
+
+ background-color: #d8e3f1;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col7 {
+
+ background-color: #477bbc;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col8 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col9 {
+
+ background-color: #e7eef6;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col10 {
+
+ background-color: #cbdaec;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col11 {
+
+ background-color: #a6bfde;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col12 {
+
+ background-color: #fae8ec;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col13 {
+
+ background-color: #a9c1e0;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col14 {
+
+ background-color: #e3748a;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col15 {
+
+ background-color: #ea99a9;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col16 {
+
+ background-color: #d73c5b;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col17 {
+
+ background-color: #f0b7c2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col18 {
+
+ background-color: #f6d5db;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col19 {
+
+ background-color: #eb9ead;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col20 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col21 {
+
+ background-color: #d8415f;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col22 {
+
+ background-color: #b5cae4;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col23 {
+
+ background-color: #5182bf;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col24 {
+
+ background-color: #457abb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col0 {
+
+ background-color: #92b1d7;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col1 {
+
+ background-color: #7ba0cf;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col2 {
+
+ background-color: #f3c5ce;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col3 {
+
+ background-color: #f7d7de;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col4 {
+
+ background-color: #5485c1;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col5 {
+
+ background-color: #f5cfd7;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col6 {
+
+ background-color: #d4e0ef;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col7 {
+
+ background-color: #4479bb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col8 {
+
+ background-color: #f4cad3;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col9 {
+
+ background-color: #dfe8f3;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col10 {
+
+ background-color: #b0c6e2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col11 {
+
+ background-color: #9fbadc;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col12 {
+
+ background-color: #fae8ec;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col13 {
+
+ background-color: #cad9ec;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col14 {
+
+ background-color: #e991a3;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col15 {
+
+ background-color: #eca3b1;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col16 {
+
+ background-color: #de5c76;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col17 {
+
+ background-color: #f4cad3;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col18 {
+
+ background-color: #f7dae0;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col19 {
+
+ background-color: #eb9dac;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col20 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col21 {
+
+ background-color: #d73c5b;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col22 {
+
+ background-color: #acc3e1;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col23 {
+
+ background-color: #497dbd;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col24 {
+
+ background-color: #5c8ac4;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col0 {
+
+ background-color: #bccfe7;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col1 {
+
+ background-color: #8faed6;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col2 {
+
+ background-color: #eda6b4;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col3 {
+
+ background-color: #f5ced6;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col4 {
+
+ background-color: #5c8ac4;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col5 {
+
+ background-color: #efb2bf;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col6 {
+
+ background-color: #f4cad3;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col7 {
+
+ background-color: #4479bb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col8 {
+
+ background-color: #f3c2cc;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col9 {
+
+ background-color: #fae8ec;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col10 {
+
+ background-color: #dde7f3;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col11 {
+
+ background-color: #bbcee6;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col12 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col13 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col14 {
+
+ background-color: #e78a9d;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col15 {
+
+ background-color: #eda7b5;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col16 {
+
+ background-color: #dc546f;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col17 {
+
+ background-color: #eca3b1;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col18 {
+
+ background-color: #e6edf6;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col19 {
+
+ background-color: #eeaab7;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col20 {
+
+ background-color: #f9e3e7;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col21 {
+
+ background-color: #d73c5b;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col22 {
+
+ background-color: #b8cce5;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col23 {
+
+ background-color: #7099cb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col24 {
+
+ background-color: #5e8bc4;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col0 {
+
+ background-color: #91b0d7;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col1 {
+
+ background-color: #86a8d3;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col2 {
+
+ background-color: #efb2bf;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col3 {
+
+ background-color: #f9e3e7;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col4 {
+
+ background-color: #5e8bc4;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col5 {
+
+ background-color: #f2bfca;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col6 {
+
+ background-color: #fae6ea;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col7 {
+
+ background-color: #6b95c9;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col8 {
+
+ background-color: #f3c6cf;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col9 {
+
+ background-color: #e8eff7;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col10 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col11 {
+
+ background-color: #bdd0e7;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col12 {
+
+ background-color: #95b3d8;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col13 {
+
+ background-color: #dae5f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col14 {
+
+ background-color: #eeabb8;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col15 {
+
+ background-color: #eeacba;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col16 {
+
+ background-color: #e3748a;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col17 {
+
+ background-color: #eca4b3;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col18 {
+
+ background-color: #f7d6dd;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col19 {
+
+ background-color: #f6d2d9;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col20 {
+
+ background-color: #f9e3e7;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col21 {
+
+ background-color: #d73c5b;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col22 {
+
+ background-color: #9bb7da;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col23 {
+
+ background-color: #618ec5;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col24 {
+
+ background-color: #4479bb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col0 {
+
+ background-color: #5787c2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col1 {
+
+ background-color: #5e8bc4;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col2 {
+
+ background-color: #f5cfd7;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col3 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col4 {
+
+ background-color: #5384c0;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col5 {
+
+ background-color: #f8dee3;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col6 {
+
+ background-color: #dce6f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col7 {
+
+ background-color: #5787c2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col8 {
+
+ background-color: #f9e3e7;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col9 {
+
+ background-color: #cedced;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col10 {
+
+ background-color: #dde7f3;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col11 {
+
+ background-color: #9cb8db;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col12 {
+
+ background-color: #749bcc;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col13 {
+
+ background-color: #b2c8e3;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col14 {
+
+ background-color: #f8dfe4;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col15 {
+
+ background-color: #f4c9d2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col16 {
+
+ background-color: #eeabb8;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col17 {
+
+ background-color: #f3c6cf;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col18 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col19 {
+
+ background-color: #e2eaf4;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col20 {
+
+ background-color: #dfe8f3;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col21 {
+
+ background-color: #d73c5b;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col22 {
+
+ background-color: #94b2d8;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col23 {
+
+ background-color: #4479bb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col24 {
+
+ background-color: #5384c0;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col0 {
+
+ background-color: #6993c8;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col1 {
+
+ background-color: #6590c7;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col2 {
+
+ background-color: #e2eaf4;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col3 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col4 {
+
+ background-color: #457abb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col5 {
+
+ background-color: #e3ebf5;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col6 {
+
+ background-color: #bdd0e7;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col7 {
+
+ background-color: #5384c0;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col8 {
+
+ background-color: #f7d7de;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col9 {
+
+ background-color: #96b4d9;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col10 {
+
+ background-color: #b0c6e2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col11 {
+
+ background-color: #b2c8e3;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col12 {
+
+ background-color: #4a7ebd;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col13 {
+
+ background-color: #92b1d7;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col14 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col15 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col16 {
+
+ background-color: #f4cad3;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col17 {
+
+ background-color: #ebf1f8;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col18 {
+
+ background-color: #dce6f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col19 {
+
+ background-color: #c9d8eb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col20 {
+
+ background-color: #bfd1e8;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col21 {
+
+ background-color: #d73c5b;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col22 {
+
+ background-color: #8faed6;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col23 {
+
+ background-color: #4479bb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col24 {
+
+ background-color: #5a88c3;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col0 {
+
+ background-color: #628fc6;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col1 {
+
+ background-color: #749bcc;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col2 {
+
+ background-color: #f9e2e6;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col3 {
+
+ background-color: #f8dee3;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col4 {
+
+ background-color: #5182bf;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col5 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col6 {
+
+ background-color: #d4e0ef;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col7 {
+
+ background-color: #5182bf;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col8 {
+
+ background-color: #f4cad3;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col9 {
+
+ background-color: #85a7d2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col10 {
+
+ background-color: #cbdaec;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col11 {
+
+ background-color: #bccfe7;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col12 {
+
+ background-color: #5f8cc5;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col13 {
+
+ background-color: #a2bcdd;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col14 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col15 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col16 {
+
+ background-color: #f3c6cf;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col17 {
+
+ background-color: #fae7eb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col18 {
+
+ background-color: #fbeaed;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col19 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col20 {
+
+ background-color: #b7cbe5;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col21 {
+
+ background-color: #d73c5b;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col22 {
+
+ background-color: #86a8d3;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col23 {
+
+ background-color: #4479bb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col24 {
+
+ background-color: #739acc;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col0 {
+
+ background-color: #6a94c9;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col1 {
+
+ background-color: #6d96ca;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col2 {
+
+ background-color: #f4c9d2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col3 {
+
+ background-color: #eeaebb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col4 {
+
+ background-color: #5384c0;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col5 {
+
+ background-color: #f2bfca;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col6 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col7 {
+
+ background-color: #4479bb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col8 {
+
+ background-color: #ec9faf;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col9 {
+
+ background-color: #c6d6ea;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col10 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col11 {
+
+ background-color: #dae5f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col12 {
+
+ background-color: #4c7ebd;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col13 {
+
+ background-color: #d1deee;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col14 {
+
+ background-color: #fae6ea;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col15 {
+
+ background-color: #f7d9df;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col16 {
+
+ background-color: #eeacba;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col17 {
+
+ background-color: #f6d1d8;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col18 {
+
+ background-color: #f6d2d9;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col19 {
+
+ background-color: #f4c9d2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col20 {
+
+ background-color: #bccfe7;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col21 {
+
+ background-color: #d73c5b;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col22 {
+
+ background-color: #9eb9db;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col23 {
+
+ background-color: #5485c1;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col24 {
+
+ background-color: #8babd4;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col0 {
+
+ background-color: #86a8d3;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col1 {
+
+ background-color: #5b89c3;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col2 {
+
+ background-color: #f2bfca;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col3 {
+
+ background-color: #f2bfca;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col4 {
+
+ background-color: #497dbd;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col5 {
+
+ background-color: #f2bfca;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col6 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col7 {
+
+ background-color: #5686c1;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col8 {
+
+ background-color: #eda8b6;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col9 {
+
+ background-color: #d9e4f1;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col10 {
+
+ background-color: #d5e1f0;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col11 {
+
+ background-color: #bfd1e8;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col12 {
+
+ background-color: #5787c2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col13 {
+
+ background-color: #fbeaed;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col14 {
+
+ background-color: #f8dee3;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col15 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col16 {
+
+ background-color: #eeaab7;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col17 {
+
+ background-color: #f6d1d8;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col18 {
+
+ background-color: #f7d7de;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col19 {
+
+ background-color: #f2f2f2;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col20 {
+
+ background-color: #b5cae4;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col21 {
+
+ background-color: #d73c5b;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col22 {
+
+ background-color: #9eb9db;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col23 {
+
+ background-color: #4479bb;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col24 {
+
+ background-color: #89aad4;
+
+ max-width: 80px;
+
+ font-size: 1pt;
+
+ }
+
+ </style>
+
+ <table id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb">
+
+ <caption>Hover to magify</caption>
+
+
+ <thead>
+
+ <tr>
+
+ <th class="blank">
+
+ <th class="col_heading level0 col0">0
+
+ <th class="col_heading level0 col1">1
+
+ <th class="col_heading level0 col2">2
+
+ <th class="col_heading level0 col3">3
+
+ <th class="col_heading level0 col4">4
+
+ <th class="col_heading level0 col5">5
+
+ <th class="col_heading level0 col6">6
+
+ <th class="col_heading level0 col7">7
+
+ <th class="col_heading level0 col8">8
+
+ <th class="col_heading level0 col9">9
+
+ <th class="col_heading level0 col10">10
+
+ <th class="col_heading level0 col11">11
+
+ <th class="col_heading level0 col12">12
+
+ <th class="col_heading level0 col13">13
+
+ <th class="col_heading level0 col14">14
+
+ <th class="col_heading level0 col15">15
+
+ <th class="col_heading level0 col16">16
+
+ <th class="col_heading level0 col17">17
+
+ <th class="col_heading level0 col18">18
+
+ <th class="col_heading level0 col19">19
+
+ <th class="col_heading level0 col20">20
+
+ <th class="col_heading level0 col21">21
+
+ <th class="col_heading level0 col22">22
+
+ <th class="col_heading level0 col23">23
+
+ <th class="col_heading level0 col24">24
+
+ </tr>
+
+ </thead>
+ <tbody>
+
+ <tr>
+
+ <th id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb" class="row_heading level24 row0">
+
+ 0
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col0" class="data row0 col0">
+
+ 0.23
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col1" class="data row0 col1">
+
+ 1.03
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col2" class="data row0 col2">
+
+ -0.84
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col3" class="data row0 col3">
+
+ -0.59
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col4" class="data row0 col4">
+
+ -0.96
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col5" class="data row0 col5">
+
+ -0.22
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col6" class="data row0 col6">
+
+ -0.62
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col7" class="data row0 col7">
+
+ 1.84
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col8" class="data row0 col8">
+
+ -2.05
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col9" class="data row0 col9">
+
+ 0.87
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col10" class="data row0 col10">
+
+ -0.92
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col11" class="data row0 col11">
+
+ -0.23
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col12" class="data row0 col12">
+
+ 2.15
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col13" class="data row0 col13">
+
+ -1.33
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col14" class="data row0 col14">
+
+ 0.08
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col15" class="data row0 col15">
+
+ -1.25
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col16" class="data row0 col16">
+
+ 1.2
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col17" class="data row0 col17">
+
+ -1.05
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col18" class="data row0 col18">
+
+ 1.06
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col19" class="data row0 col19">
+
+ -0.42
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col20" class="data row0 col20">
+
+ 2.29
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col21" class="data row0 col21">
+
+ -2.59
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col22" class="data row0 col22">
+
+ 2.82
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col23" class="data row0 col23">
+
+ 0.68
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col24" class="data row0 col24">
+
+ -1.58
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb" class="row_heading level24 row1">
+
+ 1
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col0" class="data row1 col0">
+
+ -1.75
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col1" class="data row1 col1">
+
+ 1.56
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col2" class="data row1 col2">
+
+ -1.13
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col3" class="data row1 col3">
+
+ -1.1
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col4" class="data row1 col4">
+
+ 1.03
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col5" class="data row1 col5">
+
+ 0.0
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col6" class="data row1 col6">
+
+ -2.46
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col7" class="data row1 col7">
+
+ 3.45
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col8" class="data row1 col8">
+
+ -1.66
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col9" class="data row1 col9">
+
+ 1.27
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col10" class="data row1 col10">
+
+ -0.52
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col11" class="data row1 col11">
+
+ -0.02
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col12" class="data row1 col12">
+
+ 1.52
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col13" class="data row1 col13">
+
+ -1.09
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col14" class="data row1 col14">
+
+ -1.86
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col15" class="data row1 col15">
+
+ -1.13
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col16" class="data row1 col16">
+
+ -0.68
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col17" class="data row1 col17">
+
+ -0.81
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col18" class="data row1 col18">
+
+ 0.35
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col19" class="data row1 col19">
+
+ -0.06
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col20" class="data row1 col20">
+
+ 1.79
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col21" class="data row1 col21">
+
+ -2.82
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col22" class="data row1 col22">
+
+ 2.26
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col23" class="data row1 col23">
+
+ 0.78
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col24" class="data row1 col24">
+
+ 0.44
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb" class="row_heading level24 row2">
+
+ 2
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col0" class="data row2 col0">
+
+ -0.65
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col1" class="data row2 col1">
+
+ 3.22
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col2" class="data row2 col2">
+
+ -1.76
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col3" class="data row2 col3">
+
+ 0.52
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col4" class="data row2 col4">
+
+ 2.2
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col5" class="data row2 col5">
+
+ -0.37
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col6" class="data row2 col6">
+
+ -3.0
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col7" class="data row2 col7">
+
+ 3.73
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col8" class="data row2 col8">
+
+ -1.87
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col9" class="data row2 col9">
+
+ 2.46
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col10" class="data row2 col10">
+
+ 0.21
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col11" class="data row2 col11">
+
+ -0.24
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col12" class="data row2 col12">
+
+ -0.1
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col13" class="data row2 col13">
+
+ -0.78
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col14" class="data row2 col14">
+
+ -3.02
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col15" class="data row2 col15">
+
+ -0.82
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col16" class="data row2 col16">
+
+ -0.21
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col17" class="data row2 col17">
+
+ -0.23
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col18" class="data row2 col18">
+
+ 0.86
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col19" class="data row2 col19">
+
+ -0.68
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col20" class="data row2 col20">
+
+ 1.45
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col21" class="data row2 col21">
+
+ -4.89
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col22" class="data row2 col22">
+
+ 3.03
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col23" class="data row2 col23">
+
+ 1.91
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col24" class="data row2 col24">
+
+ 0.61
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb" class="row_heading level24 row3">
+
+ 3
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col0" class="data row3 col0">
+
+ -1.62
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col1" class="data row3 col1">
+
+ 3.71
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col2" class="data row3 col2">
+
+ -2.31
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col3" class="data row3 col3">
+
+ 0.43
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col4" class="data row3 col4">
+
+ 4.17
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col5" class="data row3 col5">
+
+ -0.43
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col6" class="data row3 col6">
+
+ -3.86
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col7" class="data row3 col7">
+
+ 4.16
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col8" class="data row3 col8">
+
+ -2.15
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col9" class="data row3 col9">
+
+ 1.08
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col10" class="data row3 col10">
+
+ 0.12
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col11" class="data row3 col11">
+
+ 0.6
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col12" class="data row3 col12">
+
+ -0.89
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col13" class="data row3 col13">
+
+ 0.27
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col14" class="data row3 col14">
+
+ -3.67
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col15" class="data row3 col15">
+
+ -2.71
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col16" class="data row3 col16">
+
+ -0.31
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col17" class="data row3 col17">
+
+ -1.59
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col18" class="data row3 col18">
+
+ 1.35
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col19" class="data row3 col19">
+
+ -1.83
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col20" class="data row3 col20">
+
+ 0.91
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col21" class="data row3 col21">
+
+ -5.8
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col22" class="data row3 col22">
+
+ 2.81
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col23" class="data row3 col23">
+
+ 2.11
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col24" class="data row3 col24">
+
+ 0.28
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb" class="row_heading level24 row4">
+
+ 4
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col0" class="data row4 col0">
+
+ -3.35
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col1" class="data row4 col1">
+
+ 4.48
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col2" class="data row4 col2">
+
+ -1.86
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col3" class="data row4 col3">
+
+ -1.7
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col4" class="data row4 col4">
+
+ 5.19
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col5" class="data row4 col5">
+
+ -1.02
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col6" class="data row4 col6">
+
+ -3.81
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col7" class="data row4 col7">
+
+ 4.72
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col8" class="data row4 col8">
+
+ -0.72
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col9" class="data row4 col9">
+
+ 1.08
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col10" class="data row4 col10">
+
+ -0.18
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col11" class="data row4 col11">
+
+ 0.83
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col12" class="data row4 col12">
+
+ -0.22
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col13" class="data row4 col13">
+
+ -1.08
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col14" class="data row4 col14">
+
+ -4.27
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col15" class="data row4 col15">
+
+ -2.88
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col16" class="data row4 col16">
+
+ -0.97
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col17" class="data row4 col17">
+
+ -1.78
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col18" class="data row4 col18">
+
+ 1.53
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col19" class="data row4 col19">
+
+ -1.8
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col20" class="data row4 col20">
+
+ 2.21
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col21" class="data row4 col21">
+
+ -6.34
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col22" class="data row4 col22">
+
+ 3.34
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col23" class="data row4 col23">
+
+ 2.49
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col24" class="data row4 col24">
+
+ 2.09
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb" class="row_heading level24 row5">
+
+ 5
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col0" class="data row5 col0">
+
+ -0.84
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col1" class="data row5 col1">
+
+ 4.23
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col2" class="data row5 col2">
+
+ -1.65
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col3" class="data row5 col3">
+
+ -2.0
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col4" class="data row5 col4">
+
+ 5.34
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col5" class="data row5 col5">
+
+ -0.99
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col6" class="data row5 col6">
+
+ -4.13
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col7" class="data row5 col7">
+
+ 3.94
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col8" class="data row5 col8">
+
+ -1.06
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col9" class="data row5 col9">
+
+ -0.94
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col10" class="data row5 col10">
+
+ 1.24
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col11" class="data row5 col11">
+
+ 0.09
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col12" class="data row5 col12">
+
+ -1.78
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col13" class="data row5 col13">
+
+ -0.11
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col14" class="data row5 col14">
+
+ -4.45
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col15" class="data row5 col15">
+
+ -0.85
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col16" class="data row5 col16">
+
+ -2.06
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col17" class="data row5 col17">
+
+ -1.35
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col18" class="data row5 col18">
+
+ 0.8
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col19" class="data row5 col19">
+
+ -1.63
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col20" class="data row5 col20">
+
+ 1.54
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col21" class="data row5 col21">
+
+ -6.51
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col22" class="data row5 col22">
+
+ 2.8
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col23" class="data row5 col23">
+
+ 2.14
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col24" class="data row5 col24">
+
+ 3.77
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb" class="row_heading level24 row6">
+
+ 6
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col0" class="data row6 col0">
+
+ -0.74
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col1" class="data row6 col1">
+
+ 5.35
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col2" class="data row6 col2">
+
+ -2.11
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col3" class="data row6 col3">
+
+ -1.13
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col4" class="data row6 col4">
+
+ 4.2
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col5" class="data row6 col5">
+
+ -1.85
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col6" class="data row6 col6">
+
+ -3.2
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col7" class="data row6 col7">
+
+ 3.76
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col8" class="data row6 col8">
+
+ -3.22
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col9" class="data row6 col9">
+
+ -1.23
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col10" class="data row6 col10">
+
+ 0.34
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col11" class="data row6 col11">
+
+ 0.57
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col12" class="data row6 col12">
+
+ -1.82
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col13" class="data row6 col13">
+
+ 0.54
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col14" class="data row6 col14">
+
+ -4.43
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col15" class="data row6 col15">
+
+ -1.83
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col16" class="data row6 col16">
+
+ -4.03
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col17" class="data row6 col17">
+
+ -2.62
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col18" class="data row6 col18">
+
+ -0.2
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col19" class="data row6 col19">
+
+ -4.68
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col20" class="data row6 col20">
+
+ 1.93
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col21" class="data row6 col21">
+
+ -8.46
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col22" class="data row6 col22">
+
+ 3.34
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col23" class="data row6 col23">
+
+ 2.52
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col24" class="data row6 col24">
+
+ 5.81
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb" class="row_heading level24 row7">
+
+ 7
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col0" class="data row7 col0">
+
+ -0.44
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col1" class="data row7 col1">
+
+ 4.69
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col2" class="data row7 col2">
+
+ -2.3
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col3" class="data row7 col3">
+
+ -0.21
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col4" class="data row7 col4">
+
+ 5.93
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col5" class="data row7 col5">
+
+ -2.63
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col6" class="data row7 col6">
+
+ -1.83
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col7" class="data row7 col7">
+
+ 5.46
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col8" class="data row7 col8">
+
+ -4.5
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col9" class="data row7 col9">
+
+ -3.16
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col10" class="data row7 col10">
+
+ -1.73
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col11" class="data row7 col11">
+
+ 0.18
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col12" class="data row7 col12">
+
+ 0.11
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col13" class="data row7 col13">
+
+ 0.04
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col14" class="data row7 col14">
+
+ -5.99
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col15" class="data row7 col15">
+
+ -0.45
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col16" class="data row7 col16">
+
+ -6.2
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col17" class="data row7 col17">
+
+ -3.89
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col18" class="data row7 col18">
+
+ 0.71
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col19" class="data row7 col19">
+
+ -3.95
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col20" class="data row7 col20">
+
+ 0.67
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col21" class="data row7 col21">
+
+ -7.26
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col22" class="data row7 col22">
+
+ 2.97
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col23" class="data row7 col23">
+
+ 3.39
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col24" class="data row7 col24">
+
+ 6.66
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb" class="row_heading level24 row8">
+
+ 8
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col0" class="data row8 col0">
+
+ 0.92
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col1" class="data row8 col1">
+
+ 5.8
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col2" class="data row8 col2">
+
+ -3.33
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col3" class="data row8 col3">
+
+ -0.65
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col4" class="data row8 col4">
+
+ 5.99
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col5" class="data row8 col5">
+
+ -3.19
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col6" class="data row8 col6">
+
+ -1.83
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col7" class="data row8 col7">
+
+ 5.63
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col8" class="data row8 col8">
+
+ -3.53
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col9" class="data row8 col9">
+
+ -1.3
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col10" class="data row8 col10">
+
+ -1.61
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col11" class="data row8 col11">
+
+ 0.82
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col12" class="data row8 col12">
+
+ -2.45
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col13" class="data row8 col13">
+
+ -0.4
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col14" class="data row8 col14">
+
+ -6.06
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col15" class="data row8 col15">
+
+ -0.52
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col16" class="data row8 col16">
+
+ -6.6
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col17" class="data row8 col17">
+
+ -3.48
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col18" class="data row8 col18">
+
+ -0.04
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col19" class="data row8 col19">
+
+ -4.6
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col20" class="data row8 col20">
+
+ 0.51
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col21" class="data row8 col21">
+
+ -5.85
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col22" class="data row8 col22">
+
+ 3.23
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col23" class="data row8 col23">
+
+ 2.4
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col24" class="data row8 col24">
+
+ 5.08
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb" class="row_heading level24 row9">
+
+ 9
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col0" class="data row9 col0">
+
+ 0.38
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col1" class="data row9 col1">
+
+ 5.54
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col2" class="data row9 col2">
+
+ -4.49
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col3" class="data row9 col3">
+
+ -0.8
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col4" class="data row9 col4">
+
+ 7.05
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col5" class="data row9 col5">
+
+ -2.64
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col6" class="data row9 col6">
+
+ -0.44
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col7" class="data row9 col7">
+
+ 5.35
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col8" class="data row9 col8">
+
+ -1.96
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col9" class="data row9 col9">
+
+ -0.33
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col10" class="data row9 col10">
+
+ -0.8
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col11" class="data row9 col11">
+
+ 0.26
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col12" class="data row9 col12">
+
+ -3.37
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col13" class="data row9 col13">
+
+ -0.82
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col14" class="data row9 col14">
+
+ -6.05
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col15" class="data row9 col15">
+
+ -2.61
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col16" class="data row9 col16">
+
+ -8.45
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col17" class="data row9 col17">
+
+ -4.45
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col18" class="data row9 col18">
+
+ 0.41
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col19" class="data row9 col19">
+
+ -4.71
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col20" class="data row9 col20">
+
+ 1.89
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col21" class="data row9 col21">
+
+ -6.93
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col22" class="data row9 col22">
+
+ 2.14
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col23" class="data row9 col23">
+
+ 3.0
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col24" class="data row9 col24">
+
+ 5.16
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb" class="row_heading level24 row10">
+
+ 10
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col0" class="data row10 col0">
+
+ 2.06
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col1" class="data row10 col1">
+
+ 5.84
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col2" class="data row10 col2">
+
+ -3.9
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col3" class="data row10 col3">
+
+ -0.98
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col4" class="data row10 col4">
+
+ 7.78
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col5" class="data row10 col5">
+
+ -2.49
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col6" class="data row10 col6">
+
+ -0.59
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col7" class="data row10 col7">
+
+ 5.59
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col8" class="data row10 col8">
+
+ -2.22
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col9" class="data row10 col9">
+
+ -0.71
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col10" class="data row10 col10">
+
+ -0.46
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col11" class="data row10 col11">
+
+ 1.8
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col12" class="data row10 col12">
+
+ -2.79
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col13" class="data row10 col13">
+
+ 0.48
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col14" class="data row10 col14">
+
+ -5.97
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col15" class="data row10 col15">
+
+ -3.44
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col16" class="data row10 col16">
+
+ -7.77
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col17" class="data row10 col17">
+
+ -5.49
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col18" class="data row10 col18">
+
+ -0.7
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col19" class="data row10 col19">
+
+ -4.61
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col20" class="data row10 col20">
+
+ -0.52
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col21" class="data row10 col21">
+
+ -7.72
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col22" class="data row10 col22">
+
+ 1.54
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col23" class="data row10 col23">
+
+ 5.02
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col24" class="data row10 col24">
+
+ 5.81
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb" class="row_heading level24 row11">
+
+ 11
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col0" class="data row11 col0">
+
+ 1.86
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col1" class="data row11 col1">
+
+ 4.47
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col2" class="data row11 col2">
+
+ -2.17
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col3" class="data row11 col3">
+
+ -1.38
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col4" class="data row11 col4">
+
+ 5.9
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col5" class="data row11 col5">
+
+ -0.49
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col6" class="data row11 col6">
+
+ 0.02
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col7" class="data row11 col7">
+
+ 5.78
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col8" class="data row11 col8">
+
+ -1.04
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col9" class="data row11 col9">
+
+ -0.6
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col10" class="data row11 col10">
+
+ 0.49
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col11" class="data row11 col11">
+
+ 1.96
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col12" class="data row11 col12">
+
+ -1.47
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col13" class="data row11 col13">
+
+ 1.88
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col14" class="data row11 col14">
+
+ -5.92
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col15" class="data row11 col15">
+
+ -4.55
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col16" class="data row11 col16">
+
+ -8.15
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col17" class="data row11 col17">
+
+ -3.42
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col18" class="data row11 col18">
+
+ -2.24
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col19" class="data row11 col19">
+
+ -4.33
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col20" class="data row11 col20">
+
+ -1.17
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col21" class="data row11 col21">
+
+ -7.9
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col22" class="data row11 col22">
+
+ 1.36
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col23" class="data row11 col23">
+
+ 5.31
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col24" class="data row11 col24">
+
+ 5.83
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb" class="row_heading level24 row12">
+
+ 12
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col0" class="data row12 col0">
+
+ 3.19
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col1" class="data row12 col1">
+
+ 4.22
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col2" class="data row12 col2">
+
+ -3.06
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col3" class="data row12 col3">
+
+ -2.27
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col4" class="data row12 col4">
+
+ 5.93
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col5" class="data row12 col5">
+
+ -2.64
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col6" class="data row12 col6">
+
+ 0.33
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col7" class="data row12 col7">
+
+ 6.72
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col8" class="data row12 col8">
+
+ -2.84
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col9" class="data row12 col9">
+
+ -0.2
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col10" class="data row12 col10">
+
+ 1.89
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col11" class="data row12 col11">
+
+ 2.63
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col12" class="data row12 col12">
+
+ -1.53
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col13" class="data row12 col13">
+
+ 0.75
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col14" class="data row12 col14">
+
+ -5.27
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col15" class="data row12 col15">
+
+ -4.53
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col16" class="data row12 col16">
+
+ -7.57
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col17" class="data row12 col17">
+
+ -2.85
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col18" class="data row12 col18">
+
+ -2.17
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col19" class="data row12 col19">
+
+ -4.78
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col20" class="data row12 col20">
+
+ -1.13
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col21" class="data row12 col21">
+
+ -8.99
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col22" class="data row12 col22">
+
+ 2.11
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col23" class="data row12 col23">
+
+ 6.42
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col24" class="data row12 col24">
+
+ 5.6
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb" class="row_heading level24 row13">
+
+ 13
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col0" class="data row13 col0">
+
+ 2.31
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col1" class="data row13 col1">
+
+ 4.45
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col2" class="data row13 col2">
+
+ -3.87
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col3" class="data row13 col3">
+
+ -2.05
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col4" class="data row13 col4">
+
+ 6.76
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col5" class="data row13 col5">
+
+ -3.25
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col6" class="data row13 col6">
+
+ -2.17
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col7" class="data row13 col7">
+
+ 7.99
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col8" class="data row13 col8">
+
+ -2.56
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col9" class="data row13 col9">
+
+ -0.8
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col10" class="data row13 col10">
+
+ 0.71
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col11" class="data row13 col11">
+
+ 2.33
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col12" class="data row13 col12">
+
+ -0.16
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col13" class="data row13 col13">
+
+ -0.46
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col14" class="data row13 col14">
+
+ -5.1
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col15" class="data row13 col15">
+
+ -3.79
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col16" class="data row13 col16">
+
+ -7.58
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col17" class="data row13 col17">
+
+ -4.0
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col18" class="data row13 col18">
+
+ 0.33
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col19" class="data row13 col19">
+
+ -3.67
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col20" class="data row13 col20">
+
+ -1.05
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col21" class="data row13 col21">
+
+ -8.71
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col22" class="data row13 col22">
+
+ 2.47
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col23" class="data row13 col23">
+
+ 5.87
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col24" class="data row13 col24">
+
+ 6.71
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb" class="row_heading level24 row14">
+
+ 14
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col0" class="data row14 col0">
+
+ 3.78
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col1" class="data row14 col1">
+
+ 4.33
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col2" class="data row14 col2">
+
+ -3.88
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col3" class="data row14 col3">
+
+ -1.58
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col4" class="data row14 col4">
+
+ 6.22
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col5" class="data row14 col5">
+
+ -3.23
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col6" class="data row14 col6">
+
+ -1.46
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col7" class="data row14 col7">
+
+ 5.57
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col8" class="data row14 col8">
+
+ -2.93
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col9" class="data row14 col9">
+
+ -0.33
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col10" class="data row14 col10">
+
+ -0.97
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col11" class="data row14 col11">
+
+ 1.72
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col12" class="data row14 col12">
+
+ 3.61
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col13" class="data row14 col13">
+
+ 0.29
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col14" class="data row14 col14">
+
+ -4.21
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col15" class="data row14 col15">
+
+ -4.1
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col16" class="data row14 col16">
+
+ -6.68
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col17" class="data row14 col17">
+
+ -4.5
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col18" class="data row14 col18">
+
+ -2.19
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col19" class="data row14 col19">
+
+ -2.43
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col20" class="data row14 col20">
+
+ -1.64
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col21" class="data row14 col21">
+
+ -9.36
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col22" class="data row14 col22">
+
+ 3.36
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col23" class="data row14 col23">
+
+ 6.11
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col24" class="data row14 col24">
+
+ 7.53
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb" class="row_heading level24 row15">
+
+ 15
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col0" class="data row15 col0">
+
+ 5.64
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col1" class="data row15 col1">
+
+ 5.31
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col2" class="data row15 col2">
+
+ -3.98
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col3" class="data row15 col3">
+
+ -2.26
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col4" class="data row15 col4">
+
+ 5.91
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col5" class="data row15 col5">
+
+ -3.3
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col6" class="data row15 col6">
+
+ -1.03
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col7" class="data row15 col7">
+
+ 5.68
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col8" class="data row15 col8">
+
+ -3.06
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col9" class="data row15 col9">
+
+ -0.33
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col10" class="data row15 col10">
+
+ -1.16
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col11" class="data row15 col11">
+
+ 2.19
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col12" class="data row15 col12">
+
+ 4.2
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col13" class="data row15 col13">
+
+ 1.01
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col14" class="data row15 col14">
+
+ -3.22
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col15" class="data row15 col15">
+
+ -4.31
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col16" class="data row15 col16">
+
+ -5.74
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col17" class="data row15 col17">
+
+ -4.44
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col18" class="data row15 col18">
+
+ -2.3
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col19" class="data row15 col19">
+
+ -1.36
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col20" class="data row15 col20">
+
+ -1.2
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col21" class="data row15 col21">
+
+ -11.27
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col22" class="data row15 col22">
+
+ 2.59
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col23" class="data row15 col23">
+
+ 6.69
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col24" class="data row15 col24">
+
+ 5.91
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb" class="row_heading level24 row16">
+
+ 16
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col0" class="data row16 col0">
+
+ 4.08
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col1" class="data row16 col1">
+
+ 4.34
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col2" class="data row16 col2">
+
+ -2.44
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col3" class="data row16 col3">
+
+ -3.3
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col4" class="data row16 col4">
+
+ 6.04
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col5" class="data row16 col5">
+
+ -2.52
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col6" class="data row16 col6">
+
+ -0.47
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col7" class="data row16 col7">
+
+ 5.28
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col8" class="data row16 col8">
+
+ -4.84
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col9" class="data row16 col9">
+
+ 1.58
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col10" class="data row16 col10">
+
+ 0.23
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col11" class="data row16 col11">
+
+ 0.1
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col12" class="data row16 col12">
+
+ 5.79
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col13" class="data row16 col13">
+
+ 1.8
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col14" class="data row16 col14">
+
+ -3.13
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col15" class="data row16 col15">
+
+ -3.85
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col16" class="data row16 col16">
+
+ -5.53
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col17" class="data row16 col17">
+
+ -2.97
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col18" class="data row16 col18">
+
+ -2.13
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col19" class="data row16 col19">
+
+ -1.15
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col20" class="data row16 col20">
+
+ -0.56
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col21" class="data row16 col21">
+
+ -13.13
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col22" class="data row16 col22">
+
+ 2.07
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col23" class="data row16 col23">
+
+ 6.16
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col24" class="data row16 col24">
+
+ 4.94
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb" class="row_heading level24 row17">
+
+ 17
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col0" class="data row17 col0">
+
+ 5.64
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col1" class="data row17 col1">
+
+ 4.57
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col2" class="data row17 col2">
+
+ -3.53
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col3" class="data row17 col3">
+
+ -3.76
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col4" class="data row17 col4">
+
+ 6.58
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col5" class="data row17 col5">
+
+ -2.58
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col6" class="data row17 col6">
+
+ -0.75
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col7" class="data row17 col7">
+
+ 6.58
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col8" class="data row17 col8">
+
+ -4.78
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col9" class="data row17 col9">
+
+ 3.63
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col10" class="data row17 col10">
+
+ -0.29
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col11" class="data row17 col11">
+
+ 0.56
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col12" class="data row17 col12">
+
+ 5.76
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col13" class="data row17 col13">
+
+ 2.05
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col14" class="data row17 col14">
+
+ -2.27
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col15" class="data row17 col15">
+
+ -2.31
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col16" class="data row17 col16">
+
+ -4.95
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col17" class="data row17 col17">
+
+ -3.16
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col18" class="data row17 col18">
+
+ -3.06
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col19" class="data row17 col19">
+
+ -2.43
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col20" class="data row17 col20">
+
+ 0.84
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col21" class="data row17 col21">
+
+ -12.57
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col22" class="data row17 col22">
+
+ 3.56
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col23" class="data row17 col23">
+
+ 7.36
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col24" class="data row17 col24">
+
+ 4.7
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb" class="row_heading level24 row18">
+
+ 18
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col0" class="data row18 col0">
+
+ 5.99
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col1" class="data row18 col1">
+
+ 5.82
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col2" class="data row18 col2">
+
+ -2.85
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col3" class="data row18 col3">
+
+ -4.15
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col4" class="data row18 col4">
+
+ 7.12
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col5" class="data row18 col5">
+
+ -3.32
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col6" class="data row18 col6">
+
+ -1.21
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col7" class="data row18 col7">
+
+ 7.93
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col8" class="data row18 col8">
+
+ -4.85
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col9" class="data row18 col9">
+
+ 1.44
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col10" class="data row18 col10">
+
+ -0.63
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col11" class="data row18 col11">
+
+ 0.35
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col12" class="data row18 col12">
+
+ 7.47
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col13" class="data row18 col13">
+
+ 0.87
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col14" class="data row18 col14">
+
+ -1.52
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col15" class="data row18 col15">
+
+ -2.09
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col16" class="data row18 col16">
+
+ -4.23
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col17" class="data row18 col17">
+
+ -2.55
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col18" class="data row18 col18">
+
+ -2.46
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col19" class="data row18 col19">
+
+ -2.89
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col20" class="data row18 col20">
+
+ 1.9
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col21" class="data row18 col21">
+
+ -9.74
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col22" class="data row18 col22">
+
+ 3.43
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col23" class="data row18 col23">
+
+ 7.07
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col24" class="data row18 col24">
+
+ 4.39
+
+
+ </tr>
+
+ <tr>
+
+ <th id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb" class="row_heading level24 row19">
+
+ 19
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col0" class="data row19 col0">
+
+ 4.03
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col1" class="data row19 col1">
+
+ 6.23
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col2" class="data row19 col2">
+
+ -4.1
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col3" class="data row19 col3">
+
+ -4.11
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col4" class="data row19 col4">
+
+ 7.19
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col5" class="data row19 col5">
+
+ -4.1
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col6" class="data row19 col6">
+
+ -1.52
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col7" class="data row19 col7">
+
+ 6.53
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col8" class="data row19 col8">
+
+ -5.21
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col9" class="data row19 col9">
+
+ -0.24
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col10" class="data row19 col10">
+
+ 0.01
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col11" class="data row19 col11">
+
+ 1.16
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col12" class="data row19 col12">
+
+ 6.43
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col13" class="data row19 col13">
+
+ -1.97
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col14" class="data row19 col14">
+
+ -2.64
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col15" class="data row19 col15">
+
+ -1.66
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col16" class="data row19 col16">
+
+ -5.2
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col17" class="data row19 col17">
+
+ -3.25
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col18" class="data row19 col18">
+
+ -2.87
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col19" class="data row19 col19">
+
+ -1.65
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col20" class="data row19 col20">
+
+ 1.64
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col21" class="data row19 col21">
+
+ -10.66
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col22" class="data row19 col22">
+
+ 2.83
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col23" class="data row19 col23">
+
+ 7.48
+
+
+ <td id="T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col24" class="data row19 col24">
+
+ 3.94
+
+
+ </tr>
+
+ </tbody>
+ </table>
+
+</div>
+
+</div>
+
+</div>
+</div>
+
+</div>
+<div class="cell border-box-sizing text_cell rendered">
+<div class="prompt input_prompt">
+</div>
+<div class="inner_cell">
+<div class="text_cell_render border-box-sizing rendered_html">
+<h1 id="Extensibility">Extensibility<a class="anchor-link" href="#Extensibility">¶</a></h1><p>The core of pandas is, and will remain, its "high-performance, easy-to-use data structures".
+With that in mind, we hope that <code>DataFrame.style</code> accomplishes two goals</p>
+<ul>
+<li>Provide an API that is pleasing to use interactively and is "good enough" for many tasks</li>
+<li>Provide the foundations for dedicated libraries to build on</li>
+</ul>
+<p>If you build a great library on top of this, let us know and we'll <a href="http://pandas.pydata.org/pandas-docs/stable/ecosystem.html">link</a> to it.</p>
+<h2 id="Subclassing">Subclassing<a class="anchor-link" href="#Subclassing">¶</a></h2><p>This section contains a bit of information about the implementation of <code>Styler</code>.
+Since the feature is so new all of this is subject to change, even more so than the end-use API.</p>
+<p>As users apply styles (via <code>.apply</code>, <code>.applymap</code> or one of the builtins), we don't actually calculate anything.
+Instead, we append functions and arguments to a list <code>self._todo</code>.
+When asked (typically in <code>.render</code> we'll walk through the list and execute each function (this is in <code>self._compute()</code>.
+These functions update an internal <code>defaultdict(list)</code>, <code>self.ctx</code> which maps DataFrame row / column positions to CSS attribute, value pairs.</p>
+<p>We take the extra step through <code>self._todo</code> so that we can export styles and set them on other <code>Styler</code>s.</p>
+<p>Rendering uses <a href="http://jinja.pocoo.org/">Jinja</a> templates.
+The <code>.translate</code> method takes <code>self.ctx</code> and builds another dictionary ready to be passed into <code>Styler.template.render</code>, the Jinja template.</p>
+<h2 id="Alternate-templates">Alternate templates<a class="anchor-link" href="#Alternate-templates">¶</a></h2><p>We've used <a href="http://jinja.pocoo.org/">Jinja</a> templates to build up the HTML.
+The template is stored as a class variable <code>Styler.template.</code>. Subclasses can override that.</p>
+<div class="highlight"><pre><span class="k">class</span> <span class="nc">CustomStyle</span><span class="p">(</span><span class="n">Styler</span><span class="p">):</span>
+ <span class="n">template</span> <span class="o">=</span> <span class="n">Template</span><span class="p">(</span><span class="s">"""..."""</span><span class="p">)</span>
+</pre></div>
+
+</div>
+</div>
+</div>
+ </div>
+ </div>
+</body>
+</html>
diff --git a/doc/source/html-styling.ipynb b/doc/source/html-styling.ipynb
new file mode 100644
index 0000000000000..28eb1cd09bacd
--- /dev/null
+++ b/doc/source/html-styling.ipynb
@@ -0,0 +1,21062 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Conditional Formatting\n",
+ "\n",
+ "*New in version 0.17.1*\n",
+ "\n",
+ "<p style=\"color: red\">*Provisional: This is a new feature and still under development. We'll be adding features and possibly making breaking changes in future releases. We'd love to hear your [feedback](https://github.com/pydata/pandas/issues).*<p style=\"color: red\">\n",
+ "\n",
+ "You can apply **conditional formatting**, the visual styling of a DataFrame\n",
+ "depending on the data within, by using the ``DataFrame.style`` property.\n",
+ "This is a property that returns a ``pandas.Styler`` object, which has\n",
+ "useful methods for formatting and displaying DataFrames.\n",
+ "\n",
+ "The styling is accomplished using CSS.\n",
+ "You write \"style functions\" that take scalars, `DataFrame`s or `Series`, and return *like-indexed* DataFrames or Series with CSS `\"attribute: value\"` pairs for the values.\n",
+ "These functions can be incrementally passed to the `Styler` which collects the styles before rendering.\n",
+ "\n",
+ "### Contents\n",
+ "\n",
+ "- [Building Styles](#Building-Styles)\n",
+ "- [Finer Control: Slicing](#Finer-Control:-Slicing)\n",
+ "- [Builtin Styles](#Builtin-Styles)\n",
+ "- [Other options](#Other-options)\n",
+ "- [Sharing Styles](#Sharing-Styles)\n",
+ "- [Limitations](#Limitations)\n",
+ "- [Terms](#Terms)\n",
+ "- [Extensibility](#Extensibility)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Building Styles\n",
+ "\n",
+ "Pass your style functions into one of the following methods:\n",
+ "\n",
+ "- `Styler.applymap`: elementwise\n",
+ "- `Styler.apply`: column-/row-/table-wise\n",
+ "\n",
+ "Both of those methods take a function (and some other keyword arguments) and applies your function to the DataFrame in a certain way.\n",
+ "`Styler.applymap` works through the DataFrame elementwise.\n",
+ "`Styler.apply` passes each column or row into your DataFrame one-at-a-time or the entire table at once, depending on the `axis` keyword argument.\n",
+ "For columnwise use `axis=0`, rowwise use `axis=1`, and for the entire table at once use `axis=None`.\n",
+ "\n",
+ "The result of the function application, a CSS attribute-value pair, is stored in an internal dictionary on your ``Styler`` object.\n",
+ "\n",
+ "Let's see some examples."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "import pandas as pd\n",
+ "import numpy as np\n",
+ "\n",
+ "np.random.seed(24)\n",
+ "df = pd.DataFrame({'A': np.linspace(1, 10, 10)})\n",
+ "df = pd.concat([df, pd.DataFrame(np.random.randn(10, 4), columns=list('BCDE'))],\n",
+ " axis=1)\n",
+ "df.iloc[0, 2] = np.nan"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Here's a boring example of rendering a DataFrame, without any (visible) styles:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ " <style type=\"text/css\" >\n",
+ " \n",
+ " \n",
+ " </style>\n",
+ "\n",
+ " <table id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fb\">\n",
+ " \n",
+ "\n",
+ " <thead>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th class=\"blank\">\n",
+ " \n",
+ " <th class=\"col_heading level0 col0\">A\n",
+ " \n",
+ " <th class=\"col_heading level0 col1\">B\n",
+ " \n",
+ " <th class=\"col_heading level0 col2\">C\n",
+ " \n",
+ " <th class=\"col_heading level0 col3\">D\n",
+ " \n",
+ " <th class=\"col_heading level0 col4\">E\n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </thead>\n",
+ " <tbody>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fb\" class=\"row_heading level4 row0\">\n",
+ " \n",
+ " 0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow0_col0\" class=\"data row0 col0\">\n",
+ " \n",
+ " 1.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow0_col1\" class=\"data row0 col1\">\n",
+ " \n",
+ " 1.329212\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow0_col2\" class=\"data row0 col2\">\n",
+ " \n",
+ " nan\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow0_col3\" class=\"data row0 col3\">\n",
+ " \n",
+ " -0.31628\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow0_col4\" class=\"data row0 col4\">\n",
+ " \n",
+ " -0.99081\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fb\" class=\"row_heading level4 row1\">\n",
+ " \n",
+ " 1\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow1_col0\" class=\"data row1 col0\">\n",
+ " \n",
+ " 2.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow1_col1\" class=\"data row1 col1\">\n",
+ " \n",
+ " -1.070816\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow1_col2\" class=\"data row1 col2\">\n",
+ " \n",
+ " -1.438713\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow1_col3\" class=\"data row1 col3\">\n",
+ " \n",
+ " 0.564417\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow1_col4\" class=\"data row1 col4\">\n",
+ " \n",
+ " 0.295722\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fb\" class=\"row_heading level4 row2\">\n",
+ " \n",
+ " 2\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow2_col0\" class=\"data row2 col0\">\n",
+ " \n",
+ " 3.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow2_col1\" class=\"data row2 col1\">\n",
+ " \n",
+ " -1.626404\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow2_col2\" class=\"data row2 col2\">\n",
+ " \n",
+ " 0.219565\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow2_col3\" class=\"data row2 col3\">\n",
+ " \n",
+ " 0.678805\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow2_col4\" class=\"data row2 col4\">\n",
+ " \n",
+ " 1.889273\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fb\" class=\"row_heading level4 row3\">\n",
+ " \n",
+ " 3\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow3_col0\" class=\"data row3 col0\">\n",
+ " \n",
+ " 4.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow3_col1\" class=\"data row3 col1\">\n",
+ " \n",
+ " 0.961538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow3_col2\" class=\"data row3 col2\">\n",
+ " \n",
+ " 0.104011\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow3_col3\" class=\"data row3 col3\">\n",
+ " \n",
+ " -0.481165\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow3_col4\" class=\"data row3 col4\">\n",
+ " \n",
+ " 0.850229\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fb\" class=\"row_heading level4 row4\">\n",
+ " \n",
+ " 4\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow4_col0\" class=\"data row4 col0\">\n",
+ " \n",
+ " 5.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow4_col1\" class=\"data row4 col1\">\n",
+ " \n",
+ " 1.453425\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow4_col2\" class=\"data row4 col2\">\n",
+ " \n",
+ " 1.057737\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow4_col3\" class=\"data row4 col3\">\n",
+ " \n",
+ " 0.165562\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow4_col4\" class=\"data row4 col4\">\n",
+ " \n",
+ " 0.515018\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fb\" class=\"row_heading level4 row5\">\n",
+ " \n",
+ " 5\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow5_col0\" class=\"data row5 col0\">\n",
+ " \n",
+ " 6.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow5_col1\" class=\"data row5 col1\">\n",
+ " \n",
+ " -1.336936\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow5_col2\" class=\"data row5 col2\">\n",
+ " \n",
+ " 0.562861\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow5_col3\" class=\"data row5 col3\">\n",
+ " \n",
+ " 1.392855\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow5_col4\" class=\"data row5 col4\">\n",
+ " \n",
+ " -0.063328\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fb\" class=\"row_heading level4 row6\">\n",
+ " \n",
+ " 6\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow6_col0\" class=\"data row6 col0\">\n",
+ " \n",
+ " 7.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow6_col1\" class=\"data row6 col1\">\n",
+ " \n",
+ " 0.121668\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow6_col2\" class=\"data row6 col2\">\n",
+ " \n",
+ " 1.207603\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow6_col3\" class=\"data row6 col3\">\n",
+ " \n",
+ " -0.00204\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow6_col4\" class=\"data row6 col4\">\n",
+ " \n",
+ " 1.627796\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fb\" class=\"row_heading level4 row7\">\n",
+ " \n",
+ " 7\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow7_col0\" class=\"data row7 col0\">\n",
+ " \n",
+ " 8.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow7_col1\" class=\"data row7 col1\">\n",
+ " \n",
+ " 0.354493\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow7_col2\" class=\"data row7 col2\">\n",
+ " \n",
+ " 1.037528\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow7_col3\" class=\"data row7 col3\">\n",
+ " \n",
+ " -0.385684\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow7_col4\" class=\"data row7 col4\">\n",
+ " \n",
+ " 0.519818\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fb\" class=\"row_heading level4 row8\">\n",
+ " \n",
+ " 8\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow8_col0\" class=\"data row8 col0\">\n",
+ " \n",
+ " 9.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow8_col1\" class=\"data row8 col1\">\n",
+ " \n",
+ " 1.686583\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow8_col2\" class=\"data row8 col2\">\n",
+ " \n",
+ " -1.325963\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow8_col3\" class=\"data row8 col3\">\n",
+ " \n",
+ " 1.428984\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow8_col4\" class=\"data row8 col4\">\n",
+ " \n",
+ " -2.089354\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fb\" class=\"row_heading level4 row9\">\n",
+ " \n",
+ " 9\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow9_col0\" class=\"data row9 col0\">\n",
+ " \n",
+ " 10.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow9_col1\" class=\"data row9 col1\">\n",
+ " \n",
+ " -0.12982\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow9_col2\" class=\"data row9 col2\">\n",
+ " \n",
+ " 0.631523\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow9_col3\" class=\"data row9 col3\">\n",
+ " \n",
+ " -0.586538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7b9e9c2_8bd5_11e5_a332_a45e60bd97fbrow9_col4\" class=\"data row9 col4\">\n",
+ " \n",
+ " 0.29072\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </tbody>\n",
+ " </table>\n",
+ " "
+ ],
+ "text/plain": [
+ "<pandas.core.style.Styler at 0x10fc7a9b0>"
+ ]
+ },
+ "execution_count": 2,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df.style"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "*Note*: The `DataFrame.style` attribute is a propetry that returns a `Styler` object. `Styler` has a `_repr_html_` method defined on it so they are rendered automatically. If you want the actual HTML back for further processing or for writing to file call the `.render()` method which returns a string.\n",
+ "\n",
+ "The above output looks very similar to the standard DataFrame HTML representation. But we've done some work behind the scenes to attach CSS classes to each cell. We can view these by calling the `.render` method."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "['',\n",
+ " ' <style type=\"text/css\" >',\n",
+ " ' ',\n",
+ " ' ',\n",
+ " ' #T_e7c1f51a_8bd5_11e5_803e_a45e60bd97fbrow0_col2 {',\n",
+ " ' ',\n",
+ " ' background-color: red;',\n",
+ " ' ',\n",
+ " ' }',\n",
+ " ' ']"
+ ]
+ },
+ "execution_count": 3,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df.style.highlight_null().render().split('\\n')[:10]"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "The `row0_col2` is the identifier for that particular cell. We've also prepended each row/column identifier with a UUID unique to each DataFrame so that the style from one doesn't collied with the styling from another within the same notebook or page (you can set the `uuid` if you'd like to tie together the styling of two DataFrames).\n",
+ "\n",
+ "When writing style functions, you take care of producing the CSS attribute / value pairs you want. Pandas matches those up with the CSS classes that identify each cell."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Let's write a simple style function that will color negative numbers red and positive numbers black."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "def color_negative_red(val):\n",
+ " \"\"\"\n",
+ " Takes a scalar and returns a string with\n",
+ " the css property `'color: red'` for negative\n",
+ " strings, black otherwise.\n",
+ " \"\"\"\n",
+ " color = 'red' if val < 0 else 'black'\n",
+ " return 'color: %s' % color"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "In this case, the cell's style depends only on it's own value.\n",
+ "That means we should use the `Styler.applymap` method which works elementwise."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ " <style type=\"text/css\" >\n",
+ " \n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow0_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow0_col1 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow0_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow0_col3 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow0_col4 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow1_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow1_col1 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow1_col2 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow1_col3 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow1_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow2_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow2_col1 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow2_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow2_col3 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow2_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow3_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow3_col1 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow3_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow3_col3 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow3_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow4_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow4_col1 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow4_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow4_col3 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow4_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow5_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow5_col1 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow5_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow5_col3 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow5_col4 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow6_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow6_col1 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow6_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow6_col3 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow6_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow7_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow7_col1 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow7_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow7_col3 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow7_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow8_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow8_col1 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow8_col2 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow8_col3 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow8_col4 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow9_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow9_col1 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow9_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow9_col3 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow9_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " </style>\n",
+ "\n",
+ " <table id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fb\">\n",
+ " \n",
+ "\n",
+ " <thead>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th class=\"blank\">\n",
+ " \n",
+ " <th class=\"col_heading level0 col0\">A\n",
+ " \n",
+ " <th class=\"col_heading level0 col1\">B\n",
+ " \n",
+ " <th class=\"col_heading level0 col2\">C\n",
+ " \n",
+ " <th class=\"col_heading level0 col3\">D\n",
+ " \n",
+ " <th class=\"col_heading level0 col4\">E\n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </thead>\n",
+ " <tbody>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fb\" class=\"row_heading level4 row0\">\n",
+ " \n",
+ " 0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow0_col0\" class=\"data row0 col0\">\n",
+ " \n",
+ " 1.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow0_col1\" class=\"data row0 col1\">\n",
+ " \n",
+ " 1.329212\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow0_col2\" class=\"data row0 col2\">\n",
+ " \n",
+ " nan\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow0_col3\" class=\"data row0 col3\">\n",
+ " \n",
+ " -0.31628\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow0_col4\" class=\"data row0 col4\">\n",
+ " \n",
+ " -0.99081\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fb\" class=\"row_heading level4 row1\">\n",
+ " \n",
+ " 1\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow1_col0\" class=\"data row1 col0\">\n",
+ " \n",
+ " 2.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow1_col1\" class=\"data row1 col1\">\n",
+ " \n",
+ " -1.070816\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow1_col2\" class=\"data row1 col2\">\n",
+ " \n",
+ " -1.438713\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow1_col3\" class=\"data row1 col3\">\n",
+ " \n",
+ " 0.564417\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow1_col4\" class=\"data row1 col4\">\n",
+ " \n",
+ " 0.295722\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fb\" class=\"row_heading level4 row2\">\n",
+ " \n",
+ " 2\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow2_col0\" class=\"data row2 col0\">\n",
+ " \n",
+ " 3.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow2_col1\" class=\"data row2 col1\">\n",
+ " \n",
+ " -1.626404\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow2_col2\" class=\"data row2 col2\">\n",
+ " \n",
+ " 0.219565\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow2_col3\" class=\"data row2 col3\">\n",
+ " \n",
+ " 0.678805\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow2_col4\" class=\"data row2 col4\">\n",
+ " \n",
+ " 1.889273\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fb\" class=\"row_heading level4 row3\">\n",
+ " \n",
+ " 3\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow3_col0\" class=\"data row3 col0\">\n",
+ " \n",
+ " 4.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow3_col1\" class=\"data row3 col1\">\n",
+ " \n",
+ " 0.961538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow3_col2\" class=\"data row3 col2\">\n",
+ " \n",
+ " 0.104011\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow3_col3\" class=\"data row3 col3\">\n",
+ " \n",
+ " -0.481165\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow3_col4\" class=\"data row3 col4\">\n",
+ " \n",
+ " 0.850229\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fb\" class=\"row_heading level4 row4\">\n",
+ " \n",
+ " 4\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow4_col0\" class=\"data row4 col0\">\n",
+ " \n",
+ " 5.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow4_col1\" class=\"data row4 col1\">\n",
+ " \n",
+ " 1.453425\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow4_col2\" class=\"data row4 col2\">\n",
+ " \n",
+ " 1.057737\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow4_col3\" class=\"data row4 col3\">\n",
+ " \n",
+ " 0.165562\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow4_col4\" class=\"data row4 col4\">\n",
+ " \n",
+ " 0.515018\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fb\" class=\"row_heading level4 row5\">\n",
+ " \n",
+ " 5\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow5_col0\" class=\"data row5 col0\">\n",
+ " \n",
+ " 6.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow5_col1\" class=\"data row5 col1\">\n",
+ " \n",
+ " -1.336936\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow5_col2\" class=\"data row5 col2\">\n",
+ " \n",
+ " 0.562861\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow5_col3\" class=\"data row5 col3\">\n",
+ " \n",
+ " 1.392855\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow5_col4\" class=\"data row5 col4\">\n",
+ " \n",
+ " -0.063328\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fb\" class=\"row_heading level4 row6\">\n",
+ " \n",
+ " 6\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow6_col0\" class=\"data row6 col0\">\n",
+ " \n",
+ " 7.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow6_col1\" class=\"data row6 col1\">\n",
+ " \n",
+ " 0.121668\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow6_col2\" class=\"data row6 col2\">\n",
+ " \n",
+ " 1.207603\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow6_col3\" class=\"data row6 col3\">\n",
+ " \n",
+ " -0.00204\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow6_col4\" class=\"data row6 col4\">\n",
+ " \n",
+ " 1.627796\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fb\" class=\"row_heading level4 row7\">\n",
+ " \n",
+ " 7\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow7_col0\" class=\"data row7 col0\">\n",
+ " \n",
+ " 8.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow7_col1\" class=\"data row7 col1\">\n",
+ " \n",
+ " 0.354493\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow7_col2\" class=\"data row7 col2\">\n",
+ " \n",
+ " 1.037528\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow7_col3\" class=\"data row7 col3\">\n",
+ " \n",
+ " -0.385684\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow7_col4\" class=\"data row7 col4\">\n",
+ " \n",
+ " 0.519818\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fb\" class=\"row_heading level4 row8\">\n",
+ " \n",
+ " 8\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow8_col0\" class=\"data row8 col0\">\n",
+ " \n",
+ " 9.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow8_col1\" class=\"data row8 col1\">\n",
+ " \n",
+ " 1.686583\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow8_col2\" class=\"data row8 col2\">\n",
+ " \n",
+ " -1.325963\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow8_col3\" class=\"data row8 col3\">\n",
+ " \n",
+ " 1.428984\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow8_col4\" class=\"data row8 col4\">\n",
+ " \n",
+ " -2.089354\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fb\" class=\"row_heading level4 row9\">\n",
+ " \n",
+ " 9\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow9_col0\" class=\"data row9 col0\">\n",
+ " \n",
+ " 10.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow9_col1\" class=\"data row9 col1\">\n",
+ " \n",
+ " -0.12982\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow9_col2\" class=\"data row9 col2\">\n",
+ " \n",
+ " 0.631523\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow9_col3\" class=\"data row9 col3\">\n",
+ " \n",
+ " -0.586538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7c86100_8bd5_11e5_98d6_a45e60bd97fbrow9_col4\" class=\"data row9 col4\">\n",
+ " \n",
+ " 0.29072\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </tbody>\n",
+ " </table>\n",
+ " "
+ ],
+ "text/plain": [
+ "<pandas.core.style.Styler at 0x11335eac8>"
+ ]
+ },
+ "execution_count": 5,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "s = df.style.applymap(color_negative_red)\n",
+ "s"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Notice the similarity with the standard `df.applymap`, which operates on DataFrames elementwise. We want you to be able to resuse your existing knowledge of how to interact with DataFrames.\n",
+ "\n",
+ "Notice also that our function returned a string containing the CSS attribute and value, separated by a colon just like in a `<style>` tag. This will be a common theme."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Now suppose you wanted to highlight the maximum value in each column.\n",
+ "We can't use `.applymap` anymore since that operated elementwise.\n",
+ "Instead, we'll turn to `.apply` which operates columnwise (or rowwise using the `axis` keyword). Later on we'll see that something like `highlight_max` is already defined on `Styler` so you wouldn't need to write this yourself."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "def highlight_max(s):\n",
+ " '''\n",
+ " highlight the maximum in a Series yellow.\n",
+ " '''\n",
+ " is_max = s == s.max()\n",
+ " return ['background-color: yellow' if v else '' for v in is_max]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ " <style type=\"text/css\" >\n",
+ " \n",
+ " \n",
+ " #T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow2_col4 {\n",
+ " \n",
+ " background-color: yellow;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow6_col2 {\n",
+ " \n",
+ " background-color: yellow;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow8_col1 {\n",
+ " \n",
+ " background-color: yellow;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow8_col3 {\n",
+ " \n",
+ " background-color: yellow;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow9_col0 {\n",
+ " \n",
+ " background-color: yellow;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " </style>\n",
+ "\n",
+ " <table id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fb\">\n",
+ " \n",
+ "\n",
+ " <thead>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th class=\"blank\">\n",
+ " \n",
+ " <th class=\"col_heading level0 col0\">A\n",
+ " \n",
+ " <th class=\"col_heading level0 col1\">B\n",
+ " \n",
+ " <th class=\"col_heading level0 col2\">C\n",
+ " \n",
+ " <th class=\"col_heading level0 col3\">D\n",
+ " \n",
+ " <th class=\"col_heading level0 col4\">E\n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </thead>\n",
+ " <tbody>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fb\" class=\"row_heading level4 row0\">\n",
+ " \n",
+ " 0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow0_col0\" class=\"data row0 col0\">\n",
+ " \n",
+ " 1.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow0_col1\" class=\"data row0 col1\">\n",
+ " \n",
+ " 1.329212\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow0_col2\" class=\"data row0 col2\">\n",
+ " \n",
+ " nan\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow0_col3\" class=\"data row0 col3\">\n",
+ " \n",
+ " -0.31628\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow0_col4\" class=\"data row0 col4\">\n",
+ " \n",
+ " -0.99081\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fb\" class=\"row_heading level4 row1\">\n",
+ " \n",
+ " 1\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow1_col0\" class=\"data row1 col0\">\n",
+ " \n",
+ " 2.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow1_col1\" class=\"data row1 col1\">\n",
+ " \n",
+ " -1.070816\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow1_col2\" class=\"data row1 col2\">\n",
+ " \n",
+ " -1.438713\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow1_col3\" class=\"data row1 col3\">\n",
+ " \n",
+ " 0.564417\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow1_col4\" class=\"data row1 col4\">\n",
+ " \n",
+ " 0.295722\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fb\" class=\"row_heading level4 row2\">\n",
+ " \n",
+ " 2\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow2_col0\" class=\"data row2 col0\">\n",
+ " \n",
+ " 3.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow2_col1\" class=\"data row2 col1\">\n",
+ " \n",
+ " -1.626404\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow2_col2\" class=\"data row2 col2\">\n",
+ " \n",
+ " 0.219565\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow2_col3\" class=\"data row2 col3\">\n",
+ " \n",
+ " 0.678805\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow2_col4\" class=\"data row2 col4\">\n",
+ " \n",
+ " 1.889273\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fb\" class=\"row_heading level4 row3\">\n",
+ " \n",
+ " 3\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow3_col0\" class=\"data row3 col0\">\n",
+ " \n",
+ " 4.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow3_col1\" class=\"data row3 col1\">\n",
+ " \n",
+ " 0.961538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow3_col2\" class=\"data row3 col2\">\n",
+ " \n",
+ " 0.104011\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow3_col3\" class=\"data row3 col3\">\n",
+ " \n",
+ " -0.481165\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow3_col4\" class=\"data row3 col4\">\n",
+ " \n",
+ " 0.850229\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fb\" class=\"row_heading level4 row4\">\n",
+ " \n",
+ " 4\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow4_col0\" class=\"data row4 col0\">\n",
+ " \n",
+ " 5.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow4_col1\" class=\"data row4 col1\">\n",
+ " \n",
+ " 1.453425\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow4_col2\" class=\"data row4 col2\">\n",
+ " \n",
+ " 1.057737\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow4_col3\" class=\"data row4 col3\">\n",
+ " \n",
+ " 0.165562\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow4_col4\" class=\"data row4 col4\">\n",
+ " \n",
+ " 0.515018\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fb\" class=\"row_heading level4 row5\">\n",
+ " \n",
+ " 5\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow5_col0\" class=\"data row5 col0\">\n",
+ " \n",
+ " 6.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow5_col1\" class=\"data row5 col1\">\n",
+ " \n",
+ " -1.336936\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow5_col2\" class=\"data row5 col2\">\n",
+ " \n",
+ " 0.562861\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow5_col3\" class=\"data row5 col3\">\n",
+ " \n",
+ " 1.392855\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow5_col4\" class=\"data row5 col4\">\n",
+ " \n",
+ " -0.063328\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fb\" class=\"row_heading level4 row6\">\n",
+ " \n",
+ " 6\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow6_col0\" class=\"data row6 col0\">\n",
+ " \n",
+ " 7.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow6_col1\" class=\"data row6 col1\">\n",
+ " \n",
+ " 0.121668\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow6_col2\" class=\"data row6 col2\">\n",
+ " \n",
+ " 1.207603\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow6_col3\" class=\"data row6 col3\">\n",
+ " \n",
+ " -0.00204\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow6_col4\" class=\"data row6 col4\">\n",
+ " \n",
+ " 1.627796\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fb\" class=\"row_heading level4 row7\">\n",
+ " \n",
+ " 7\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow7_col0\" class=\"data row7 col0\">\n",
+ " \n",
+ " 8.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow7_col1\" class=\"data row7 col1\">\n",
+ " \n",
+ " 0.354493\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow7_col2\" class=\"data row7 col2\">\n",
+ " \n",
+ " 1.037528\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow7_col3\" class=\"data row7 col3\">\n",
+ " \n",
+ " -0.385684\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow7_col4\" class=\"data row7 col4\">\n",
+ " \n",
+ " 0.519818\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fb\" class=\"row_heading level4 row8\">\n",
+ " \n",
+ " 8\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow8_col0\" class=\"data row8 col0\">\n",
+ " \n",
+ " 9.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow8_col1\" class=\"data row8 col1\">\n",
+ " \n",
+ " 1.686583\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow8_col2\" class=\"data row8 col2\">\n",
+ " \n",
+ " -1.325963\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow8_col3\" class=\"data row8 col3\">\n",
+ " \n",
+ " 1.428984\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow8_col4\" class=\"data row8 col4\">\n",
+ " \n",
+ " -2.089354\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fb\" class=\"row_heading level4 row9\">\n",
+ " \n",
+ " 9\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow9_col0\" class=\"data row9 col0\">\n",
+ " \n",
+ " 10.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow9_col1\" class=\"data row9 col1\">\n",
+ " \n",
+ " -0.12982\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow9_col2\" class=\"data row9 col2\">\n",
+ " \n",
+ " 0.631523\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow9_col3\" class=\"data row9 col3\">\n",
+ " \n",
+ " -0.586538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7cef01a_8bd5_11e5_b697_a45e60bd97fbrow9_col4\" class=\"data row9 col4\">\n",
+ " \n",
+ " 0.29072\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </tbody>\n",
+ " </table>\n",
+ " "
+ ],
+ "text/plain": [
+ "<pandas.core.style.Styler at 0x11335eb70>"
+ ]
+ },
+ "execution_count": 7,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df.style.apply(highlight_max)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "We encourage you to use method chains to build up a style piecewise, before finally rending at the end of the chain."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ " <style type=\"text/css\" >\n",
+ " \n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow0_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow0_col1 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow0_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow0_col3 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow0_col4 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow1_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow1_col1 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow1_col2 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow1_col3 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow1_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow2_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow2_col1 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow2_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow2_col3 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow2_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " background-color: yellow;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow3_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow3_col1 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow3_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow3_col3 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow3_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow4_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow4_col1 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow4_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow4_col3 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow4_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow5_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow5_col1 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow5_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow5_col3 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow5_col4 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow6_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow6_col1 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow6_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " background-color: yellow;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow6_col3 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow6_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow7_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow7_col1 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow7_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow7_col3 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow7_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow8_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow8_col1 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " background-color: yellow;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow8_col2 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow8_col3 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " background-color: yellow;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow8_col4 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow9_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " background-color: yellow;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow9_col1 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow9_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow9_col3 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow9_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " </style>\n",
+ "\n",
+ " <table id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fb\">\n",
+ " \n",
+ "\n",
+ " <thead>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th class=\"blank\">\n",
+ " \n",
+ " <th class=\"col_heading level0 col0\">A\n",
+ " \n",
+ " <th class=\"col_heading level0 col1\">B\n",
+ " \n",
+ " <th class=\"col_heading level0 col2\">C\n",
+ " \n",
+ " <th class=\"col_heading level0 col3\">D\n",
+ " \n",
+ " <th class=\"col_heading level0 col4\">E\n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </thead>\n",
+ " <tbody>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fb\" class=\"row_heading level4 row0\">\n",
+ " \n",
+ " 0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow0_col0\" class=\"data row0 col0\">\n",
+ " \n",
+ " 1.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow0_col1\" class=\"data row0 col1\">\n",
+ " \n",
+ " 1.329212\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow0_col2\" class=\"data row0 col2\">\n",
+ " \n",
+ " nan\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow0_col3\" class=\"data row0 col3\">\n",
+ " \n",
+ " -0.31628\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow0_col4\" class=\"data row0 col4\">\n",
+ " \n",
+ " -0.99081\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fb\" class=\"row_heading level4 row1\">\n",
+ " \n",
+ " 1\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow1_col0\" class=\"data row1 col0\">\n",
+ " \n",
+ " 2.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow1_col1\" class=\"data row1 col1\">\n",
+ " \n",
+ " -1.070816\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow1_col2\" class=\"data row1 col2\">\n",
+ " \n",
+ " -1.438713\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow1_col3\" class=\"data row1 col3\">\n",
+ " \n",
+ " 0.564417\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow1_col4\" class=\"data row1 col4\">\n",
+ " \n",
+ " 0.295722\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fb\" class=\"row_heading level4 row2\">\n",
+ " \n",
+ " 2\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow2_col0\" class=\"data row2 col0\">\n",
+ " \n",
+ " 3.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow2_col1\" class=\"data row2 col1\">\n",
+ " \n",
+ " -1.626404\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow2_col2\" class=\"data row2 col2\">\n",
+ " \n",
+ " 0.219565\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow2_col3\" class=\"data row2 col3\">\n",
+ " \n",
+ " 0.678805\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow2_col4\" class=\"data row2 col4\">\n",
+ " \n",
+ " 1.889273\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fb\" class=\"row_heading level4 row3\">\n",
+ " \n",
+ " 3\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow3_col0\" class=\"data row3 col0\">\n",
+ " \n",
+ " 4.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow3_col1\" class=\"data row3 col1\">\n",
+ " \n",
+ " 0.961538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow3_col2\" class=\"data row3 col2\">\n",
+ " \n",
+ " 0.104011\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow3_col3\" class=\"data row3 col3\">\n",
+ " \n",
+ " -0.481165\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow3_col4\" class=\"data row3 col4\">\n",
+ " \n",
+ " 0.850229\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fb\" class=\"row_heading level4 row4\">\n",
+ " \n",
+ " 4\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow4_col0\" class=\"data row4 col0\">\n",
+ " \n",
+ " 5.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow4_col1\" class=\"data row4 col1\">\n",
+ " \n",
+ " 1.453425\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow4_col2\" class=\"data row4 col2\">\n",
+ " \n",
+ " 1.057737\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow4_col3\" class=\"data row4 col3\">\n",
+ " \n",
+ " 0.165562\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow4_col4\" class=\"data row4 col4\">\n",
+ " \n",
+ " 0.515018\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fb\" class=\"row_heading level4 row5\">\n",
+ " \n",
+ " 5\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow5_col0\" class=\"data row5 col0\">\n",
+ " \n",
+ " 6.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow5_col1\" class=\"data row5 col1\">\n",
+ " \n",
+ " -1.336936\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow5_col2\" class=\"data row5 col2\">\n",
+ " \n",
+ " 0.562861\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow5_col3\" class=\"data row5 col3\">\n",
+ " \n",
+ " 1.392855\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow5_col4\" class=\"data row5 col4\">\n",
+ " \n",
+ " -0.063328\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fb\" class=\"row_heading level4 row6\">\n",
+ " \n",
+ " 6\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow6_col0\" class=\"data row6 col0\">\n",
+ " \n",
+ " 7.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow6_col1\" class=\"data row6 col1\">\n",
+ " \n",
+ " 0.121668\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow6_col2\" class=\"data row6 col2\">\n",
+ " \n",
+ " 1.207603\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow6_col3\" class=\"data row6 col3\">\n",
+ " \n",
+ " -0.00204\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow6_col4\" class=\"data row6 col4\">\n",
+ " \n",
+ " 1.627796\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fb\" class=\"row_heading level4 row7\">\n",
+ " \n",
+ " 7\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow7_col0\" class=\"data row7 col0\">\n",
+ " \n",
+ " 8.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow7_col1\" class=\"data row7 col1\">\n",
+ " \n",
+ " 0.354493\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow7_col2\" class=\"data row7 col2\">\n",
+ " \n",
+ " 1.037528\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow7_col3\" class=\"data row7 col3\">\n",
+ " \n",
+ " -0.385684\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow7_col4\" class=\"data row7 col4\">\n",
+ " \n",
+ " 0.519818\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fb\" class=\"row_heading level4 row8\">\n",
+ " \n",
+ " 8\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow8_col0\" class=\"data row8 col0\">\n",
+ " \n",
+ " 9.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow8_col1\" class=\"data row8 col1\">\n",
+ " \n",
+ " 1.686583\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow8_col2\" class=\"data row8 col2\">\n",
+ " \n",
+ " -1.325963\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow8_col3\" class=\"data row8 col3\">\n",
+ " \n",
+ " 1.428984\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow8_col4\" class=\"data row8 col4\">\n",
+ " \n",
+ " -2.089354\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fb\" class=\"row_heading level4 row9\">\n",
+ " \n",
+ " 9\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow9_col0\" class=\"data row9 col0\">\n",
+ " \n",
+ " 10.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow9_col1\" class=\"data row9 col1\">\n",
+ " \n",
+ " -0.12982\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow9_col2\" class=\"data row9 col2\">\n",
+ " \n",
+ " 0.631523\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow9_col3\" class=\"data row9 col3\">\n",
+ " \n",
+ " -0.586538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7d5f8ee_8bd5_11e5_9f02_a45e60bd97fbrow9_col4\" class=\"data row9 col4\">\n",
+ " \n",
+ " 0.29072\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </tbody>\n",
+ " </table>\n",
+ " "
+ ],
+ "text/plain": [
+ "<pandas.core.style.Styler at 0x11335e630>"
+ ]
+ },
+ "execution_count": 8,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df.style.\\\n",
+ " applymap(color_negative_red).\\\n",
+ " apply(highlight_max)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Above we used `Styler.apply` to pass in each column one at a time.\n",
+ "\n",
+ "<p style=\"background-color: #DEDEBE\">*Debugging Tip*: If you're having trouble writing your style function, try just passing it into <code style=\"background-color: #DEDEBE\">df.apply</code>. <code style=\"background-color: #DEDEBE\">Styler.apply</code> uses that internally, so the result should be the same.</p>\n",
+ "\n",
+ "What if you wanted to highlight just the maximum value in the entire table?\n",
+ "Use `.apply(function, axis=None)` to indicate that your function wants the entire table, not one column or row at a time. Let's try that next.\n",
+ "\n",
+ "We'll rewrite our `highlight-max` to handle either Series (from `.apply(axis=0 or 1)`) or DataFrames (from `.apply(axis=None)`). We'll also allow the color to be adjustable, to demonstrate that `.apply`, and `.applymap` pass along keyword arguments."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "def highlight_max(data, color='yellow'):\n",
+ " '''\n",
+ " highlight the maximum in a Series or DataFrame\n",
+ " '''\n",
+ " attr = 'background-color: {}'.format(color)\n",
+ " if data.ndim == 1: # Series from .apply(axis=0) or axis=1\n",
+ " is_max = data == data.max()\n",
+ " return [attr if v else '' for v in is_max]\n",
+ " else: # from .apply(axis=None)\n",
+ " is_max = data == data.max().max()\n",
+ " return pd.DataFrame(np.where(is_max, attr, ''),\n",
+ " index=data.index, columns=data.columns)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ " <style type=\"text/css\" >\n",
+ " \n",
+ " \n",
+ " #T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow9_col0 {\n",
+ " \n",
+ " background-color: darkorange;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " </style>\n",
+ "\n",
+ " <table id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fb\">\n",
+ " \n",
+ "\n",
+ " <thead>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th class=\"blank\">\n",
+ " \n",
+ " <th class=\"col_heading level0 col0\">A\n",
+ " \n",
+ " <th class=\"col_heading level0 col1\">B\n",
+ " \n",
+ " <th class=\"col_heading level0 col2\">C\n",
+ " \n",
+ " <th class=\"col_heading level0 col3\">D\n",
+ " \n",
+ " <th class=\"col_heading level0 col4\">E\n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </thead>\n",
+ " <tbody>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fb\" class=\"row_heading level4 row0\">\n",
+ " \n",
+ " 0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow0_col0\" class=\"data row0 col0\">\n",
+ " \n",
+ " 1.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow0_col1\" class=\"data row0 col1\">\n",
+ " \n",
+ " 1.329212\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow0_col2\" class=\"data row0 col2\">\n",
+ " \n",
+ " nan\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow0_col3\" class=\"data row0 col3\">\n",
+ " \n",
+ " -0.31628\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow0_col4\" class=\"data row0 col4\">\n",
+ " \n",
+ " -0.99081\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fb\" class=\"row_heading level4 row1\">\n",
+ " \n",
+ " 1\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow1_col0\" class=\"data row1 col0\">\n",
+ " \n",
+ " 2.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow1_col1\" class=\"data row1 col1\">\n",
+ " \n",
+ " -1.070816\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow1_col2\" class=\"data row1 col2\">\n",
+ " \n",
+ " -1.438713\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow1_col3\" class=\"data row1 col3\">\n",
+ " \n",
+ " 0.564417\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow1_col4\" class=\"data row1 col4\">\n",
+ " \n",
+ " 0.295722\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fb\" class=\"row_heading level4 row2\">\n",
+ " \n",
+ " 2\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow2_col0\" class=\"data row2 col0\">\n",
+ " \n",
+ " 3.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow2_col1\" class=\"data row2 col1\">\n",
+ " \n",
+ " -1.626404\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow2_col2\" class=\"data row2 col2\">\n",
+ " \n",
+ " 0.219565\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow2_col3\" class=\"data row2 col3\">\n",
+ " \n",
+ " 0.678805\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow2_col4\" class=\"data row2 col4\">\n",
+ " \n",
+ " 1.889273\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fb\" class=\"row_heading level4 row3\">\n",
+ " \n",
+ " 3\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow3_col0\" class=\"data row3 col0\">\n",
+ " \n",
+ " 4.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow3_col1\" class=\"data row3 col1\">\n",
+ " \n",
+ " 0.961538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow3_col2\" class=\"data row3 col2\">\n",
+ " \n",
+ " 0.104011\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow3_col3\" class=\"data row3 col3\">\n",
+ " \n",
+ " -0.481165\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow3_col4\" class=\"data row3 col4\">\n",
+ " \n",
+ " 0.850229\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fb\" class=\"row_heading level4 row4\">\n",
+ " \n",
+ " 4\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow4_col0\" class=\"data row4 col0\">\n",
+ " \n",
+ " 5.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow4_col1\" class=\"data row4 col1\">\n",
+ " \n",
+ " 1.453425\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow4_col2\" class=\"data row4 col2\">\n",
+ " \n",
+ " 1.057737\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow4_col3\" class=\"data row4 col3\">\n",
+ " \n",
+ " 0.165562\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow4_col4\" class=\"data row4 col4\">\n",
+ " \n",
+ " 0.515018\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fb\" class=\"row_heading level4 row5\">\n",
+ " \n",
+ " 5\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow5_col0\" class=\"data row5 col0\">\n",
+ " \n",
+ " 6.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow5_col1\" class=\"data row5 col1\">\n",
+ " \n",
+ " -1.336936\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow5_col2\" class=\"data row5 col2\">\n",
+ " \n",
+ " 0.562861\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow5_col3\" class=\"data row5 col3\">\n",
+ " \n",
+ " 1.392855\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow5_col4\" class=\"data row5 col4\">\n",
+ " \n",
+ " -0.063328\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fb\" class=\"row_heading level4 row6\">\n",
+ " \n",
+ " 6\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow6_col0\" class=\"data row6 col0\">\n",
+ " \n",
+ " 7.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow6_col1\" class=\"data row6 col1\">\n",
+ " \n",
+ " 0.121668\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow6_col2\" class=\"data row6 col2\">\n",
+ " \n",
+ " 1.207603\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow6_col3\" class=\"data row6 col3\">\n",
+ " \n",
+ " -0.00204\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow6_col4\" class=\"data row6 col4\">\n",
+ " \n",
+ " 1.627796\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fb\" class=\"row_heading level4 row7\">\n",
+ " \n",
+ " 7\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow7_col0\" class=\"data row7 col0\">\n",
+ " \n",
+ " 8.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow7_col1\" class=\"data row7 col1\">\n",
+ " \n",
+ " 0.354493\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow7_col2\" class=\"data row7 col2\">\n",
+ " \n",
+ " 1.037528\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow7_col3\" class=\"data row7 col3\">\n",
+ " \n",
+ " -0.385684\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow7_col4\" class=\"data row7 col4\">\n",
+ " \n",
+ " 0.519818\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fb\" class=\"row_heading level4 row8\">\n",
+ " \n",
+ " 8\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow8_col0\" class=\"data row8 col0\">\n",
+ " \n",
+ " 9.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow8_col1\" class=\"data row8 col1\">\n",
+ " \n",
+ " 1.686583\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow8_col2\" class=\"data row8 col2\">\n",
+ " \n",
+ " -1.325963\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow8_col3\" class=\"data row8 col3\">\n",
+ " \n",
+ " 1.428984\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow8_col4\" class=\"data row8 col4\">\n",
+ " \n",
+ " -2.089354\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fb\" class=\"row_heading level4 row9\">\n",
+ " \n",
+ " 9\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow9_col0\" class=\"data row9 col0\">\n",
+ " \n",
+ " 10.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow9_col1\" class=\"data row9 col1\">\n",
+ " \n",
+ " -0.12982\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow9_col2\" class=\"data row9 col2\">\n",
+ " \n",
+ " 0.631523\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow9_col3\" class=\"data row9 col3\">\n",
+ " \n",
+ " -0.586538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7dc6308_8bd5_11e5_9502_a45e60bd97fbrow9_col4\" class=\"data row9 col4\">\n",
+ " \n",
+ " 0.29072\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </tbody>\n",
+ " </table>\n",
+ " "
+ ],
+ "text/plain": [
+ "<pandas.core.style.Styler at 0x113367eb8>"
+ ]
+ },
+ "execution_count": 10,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df.style.apply(highlight_max, color='darkorange', axis=None)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Building Styles Summary\n",
+ "\n",
+ "Style functions should return strings with one or more CSS `attribute: value` delimited by semicolons. Use\n",
+ "\n",
+ "- `Styler.applymap(func)` for elementwise styles\n",
+ "- `Styler.apply(func, axis=0)` for columnwise styles\n",
+ "- `Styler.apply(func, axis=1)` for rowwise styles\n",
+ "- `Styler.apply(func, axis=None)` for tablewise styles"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Finer Control: Slicing"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Both `Styler.apply`, and `Styler.applymap` accept a `subset` keyword.\n",
+ "This allows you to apply styles to specific rows or columns, without having to code that logic into your `style` function.\n",
+ "\n",
+ "The value passed to `subset` behaves simlar to slicing a DataFrame.\n",
+ "\n",
+ "- A scalar is treated as a column label\n",
+ "- A list (or series or numpy array)\n",
+ "- A tuple is treated as `(row_indexer, column_indexer)`\n",
+ "\n",
+ "Consider using `pd.IndexSlice` to construct the tuple for the last one."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ " <style type=\"text/css\" >\n",
+ " \n",
+ " \n",
+ " #T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow6_col2 {\n",
+ " \n",
+ " background-color: yellow;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow8_col1 {\n",
+ " \n",
+ " background-color: yellow;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow8_col3 {\n",
+ " \n",
+ " background-color: yellow;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " </style>\n",
+ "\n",
+ " <table id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fb\">\n",
+ " \n",
+ "\n",
+ " <thead>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th class=\"blank\">\n",
+ " \n",
+ " <th class=\"col_heading level0 col0\">A\n",
+ " \n",
+ " <th class=\"col_heading level0 col1\">B\n",
+ " \n",
+ " <th class=\"col_heading level0 col2\">C\n",
+ " \n",
+ " <th class=\"col_heading level0 col3\">D\n",
+ " \n",
+ " <th class=\"col_heading level0 col4\">E\n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </thead>\n",
+ " <tbody>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fb\" class=\"row_heading level4 row0\">\n",
+ " \n",
+ " 0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow0_col0\" class=\"data row0 col0\">\n",
+ " \n",
+ " 1.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow0_col1\" class=\"data row0 col1\">\n",
+ " \n",
+ " 1.329212\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow0_col2\" class=\"data row0 col2\">\n",
+ " \n",
+ " nan\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow0_col3\" class=\"data row0 col3\">\n",
+ " \n",
+ " -0.31628\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow0_col4\" class=\"data row0 col4\">\n",
+ " \n",
+ " -0.99081\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fb\" class=\"row_heading level4 row1\">\n",
+ " \n",
+ " 1\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow1_col0\" class=\"data row1 col0\">\n",
+ " \n",
+ " 2.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow1_col1\" class=\"data row1 col1\">\n",
+ " \n",
+ " -1.070816\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow1_col2\" class=\"data row1 col2\">\n",
+ " \n",
+ " -1.438713\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow1_col3\" class=\"data row1 col3\">\n",
+ " \n",
+ " 0.564417\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow1_col4\" class=\"data row1 col4\">\n",
+ " \n",
+ " 0.295722\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fb\" class=\"row_heading level4 row2\">\n",
+ " \n",
+ " 2\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow2_col0\" class=\"data row2 col0\">\n",
+ " \n",
+ " 3.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow2_col1\" class=\"data row2 col1\">\n",
+ " \n",
+ " -1.626404\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow2_col2\" class=\"data row2 col2\">\n",
+ " \n",
+ " 0.219565\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow2_col3\" class=\"data row2 col3\">\n",
+ " \n",
+ " 0.678805\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow2_col4\" class=\"data row2 col4\">\n",
+ " \n",
+ " 1.889273\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fb\" class=\"row_heading level4 row3\">\n",
+ " \n",
+ " 3\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow3_col0\" class=\"data row3 col0\">\n",
+ " \n",
+ " 4.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow3_col1\" class=\"data row3 col1\">\n",
+ " \n",
+ " 0.961538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow3_col2\" class=\"data row3 col2\">\n",
+ " \n",
+ " 0.104011\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow3_col3\" class=\"data row3 col3\">\n",
+ " \n",
+ " -0.481165\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow3_col4\" class=\"data row3 col4\">\n",
+ " \n",
+ " 0.850229\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fb\" class=\"row_heading level4 row4\">\n",
+ " \n",
+ " 4\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow4_col0\" class=\"data row4 col0\">\n",
+ " \n",
+ " 5.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow4_col1\" class=\"data row4 col1\">\n",
+ " \n",
+ " 1.453425\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow4_col2\" class=\"data row4 col2\">\n",
+ " \n",
+ " 1.057737\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow4_col3\" class=\"data row4 col3\">\n",
+ " \n",
+ " 0.165562\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow4_col4\" class=\"data row4 col4\">\n",
+ " \n",
+ " 0.515018\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fb\" class=\"row_heading level4 row5\">\n",
+ " \n",
+ " 5\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow5_col0\" class=\"data row5 col0\">\n",
+ " \n",
+ " 6.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow5_col1\" class=\"data row5 col1\">\n",
+ " \n",
+ " -1.336936\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow5_col2\" class=\"data row5 col2\">\n",
+ " \n",
+ " 0.562861\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow5_col3\" class=\"data row5 col3\">\n",
+ " \n",
+ " 1.392855\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow5_col4\" class=\"data row5 col4\">\n",
+ " \n",
+ " -0.063328\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fb\" class=\"row_heading level4 row6\">\n",
+ " \n",
+ " 6\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow6_col0\" class=\"data row6 col0\">\n",
+ " \n",
+ " 7.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow6_col1\" class=\"data row6 col1\">\n",
+ " \n",
+ " 0.121668\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow6_col2\" class=\"data row6 col2\">\n",
+ " \n",
+ " 1.207603\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow6_col3\" class=\"data row6 col3\">\n",
+ " \n",
+ " -0.00204\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow6_col4\" class=\"data row6 col4\">\n",
+ " \n",
+ " 1.627796\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fb\" class=\"row_heading level4 row7\">\n",
+ " \n",
+ " 7\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow7_col0\" class=\"data row7 col0\">\n",
+ " \n",
+ " 8.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow7_col1\" class=\"data row7 col1\">\n",
+ " \n",
+ " 0.354493\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow7_col2\" class=\"data row7 col2\">\n",
+ " \n",
+ " 1.037528\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow7_col3\" class=\"data row7 col3\">\n",
+ " \n",
+ " -0.385684\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow7_col4\" class=\"data row7 col4\">\n",
+ " \n",
+ " 0.519818\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fb\" class=\"row_heading level4 row8\">\n",
+ " \n",
+ " 8\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow8_col0\" class=\"data row8 col0\">\n",
+ " \n",
+ " 9.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow8_col1\" class=\"data row8 col1\">\n",
+ " \n",
+ " 1.686583\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow8_col2\" class=\"data row8 col2\">\n",
+ " \n",
+ " -1.325963\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow8_col3\" class=\"data row8 col3\">\n",
+ " \n",
+ " 1.428984\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow8_col4\" class=\"data row8 col4\">\n",
+ " \n",
+ " -2.089354\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fb\" class=\"row_heading level4 row9\">\n",
+ " \n",
+ " 9\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow9_col0\" class=\"data row9 col0\">\n",
+ " \n",
+ " 10.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow9_col1\" class=\"data row9 col1\">\n",
+ " \n",
+ " -0.12982\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow9_col2\" class=\"data row9 col2\">\n",
+ " \n",
+ " 0.631523\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow9_col3\" class=\"data row9 col3\">\n",
+ " \n",
+ " -0.586538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e11b78_8bd5_11e5_8ada_a45e60bd97fbrow9_col4\" class=\"data row9 col4\">\n",
+ " \n",
+ " 0.29072\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </tbody>\n",
+ " </table>\n",
+ " "
+ ],
+ "text/plain": [
+ "<pandas.core.style.Styler at 0x11335e978>"
+ ]
+ },
+ "execution_count": 11,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df.style.apply(highlight_max, subset=['B', 'C', 'D'])"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "For row and column slicing, any valid indexer to `.loc` will work."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 12,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ " <style type=\"text/css\" >\n",
+ " \n",
+ " \n",
+ " #T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow2_col1 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow2_col3 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow3_col1 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow3_col3 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow4_col1 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow4_col3 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow5_col1 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow5_col3 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " </style>\n",
+ "\n",
+ " <table id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fb\">\n",
+ " \n",
+ "\n",
+ " <thead>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th class=\"blank\">\n",
+ " \n",
+ " <th class=\"col_heading level0 col0\">A\n",
+ " \n",
+ " <th class=\"col_heading level0 col1\">B\n",
+ " \n",
+ " <th class=\"col_heading level0 col2\">C\n",
+ " \n",
+ " <th class=\"col_heading level0 col3\">D\n",
+ " \n",
+ " <th class=\"col_heading level0 col4\">E\n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </thead>\n",
+ " <tbody>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fb\" class=\"row_heading level4 row0\">\n",
+ " \n",
+ " 0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow0_col0\" class=\"data row0 col0\">\n",
+ " \n",
+ " 1.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow0_col1\" class=\"data row0 col1\">\n",
+ " \n",
+ " 1.329212\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow0_col2\" class=\"data row0 col2\">\n",
+ " \n",
+ " nan\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow0_col3\" class=\"data row0 col3\">\n",
+ " \n",
+ " -0.31628\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow0_col4\" class=\"data row0 col4\">\n",
+ " \n",
+ " -0.99081\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fb\" class=\"row_heading level4 row1\">\n",
+ " \n",
+ " 1\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow1_col0\" class=\"data row1 col0\">\n",
+ " \n",
+ " 2.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow1_col1\" class=\"data row1 col1\">\n",
+ " \n",
+ " -1.070816\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow1_col2\" class=\"data row1 col2\">\n",
+ " \n",
+ " -1.438713\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow1_col3\" class=\"data row1 col3\">\n",
+ " \n",
+ " 0.564417\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow1_col4\" class=\"data row1 col4\">\n",
+ " \n",
+ " 0.295722\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fb\" class=\"row_heading level4 row2\">\n",
+ " \n",
+ " 2\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow2_col0\" class=\"data row2 col0\">\n",
+ " \n",
+ " 3.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow2_col1\" class=\"data row2 col1\">\n",
+ " \n",
+ " -1.626404\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow2_col2\" class=\"data row2 col2\">\n",
+ " \n",
+ " 0.219565\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow2_col3\" class=\"data row2 col3\">\n",
+ " \n",
+ " 0.678805\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow2_col4\" class=\"data row2 col4\">\n",
+ " \n",
+ " 1.889273\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fb\" class=\"row_heading level4 row3\">\n",
+ " \n",
+ " 3\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow3_col0\" class=\"data row3 col0\">\n",
+ " \n",
+ " 4.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow3_col1\" class=\"data row3 col1\">\n",
+ " \n",
+ " 0.961538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow3_col2\" class=\"data row3 col2\">\n",
+ " \n",
+ " 0.104011\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow3_col3\" class=\"data row3 col3\">\n",
+ " \n",
+ " -0.481165\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow3_col4\" class=\"data row3 col4\">\n",
+ " \n",
+ " 0.850229\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fb\" class=\"row_heading level4 row4\">\n",
+ " \n",
+ " 4\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow4_col0\" class=\"data row4 col0\">\n",
+ " \n",
+ " 5.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow4_col1\" class=\"data row4 col1\">\n",
+ " \n",
+ " 1.453425\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow4_col2\" class=\"data row4 col2\">\n",
+ " \n",
+ " 1.057737\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow4_col3\" class=\"data row4 col3\">\n",
+ " \n",
+ " 0.165562\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow4_col4\" class=\"data row4 col4\">\n",
+ " \n",
+ " 0.515018\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fb\" class=\"row_heading level4 row5\">\n",
+ " \n",
+ " 5\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow5_col0\" class=\"data row5 col0\">\n",
+ " \n",
+ " 6.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow5_col1\" class=\"data row5 col1\">\n",
+ " \n",
+ " -1.336936\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow5_col2\" class=\"data row5 col2\">\n",
+ " \n",
+ " 0.562861\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow5_col3\" class=\"data row5 col3\">\n",
+ " \n",
+ " 1.392855\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow5_col4\" class=\"data row5 col4\">\n",
+ " \n",
+ " -0.063328\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fb\" class=\"row_heading level4 row6\">\n",
+ " \n",
+ " 6\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow6_col0\" class=\"data row6 col0\">\n",
+ " \n",
+ " 7.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow6_col1\" class=\"data row6 col1\">\n",
+ " \n",
+ " 0.121668\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow6_col2\" class=\"data row6 col2\">\n",
+ " \n",
+ " 1.207603\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow6_col3\" class=\"data row6 col3\">\n",
+ " \n",
+ " -0.00204\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow6_col4\" class=\"data row6 col4\">\n",
+ " \n",
+ " 1.627796\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fb\" class=\"row_heading level4 row7\">\n",
+ " \n",
+ " 7\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow7_col0\" class=\"data row7 col0\">\n",
+ " \n",
+ " 8.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow7_col1\" class=\"data row7 col1\">\n",
+ " \n",
+ " 0.354493\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow7_col2\" class=\"data row7 col2\">\n",
+ " \n",
+ " 1.037528\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow7_col3\" class=\"data row7 col3\">\n",
+ " \n",
+ " -0.385684\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow7_col4\" class=\"data row7 col4\">\n",
+ " \n",
+ " 0.519818\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fb\" class=\"row_heading level4 row8\">\n",
+ " \n",
+ " 8\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow8_col0\" class=\"data row8 col0\">\n",
+ " \n",
+ " 9.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow8_col1\" class=\"data row8 col1\">\n",
+ " \n",
+ " 1.686583\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow8_col2\" class=\"data row8 col2\">\n",
+ " \n",
+ " -1.325963\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow8_col3\" class=\"data row8 col3\">\n",
+ " \n",
+ " 1.428984\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow8_col4\" class=\"data row8 col4\">\n",
+ " \n",
+ " -2.089354\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fb\" class=\"row_heading level4 row9\">\n",
+ " \n",
+ " 9\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow9_col0\" class=\"data row9 col0\">\n",
+ " \n",
+ " 10.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow9_col1\" class=\"data row9 col1\">\n",
+ " \n",
+ " -0.12982\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow9_col2\" class=\"data row9 col2\">\n",
+ " \n",
+ " 0.631523\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow9_col3\" class=\"data row9 col3\">\n",
+ " \n",
+ " -0.586538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e48dba_8bd5_11e5_b1bc_a45e60bd97fbrow9_col4\" class=\"data row9 col4\">\n",
+ " \n",
+ " 0.29072\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </tbody>\n",
+ " </table>\n",
+ " "
+ ],
+ "text/plain": [
+ "<pandas.core.style.Styler at 0x11335e940>"
+ ]
+ },
+ "execution_count": 12,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df.style.applymap(color_negative_red,\n",
+ " subset=pd.IndexSlice[2:5, ['B', 'D']])"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Only label-based slicing is supported right now, not positional.\n",
+ "\n",
+ "If your style function uses a `subset` or `axis` keyword argument, consider wrapping your function in a `functools.partial`, partialing out that keyword.\n",
+ "\n",
+ "```python\n",
+ "my_func2 = functools.partial(my_func, subset=42)\n",
+ "```"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Builtin Styles"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Finally, we expect certain styling functions to be common enough that we've included a few \"built-in\" to the `Styler`, so you don't have to write them yourself."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 13,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ " <style type=\"text/css\" >\n",
+ " \n",
+ " \n",
+ " #T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow0_col2 {\n",
+ " \n",
+ " background-color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " </style>\n",
+ "\n",
+ " <table id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fb\">\n",
+ " \n",
+ "\n",
+ " <thead>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th class=\"blank\">\n",
+ " \n",
+ " <th class=\"col_heading level0 col0\">A\n",
+ " \n",
+ " <th class=\"col_heading level0 col1\">B\n",
+ " \n",
+ " <th class=\"col_heading level0 col2\">C\n",
+ " \n",
+ " <th class=\"col_heading level0 col3\">D\n",
+ " \n",
+ " <th class=\"col_heading level0 col4\">E\n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </thead>\n",
+ " <tbody>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fb\" class=\"row_heading level4 row0\">\n",
+ " \n",
+ " 0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow0_col0\" class=\"data row0 col0\">\n",
+ " \n",
+ " 1.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow0_col1\" class=\"data row0 col1\">\n",
+ " \n",
+ " 1.329212\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow0_col2\" class=\"data row0 col2\">\n",
+ " \n",
+ " nan\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow0_col3\" class=\"data row0 col3\">\n",
+ " \n",
+ " -0.31628\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow0_col4\" class=\"data row0 col4\">\n",
+ " \n",
+ " -0.99081\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fb\" class=\"row_heading level4 row1\">\n",
+ " \n",
+ " 1\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow1_col0\" class=\"data row1 col0\">\n",
+ " \n",
+ " 2.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow1_col1\" class=\"data row1 col1\">\n",
+ " \n",
+ " -1.070816\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow1_col2\" class=\"data row1 col2\">\n",
+ " \n",
+ " -1.438713\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow1_col3\" class=\"data row1 col3\">\n",
+ " \n",
+ " 0.564417\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow1_col4\" class=\"data row1 col4\">\n",
+ " \n",
+ " 0.295722\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fb\" class=\"row_heading level4 row2\">\n",
+ " \n",
+ " 2\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow2_col0\" class=\"data row2 col0\">\n",
+ " \n",
+ " 3.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow2_col1\" class=\"data row2 col1\">\n",
+ " \n",
+ " -1.626404\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow2_col2\" class=\"data row2 col2\">\n",
+ " \n",
+ " 0.219565\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow2_col3\" class=\"data row2 col3\">\n",
+ " \n",
+ " 0.678805\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow2_col4\" class=\"data row2 col4\">\n",
+ " \n",
+ " 1.889273\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fb\" class=\"row_heading level4 row3\">\n",
+ " \n",
+ " 3\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow3_col0\" class=\"data row3 col0\">\n",
+ " \n",
+ " 4.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow3_col1\" class=\"data row3 col1\">\n",
+ " \n",
+ " 0.961538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow3_col2\" class=\"data row3 col2\">\n",
+ " \n",
+ " 0.104011\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow3_col3\" class=\"data row3 col3\">\n",
+ " \n",
+ " -0.481165\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow3_col4\" class=\"data row3 col4\">\n",
+ " \n",
+ " 0.850229\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fb\" class=\"row_heading level4 row4\">\n",
+ " \n",
+ " 4\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow4_col0\" class=\"data row4 col0\">\n",
+ " \n",
+ " 5.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow4_col1\" class=\"data row4 col1\">\n",
+ " \n",
+ " 1.453425\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow4_col2\" class=\"data row4 col2\">\n",
+ " \n",
+ " 1.057737\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow4_col3\" class=\"data row4 col3\">\n",
+ " \n",
+ " 0.165562\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow4_col4\" class=\"data row4 col4\">\n",
+ " \n",
+ " 0.515018\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fb\" class=\"row_heading level4 row5\">\n",
+ " \n",
+ " 5\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow5_col0\" class=\"data row5 col0\">\n",
+ " \n",
+ " 6.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow5_col1\" class=\"data row5 col1\">\n",
+ " \n",
+ " -1.336936\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow5_col2\" class=\"data row5 col2\">\n",
+ " \n",
+ " 0.562861\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow5_col3\" class=\"data row5 col3\">\n",
+ " \n",
+ " 1.392855\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow5_col4\" class=\"data row5 col4\">\n",
+ " \n",
+ " -0.063328\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fb\" class=\"row_heading level4 row6\">\n",
+ " \n",
+ " 6\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow6_col0\" class=\"data row6 col0\">\n",
+ " \n",
+ " 7.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow6_col1\" class=\"data row6 col1\">\n",
+ " \n",
+ " 0.121668\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow6_col2\" class=\"data row6 col2\">\n",
+ " \n",
+ " 1.207603\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow6_col3\" class=\"data row6 col3\">\n",
+ " \n",
+ " -0.00204\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow6_col4\" class=\"data row6 col4\">\n",
+ " \n",
+ " 1.627796\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fb\" class=\"row_heading level4 row7\">\n",
+ " \n",
+ " 7\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow7_col0\" class=\"data row7 col0\">\n",
+ " \n",
+ " 8.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow7_col1\" class=\"data row7 col1\">\n",
+ " \n",
+ " 0.354493\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow7_col2\" class=\"data row7 col2\">\n",
+ " \n",
+ " 1.037528\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow7_col3\" class=\"data row7 col3\">\n",
+ " \n",
+ " -0.385684\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow7_col4\" class=\"data row7 col4\">\n",
+ " \n",
+ " 0.519818\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fb\" class=\"row_heading level4 row8\">\n",
+ " \n",
+ " 8\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow8_col0\" class=\"data row8 col0\">\n",
+ " \n",
+ " 9.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow8_col1\" class=\"data row8 col1\">\n",
+ " \n",
+ " 1.686583\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow8_col2\" class=\"data row8 col2\">\n",
+ " \n",
+ " -1.325963\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow8_col3\" class=\"data row8 col3\">\n",
+ " \n",
+ " 1.428984\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow8_col4\" class=\"data row8 col4\">\n",
+ " \n",
+ " -2.089354\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fb\" class=\"row_heading level4 row9\">\n",
+ " \n",
+ " 9\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow9_col0\" class=\"data row9 col0\">\n",
+ " \n",
+ " 10.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow9_col1\" class=\"data row9 col1\">\n",
+ " \n",
+ " -0.12982\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow9_col2\" class=\"data row9 col2\">\n",
+ " \n",
+ " 0.631523\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow9_col3\" class=\"data row9 col3\">\n",
+ " \n",
+ " -0.586538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7e9e458_8bd5_11e5_816a_a45e60bd97fbrow9_col4\" class=\"data row9 col4\">\n",
+ " \n",
+ " 0.29072\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </tbody>\n",
+ " </table>\n",
+ " "
+ ],
+ "text/plain": [
+ "<pandas.core.style.Styler at 0x11335e2b0>"
+ ]
+ },
+ "execution_count": 13,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df.style.highlight_null(null_color='red')"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "You can create \"heatmaps\" with the `background_gradient` method. These require matplotlib, and we'll use [Seaborn](http://stanford.edu/~mwaskom/software/seaborn/) to get a nice colormap."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 14,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ " <style type=\"text/css\" >\n",
+ " \n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow0_col0 {\n",
+ " \n",
+ " background-color: #e5ffe5;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow0_col1 {\n",
+ " \n",
+ " background-color: #188d18;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow0_col2 {\n",
+ " \n",
+ " background-color: #e5ffe5;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow0_col3 {\n",
+ " \n",
+ " background-color: #c7eec7;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow0_col4 {\n",
+ " \n",
+ " background-color: #a6dca6;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow1_col0 {\n",
+ " \n",
+ " background-color: #ccf1cc;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow1_col1 {\n",
+ " \n",
+ " background-color: #c0eac0;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow1_col2 {\n",
+ " \n",
+ " background-color: #e5ffe5;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow1_col3 {\n",
+ " \n",
+ " background-color: #62b662;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow1_col4 {\n",
+ " \n",
+ " background-color: #5cb35c;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow2_col0 {\n",
+ " \n",
+ " background-color: #b3e3b3;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow2_col1 {\n",
+ " \n",
+ " background-color: #e5ffe5;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow2_col2 {\n",
+ " \n",
+ " background-color: #56af56;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow2_col3 {\n",
+ " \n",
+ " background-color: #56af56;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow2_col4 {\n",
+ " \n",
+ " background-color: #008000;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow3_col0 {\n",
+ " \n",
+ " background-color: #99d599;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow3_col1 {\n",
+ " \n",
+ " background-color: #329c32;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow3_col2 {\n",
+ " \n",
+ " background-color: #5fb55f;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow3_col3 {\n",
+ " \n",
+ " background-color: #daf9da;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow3_col4 {\n",
+ " \n",
+ " background-color: #3ba13b;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow4_col0 {\n",
+ " \n",
+ " background-color: #80c780;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow4_col1 {\n",
+ " \n",
+ " background-color: #108910;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow4_col2 {\n",
+ " \n",
+ " background-color: #0d870d;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow4_col3 {\n",
+ " \n",
+ " background-color: #90d090;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow4_col4 {\n",
+ " \n",
+ " background-color: #4fac4f;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow5_col0 {\n",
+ " \n",
+ " background-color: #66b866;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow5_col1 {\n",
+ " \n",
+ " background-color: #d2f4d2;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow5_col2 {\n",
+ " \n",
+ " background-color: #389f38;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow5_col3 {\n",
+ " \n",
+ " background-color: #048204;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow5_col4 {\n",
+ " \n",
+ " background-color: #70be70;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow6_col0 {\n",
+ " \n",
+ " background-color: #4daa4d;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow6_col1 {\n",
+ " \n",
+ " background-color: #6cbc6c;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow6_col2 {\n",
+ " \n",
+ " background-color: #008000;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow6_col3 {\n",
+ " \n",
+ " background-color: #a3daa3;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow6_col4 {\n",
+ " \n",
+ " background-color: #0e880e;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow7_col0 {\n",
+ " \n",
+ " background-color: #329c32;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow7_col1 {\n",
+ " \n",
+ " background-color: #5cb35c;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow7_col2 {\n",
+ " \n",
+ " background-color: #0e880e;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow7_col3 {\n",
+ " \n",
+ " background-color: #cff3cf;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow7_col4 {\n",
+ " \n",
+ " background-color: #4fac4f;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow8_col0 {\n",
+ " \n",
+ " background-color: #198e19;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow8_col1 {\n",
+ " \n",
+ " background-color: #008000;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow8_col2 {\n",
+ " \n",
+ " background-color: #dcfadc;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow8_col3 {\n",
+ " \n",
+ " background-color: #008000;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow8_col4 {\n",
+ " \n",
+ " background-color: #e5ffe5;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow9_col0 {\n",
+ " \n",
+ " background-color: #008000;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow9_col1 {\n",
+ " \n",
+ " background-color: #7ec67e;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow9_col2 {\n",
+ " \n",
+ " background-color: #319b31;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow9_col3 {\n",
+ " \n",
+ " background-color: #e5ffe5;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow9_col4 {\n",
+ " \n",
+ " background-color: #5cb35c;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " </style>\n",
+ "\n",
+ " <table id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fb\">\n",
+ " \n",
+ "\n",
+ " <thead>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th class=\"blank\">\n",
+ " \n",
+ " <th class=\"col_heading level0 col0\">A\n",
+ " \n",
+ " <th class=\"col_heading level0 col1\">B\n",
+ " \n",
+ " <th class=\"col_heading level0 col2\">C\n",
+ " \n",
+ " <th class=\"col_heading level0 col3\">D\n",
+ " \n",
+ " <th class=\"col_heading level0 col4\">E\n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </thead>\n",
+ " <tbody>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fb\" class=\"row_heading level4 row0\">\n",
+ " \n",
+ " 0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow0_col0\" class=\"data row0 col0\">\n",
+ " \n",
+ " 1.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow0_col1\" class=\"data row0 col1\">\n",
+ " \n",
+ " 1.329212\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow0_col2\" class=\"data row0 col2\">\n",
+ " \n",
+ " nan\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow0_col3\" class=\"data row0 col3\">\n",
+ " \n",
+ " -0.31628\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow0_col4\" class=\"data row0 col4\">\n",
+ " \n",
+ " -0.99081\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fb\" class=\"row_heading level4 row1\">\n",
+ " \n",
+ " 1\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow1_col0\" class=\"data row1 col0\">\n",
+ " \n",
+ " 2.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow1_col1\" class=\"data row1 col1\">\n",
+ " \n",
+ " -1.070816\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow1_col2\" class=\"data row1 col2\">\n",
+ " \n",
+ " -1.438713\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow1_col3\" class=\"data row1 col3\">\n",
+ " \n",
+ " 0.564417\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow1_col4\" class=\"data row1 col4\">\n",
+ " \n",
+ " 0.295722\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fb\" class=\"row_heading level4 row2\">\n",
+ " \n",
+ " 2\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow2_col0\" class=\"data row2 col0\">\n",
+ " \n",
+ " 3.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow2_col1\" class=\"data row2 col1\">\n",
+ " \n",
+ " -1.626404\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow2_col2\" class=\"data row2 col2\">\n",
+ " \n",
+ " 0.219565\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow2_col3\" class=\"data row2 col3\">\n",
+ " \n",
+ " 0.678805\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow2_col4\" class=\"data row2 col4\">\n",
+ " \n",
+ " 1.889273\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fb\" class=\"row_heading level4 row3\">\n",
+ " \n",
+ " 3\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow3_col0\" class=\"data row3 col0\">\n",
+ " \n",
+ " 4.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow3_col1\" class=\"data row3 col1\">\n",
+ " \n",
+ " 0.961538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow3_col2\" class=\"data row3 col2\">\n",
+ " \n",
+ " 0.104011\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow3_col3\" class=\"data row3 col3\">\n",
+ " \n",
+ " -0.481165\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow3_col4\" class=\"data row3 col4\">\n",
+ " \n",
+ " 0.850229\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fb\" class=\"row_heading level4 row4\">\n",
+ " \n",
+ " 4\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow4_col0\" class=\"data row4 col0\">\n",
+ " \n",
+ " 5.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow4_col1\" class=\"data row4 col1\">\n",
+ " \n",
+ " 1.453425\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow4_col2\" class=\"data row4 col2\">\n",
+ " \n",
+ " 1.057737\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow4_col3\" class=\"data row4 col3\">\n",
+ " \n",
+ " 0.165562\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow4_col4\" class=\"data row4 col4\">\n",
+ " \n",
+ " 0.515018\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fb\" class=\"row_heading level4 row5\">\n",
+ " \n",
+ " 5\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow5_col0\" class=\"data row5 col0\">\n",
+ " \n",
+ " 6.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow5_col1\" class=\"data row5 col1\">\n",
+ " \n",
+ " -1.336936\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow5_col2\" class=\"data row5 col2\">\n",
+ " \n",
+ " 0.562861\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow5_col3\" class=\"data row5 col3\">\n",
+ " \n",
+ " 1.392855\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow5_col4\" class=\"data row5 col4\">\n",
+ " \n",
+ " -0.063328\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fb\" class=\"row_heading level4 row6\">\n",
+ " \n",
+ " 6\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow6_col0\" class=\"data row6 col0\">\n",
+ " \n",
+ " 7.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow6_col1\" class=\"data row6 col1\">\n",
+ " \n",
+ " 0.121668\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow6_col2\" class=\"data row6 col2\">\n",
+ " \n",
+ " 1.207603\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow6_col3\" class=\"data row6 col3\">\n",
+ " \n",
+ " -0.00204\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow6_col4\" class=\"data row6 col4\">\n",
+ " \n",
+ " 1.627796\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fb\" class=\"row_heading level4 row7\">\n",
+ " \n",
+ " 7\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow7_col0\" class=\"data row7 col0\">\n",
+ " \n",
+ " 8.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow7_col1\" class=\"data row7 col1\">\n",
+ " \n",
+ " 0.354493\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow7_col2\" class=\"data row7 col2\">\n",
+ " \n",
+ " 1.037528\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow7_col3\" class=\"data row7 col3\">\n",
+ " \n",
+ " -0.385684\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow7_col4\" class=\"data row7 col4\">\n",
+ " \n",
+ " 0.519818\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fb\" class=\"row_heading level4 row8\">\n",
+ " \n",
+ " 8\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow8_col0\" class=\"data row8 col0\">\n",
+ " \n",
+ " 9.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow8_col1\" class=\"data row8 col1\">\n",
+ " \n",
+ " 1.686583\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow8_col2\" class=\"data row8 col2\">\n",
+ " \n",
+ " -1.325963\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow8_col3\" class=\"data row8 col3\">\n",
+ " \n",
+ " 1.428984\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow8_col4\" class=\"data row8 col4\">\n",
+ " \n",
+ " -2.089354\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fb\" class=\"row_heading level4 row9\">\n",
+ " \n",
+ " 9\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow9_col0\" class=\"data row9 col0\">\n",
+ " \n",
+ " 10.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow9_col1\" class=\"data row9 col1\">\n",
+ " \n",
+ " -0.12982\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow9_col2\" class=\"data row9 col2\">\n",
+ " \n",
+ " 0.631523\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow9_col3\" class=\"data row9 col3\">\n",
+ " \n",
+ " -0.586538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f06b0a_8bd5_11e5_ab2c_a45e60bd97fbrow9_col4\" class=\"data row9 col4\">\n",
+ " \n",
+ " 0.29072\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </tbody>\n",
+ " </table>\n",
+ " "
+ ],
+ "text/plain": [
+ "<pandas.core.style.Styler at 0x11335e048>"
+ ]
+ },
+ "execution_count": 14,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "import seaborn as sns\n",
+ "\n",
+ "cm = sns.light_palette(\"green\", as_cmap=True)\n",
+ "\n",
+ "s = df.style.background_gradient(cmap=cm)\n",
+ "s"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "`Styler.background_gradient` takes the keyword arguments `low` and `high`. Roughly speaking these extend the range of your data by `low` and `high` percent so that when we convert the colors, the colormap's entire range isn't used. This is useful so that you can actually read the text still."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 15,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ " <style type=\"text/css\" >\n",
+ " \n",
+ " \n",
+ " #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow0_col0 {\n",
+ " \n",
+ " background-color: #440154;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow0_col1 {\n",
+ " \n",
+ " background-color: #e5e419;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow0_col2 {\n",
+ " \n",
+ " background-color: #440154;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow0_col3 {\n",
+ " \n",
+ " background-color: #46327e;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow0_col4 {\n",
+ " \n",
+ " background-color: #440154;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow1_col0 {\n",
+ " \n",
+ " background-color: #3b528b;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow1_col1 {\n",
+ " \n",
+ " background-color: #433e85;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow1_col2 {\n",
+ " \n",
+ " background-color: #440154;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow1_col3 {\n",
+ " \n",
+ " background-color: #bddf26;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow1_col4 {\n",
+ " \n",
+ " background-color: #25838e;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow2_col0 {\n",
+ " \n",
+ " background-color: #21918c;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow2_col1 {\n",
+ " \n",
+ " background-color: #440154;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow2_col2 {\n",
+ " \n",
+ " background-color: #35b779;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow2_col3 {\n",
+ " \n",
+ " background-color: #fde725;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow2_col4 {\n",
+ " \n",
+ " background-color: #fde725;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow3_col0 {\n",
+ " \n",
+ " background-color: #5ec962;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow3_col1 {\n",
+ " \n",
+ " background-color: #95d840;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow3_col2 {\n",
+ " \n",
+ " background-color: #26ad81;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow3_col3 {\n",
+ " \n",
+ " background-color: #440154;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow3_col4 {\n",
+ " \n",
+ " background-color: #2cb17e;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow4_col0 {\n",
+ " \n",
+ " background-color: #fde725;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow4_col1 {\n",
+ " \n",
+ " background-color: #fde725;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow4_col2 {\n",
+ " \n",
+ " background-color: #fde725;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow4_col3 {\n",
+ " \n",
+ " background-color: #1f9e89;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow4_col4 {\n",
+ " \n",
+ " background-color: #1f958b;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " </style>\n",
+ "\n",
+ " <table id=\"T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fb\">\n",
+ " \n",
+ "\n",
+ " <thead>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th class=\"blank\">\n",
+ " \n",
+ " <th class=\"col_heading level0 col0\">A\n",
+ " \n",
+ " <th class=\"col_heading level0 col1\">B\n",
+ " \n",
+ " <th class=\"col_heading level0 col2\">C\n",
+ " \n",
+ " <th class=\"col_heading level0 col3\">D\n",
+ " \n",
+ " <th class=\"col_heading level0 col4\">E\n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </thead>\n",
+ " <tbody>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fb\" class=\"row_heading level4 row0\">\n",
+ " \n",
+ " 0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow0_col0\" class=\"data row0 col0\">\n",
+ " \n",
+ " 1.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow0_col1\" class=\"data row0 col1\">\n",
+ " \n",
+ " 1.329212\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow0_col2\" class=\"data row0 col2\">\n",
+ " \n",
+ " nan\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow0_col3\" class=\"data row0 col3\">\n",
+ " \n",
+ " -0.31628\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow0_col4\" class=\"data row0 col4\">\n",
+ " \n",
+ " -0.99081\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fb\" class=\"row_heading level4 row1\">\n",
+ " \n",
+ " 1\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow1_col0\" class=\"data row1 col0\">\n",
+ " \n",
+ " 2.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow1_col1\" class=\"data row1 col1\">\n",
+ " \n",
+ " -1.070816\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow1_col2\" class=\"data row1 col2\">\n",
+ " \n",
+ " -1.438713\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow1_col3\" class=\"data row1 col3\">\n",
+ " \n",
+ " 0.564417\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow1_col4\" class=\"data row1 col4\">\n",
+ " \n",
+ " 0.295722\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fb\" class=\"row_heading level4 row2\">\n",
+ " \n",
+ " 2\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow2_col0\" class=\"data row2 col0\">\n",
+ " \n",
+ " 3.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow2_col1\" class=\"data row2 col1\">\n",
+ " \n",
+ " -1.626404\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow2_col2\" class=\"data row2 col2\">\n",
+ " \n",
+ " 0.219565\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow2_col3\" class=\"data row2 col3\">\n",
+ " \n",
+ " 0.678805\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow2_col4\" class=\"data row2 col4\">\n",
+ " \n",
+ " 1.889273\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fb\" class=\"row_heading level4 row3\">\n",
+ " \n",
+ " 3\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow3_col0\" class=\"data row3 col0\">\n",
+ " \n",
+ " 4.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow3_col1\" class=\"data row3 col1\">\n",
+ " \n",
+ " 0.961538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow3_col2\" class=\"data row3 col2\">\n",
+ " \n",
+ " 0.104011\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow3_col3\" class=\"data row3 col3\">\n",
+ " \n",
+ " -0.481165\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow3_col4\" class=\"data row3 col4\">\n",
+ " \n",
+ " 0.850229\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fb\" class=\"row_heading level4 row4\">\n",
+ " \n",
+ " 4\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow4_col0\" class=\"data row4 col0\">\n",
+ " \n",
+ " 5.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow4_col1\" class=\"data row4 col1\">\n",
+ " \n",
+ " 1.453425\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow4_col2\" class=\"data row4 col2\">\n",
+ " \n",
+ " 1.057737\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow4_col3\" class=\"data row4 col3\">\n",
+ " \n",
+ " 0.165562\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7f6e65e_8bd5_11e5_942d_a45e60bd97fbrow4_col4\" class=\"data row4 col4\">\n",
+ " \n",
+ " 0.515018\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </tbody>\n",
+ " </table>\n",
+ " "
+ ],
+ "text/plain": [
+ "<pandas.core.style.Styler at 0x11335e9b0>"
+ ]
+ },
+ "execution_count": 15,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# Uses the full color range\n",
+ "df.loc[:4].style.background_gradient(cmap='viridis')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 16,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ " <style type=\"text/css\" >\n",
+ " \n",
+ " \n",
+ " #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow0_col0 {\n",
+ " \n",
+ " background-color: #31688e;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow0_col1 {\n",
+ " \n",
+ " background-color: #efe51c;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow0_col2 {\n",
+ " \n",
+ " background-color: #440154;\n",
+ " \n",
+ " background-color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow0_col3 {\n",
+ " \n",
+ " background-color: #277f8e;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow0_col4 {\n",
+ " \n",
+ " background-color: #31688e;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow1_col0 {\n",
+ " \n",
+ " background-color: #21918c;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow1_col1 {\n",
+ " \n",
+ " background-color: #25858e;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow1_col2 {\n",
+ " \n",
+ " background-color: #31688e;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow1_col3 {\n",
+ " \n",
+ " background-color: #d5e21a;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow1_col4 {\n",
+ " \n",
+ " background-color: #29af7f;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow2_col0 {\n",
+ " \n",
+ " background-color: #35b779;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow2_col1 {\n",
+ " \n",
+ " background-color: #31688e;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow2_col2 {\n",
+ " \n",
+ " background-color: #6ccd5a;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow2_col3 {\n",
+ " \n",
+ " background-color: #fde725;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow2_col4 {\n",
+ " \n",
+ " background-color: #fde725;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow3_col0 {\n",
+ " \n",
+ " background-color: #90d743;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow3_col1 {\n",
+ " \n",
+ " background-color: #b8de29;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow3_col2 {\n",
+ " \n",
+ " background-color: #5ac864;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow3_col3 {\n",
+ " \n",
+ " background-color: #31688e;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow3_col4 {\n",
+ " \n",
+ " background-color: #63cb5f;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow4_col0 {\n",
+ " \n",
+ " background-color: #fde725;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow4_col1 {\n",
+ " \n",
+ " background-color: #fde725;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow4_col2 {\n",
+ " \n",
+ " background-color: #fde725;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow4_col3 {\n",
+ " \n",
+ " background-color: #46c06f;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow4_col4 {\n",
+ " \n",
+ " background-color: #3bbb75;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " </style>\n",
+ "\n",
+ " <table id=\"T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fb\">\n",
+ " \n",
+ "\n",
+ " <thead>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th class=\"blank\">\n",
+ " \n",
+ " <th class=\"col_heading level0 col0\">A\n",
+ " \n",
+ " <th class=\"col_heading level0 col1\">B\n",
+ " \n",
+ " <th class=\"col_heading level0 col2\">C\n",
+ " \n",
+ " <th class=\"col_heading level0 col3\">D\n",
+ " \n",
+ " <th class=\"col_heading level0 col4\">E\n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </thead>\n",
+ " <tbody>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fb\" class=\"row_heading level4 row0\">\n",
+ " \n",
+ " 0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow0_col0\" class=\"data row0 col0\">\n",
+ " \n",
+ " 1.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow0_col1\" class=\"data row0 col1\">\n",
+ " \n",
+ " 1.329212\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow0_col2\" class=\"data row0 col2\">\n",
+ " \n",
+ " nan\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow0_col3\" class=\"data row0 col3\">\n",
+ " \n",
+ " -0.31628\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow0_col4\" class=\"data row0 col4\">\n",
+ " \n",
+ " -0.99081\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fb\" class=\"row_heading level4 row1\">\n",
+ " \n",
+ " 1\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow1_col0\" class=\"data row1 col0\">\n",
+ " \n",
+ " 2.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow1_col1\" class=\"data row1 col1\">\n",
+ " \n",
+ " -1.070816\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow1_col2\" class=\"data row1 col2\">\n",
+ " \n",
+ " -1.438713\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow1_col3\" class=\"data row1 col3\">\n",
+ " \n",
+ " 0.564417\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow1_col4\" class=\"data row1 col4\">\n",
+ " \n",
+ " 0.295722\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fb\" class=\"row_heading level4 row2\">\n",
+ " \n",
+ " 2\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow2_col0\" class=\"data row2 col0\">\n",
+ " \n",
+ " 3.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow2_col1\" class=\"data row2 col1\">\n",
+ " \n",
+ " -1.626404\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow2_col2\" class=\"data row2 col2\">\n",
+ " \n",
+ " 0.219565\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow2_col3\" class=\"data row2 col3\">\n",
+ " \n",
+ " 0.678805\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow2_col4\" class=\"data row2 col4\">\n",
+ " \n",
+ " 1.889273\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fb\" class=\"row_heading level4 row3\">\n",
+ " \n",
+ " 3\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow3_col0\" class=\"data row3 col0\">\n",
+ " \n",
+ " 4.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow3_col1\" class=\"data row3 col1\">\n",
+ " \n",
+ " 0.961538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow3_col2\" class=\"data row3 col2\">\n",
+ " \n",
+ " 0.104011\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow3_col3\" class=\"data row3 col3\">\n",
+ " \n",
+ " -0.481165\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow3_col4\" class=\"data row3 col4\">\n",
+ " \n",
+ " 0.850229\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fb\" class=\"row_heading level4 row4\">\n",
+ " \n",
+ " 4\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow4_col0\" class=\"data row4 col0\">\n",
+ " \n",
+ " 5.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow4_col1\" class=\"data row4 col1\">\n",
+ " \n",
+ " 1.453425\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow4_col2\" class=\"data row4 col2\">\n",
+ " \n",
+ " 1.057737\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow4_col3\" class=\"data row4 col3\">\n",
+ " \n",
+ " 0.165562\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e7fdeae4_8bd5_11e5_b0ba_a45e60bd97fbrow4_col4\" class=\"data row4 col4\">\n",
+ " \n",
+ " 0.515018\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </tbody>\n",
+ " </table>\n",
+ " "
+ ],
+ "text/plain": [
+ "<pandas.core.style.Styler at 0x113367ba8>"
+ ]
+ },
+ "execution_count": 16,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# Compreess the color range\n",
+ "(df.loc[:4]\n",
+ " .style\n",
+ " .background_gradient(cmap='viridis', low=.5, high=0)\n",
+ " .highlight_null('red'))"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "You can include \"bar charts\" in your DataFrame."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 17,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ " <style type=\"text/css\" >\n",
+ " \n",
+ " \n",
+ " #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow0_col0 {\n",
+ " \n",
+ " width: 10em;\n",
+ " \n",
+ " height: 80%;\n",
+ " \n",
+ " background: linear-gradient(90deg,#d65f5f 0.0%, transparent 0%);\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow0_col1 {\n",
+ " \n",
+ " width: 10em;\n",
+ " \n",
+ " height: 80%;\n",
+ " \n",
+ " background: linear-gradient(90deg,#d65f5f 89.21303639960456%, transparent 0%);\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow1_col0 {\n",
+ " \n",
+ " width: 10em;\n",
+ " \n",
+ " height: 80%;\n",
+ " \n",
+ " background: linear-gradient(90deg,#d65f5f 11.11111111111111%, transparent 0%);\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow1_col1 {\n",
+ " \n",
+ " width: 10em;\n",
+ " \n",
+ " height: 80%;\n",
+ " \n",
+ " background: linear-gradient(90deg,#d65f5f 16.77000113307442%, transparent 0%);\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow2_col0 {\n",
+ " \n",
+ " width: 10em;\n",
+ " \n",
+ " height: 80%;\n",
+ " \n",
+ " background: linear-gradient(90deg,#d65f5f 22.22222222222222%, transparent 0%);\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow2_col1 {\n",
+ " \n",
+ " width: 10em;\n",
+ " \n",
+ " height: 80%;\n",
+ " \n",
+ " background: linear-gradient(90deg,#d65f5f 0.0%, transparent 0%);\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow3_col0 {\n",
+ " \n",
+ " width: 10em;\n",
+ " \n",
+ " height: 80%;\n",
+ " \n",
+ " background: linear-gradient(90deg,#d65f5f 33.333333333333336%, transparent 0%);\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow3_col1 {\n",
+ " \n",
+ " width: 10em;\n",
+ " \n",
+ " height: 80%;\n",
+ " \n",
+ " background: linear-gradient(90deg,#d65f5f 78.1150827834652%, transparent 0%);\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow4_col0 {\n",
+ " \n",
+ " width: 10em;\n",
+ " \n",
+ " height: 80%;\n",
+ " \n",
+ " background: linear-gradient(90deg,#d65f5f 44.44444444444444%, transparent 0%);\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow4_col1 {\n",
+ " \n",
+ " width: 10em;\n",
+ " \n",
+ " height: 80%;\n",
+ " \n",
+ " background: linear-gradient(90deg,#d65f5f 92.96229618327422%, transparent 0%);\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow5_col0 {\n",
+ " \n",
+ " width: 10em;\n",
+ " \n",
+ " height: 80%;\n",
+ " \n",
+ " background: linear-gradient(90deg,#d65f5f 55.55555555555556%, transparent 0%);\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow5_col1 {\n",
+ " \n",
+ " width: 10em;\n",
+ " \n",
+ " height: 80%;\n",
+ " \n",
+ " background: linear-gradient(90deg,#d65f5f 8.737388253449494%, transparent 0%);\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow6_col0 {\n",
+ " \n",
+ " width: 10em;\n",
+ " \n",
+ " height: 80%;\n",
+ " \n",
+ " background: linear-gradient(90deg,#d65f5f 66.66666666666667%, transparent 0%);\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow6_col1 {\n",
+ " \n",
+ " width: 10em;\n",
+ " \n",
+ " height: 80%;\n",
+ " \n",
+ " background: linear-gradient(90deg,#d65f5f 52.764243600289866%, transparent 0%);\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow7_col0 {\n",
+ " \n",
+ " width: 10em;\n",
+ " \n",
+ " height: 80%;\n",
+ " \n",
+ " background: linear-gradient(90deg,#d65f5f 77.77777777777777%, transparent 0%);\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow7_col1 {\n",
+ " \n",
+ " width: 10em;\n",
+ " \n",
+ " height: 80%;\n",
+ " \n",
+ " background: linear-gradient(90deg,#d65f5f 59.79187201238315%, transparent 0%);\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow8_col0 {\n",
+ " \n",
+ " width: 10em;\n",
+ " \n",
+ " height: 80%;\n",
+ " \n",
+ " background: linear-gradient(90deg,#d65f5f 88.88888888888889%, transparent 0%);\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow8_col1 {\n",
+ " \n",
+ " width: 10em;\n",
+ " \n",
+ " height: 80%;\n",
+ " \n",
+ " background: linear-gradient(90deg,#d65f5f 100.00000000000001%, transparent 0%);\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow9_col0 {\n",
+ " \n",
+ " width: 10em;\n",
+ " \n",
+ " height: 80%;\n",
+ " \n",
+ " background: linear-gradient(90deg,#d65f5f 100.0%, transparent 0%);\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow9_col1 {\n",
+ " \n",
+ " width: 10em;\n",
+ " \n",
+ " height: 80%;\n",
+ " \n",
+ " background: linear-gradient(90deg,#d65f5f 45.17326030334935%, transparent 0%);\n",
+ " \n",
+ " }\n",
+ " \n",
+ " </style>\n",
+ "\n",
+ " <table id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fb\">\n",
+ " \n",
+ "\n",
+ " <thead>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th class=\"blank\">\n",
+ " \n",
+ " <th class=\"col_heading level0 col0\">A\n",
+ " \n",
+ " <th class=\"col_heading level0 col1\">B\n",
+ " \n",
+ " <th class=\"col_heading level0 col2\">C\n",
+ " \n",
+ " <th class=\"col_heading level0 col3\">D\n",
+ " \n",
+ " <th class=\"col_heading level0 col4\">E\n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </thead>\n",
+ " <tbody>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fb\" class=\"row_heading level4 row0\">\n",
+ " \n",
+ " 0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow0_col0\" class=\"data row0 col0\">\n",
+ " \n",
+ " 1.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow0_col1\" class=\"data row0 col1\">\n",
+ " \n",
+ " 1.329212\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow0_col2\" class=\"data row0 col2\">\n",
+ " \n",
+ " nan\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow0_col3\" class=\"data row0 col3\">\n",
+ " \n",
+ " -0.31628\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow0_col4\" class=\"data row0 col4\">\n",
+ " \n",
+ " -0.99081\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fb\" class=\"row_heading level4 row1\">\n",
+ " \n",
+ " 1\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow1_col0\" class=\"data row1 col0\">\n",
+ " \n",
+ " 2.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow1_col1\" class=\"data row1 col1\">\n",
+ " \n",
+ " -1.070816\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow1_col2\" class=\"data row1 col2\">\n",
+ " \n",
+ " -1.438713\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow1_col3\" class=\"data row1 col3\">\n",
+ " \n",
+ " 0.564417\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow1_col4\" class=\"data row1 col4\">\n",
+ " \n",
+ " 0.295722\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fb\" class=\"row_heading level4 row2\">\n",
+ " \n",
+ " 2\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow2_col0\" class=\"data row2 col0\">\n",
+ " \n",
+ " 3.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow2_col1\" class=\"data row2 col1\">\n",
+ " \n",
+ " -1.626404\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow2_col2\" class=\"data row2 col2\">\n",
+ " \n",
+ " 0.219565\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow2_col3\" class=\"data row2 col3\">\n",
+ " \n",
+ " 0.678805\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow2_col4\" class=\"data row2 col4\">\n",
+ " \n",
+ " 1.889273\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fb\" class=\"row_heading level4 row3\">\n",
+ " \n",
+ " 3\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow3_col0\" class=\"data row3 col0\">\n",
+ " \n",
+ " 4.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow3_col1\" class=\"data row3 col1\">\n",
+ " \n",
+ " 0.961538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow3_col2\" class=\"data row3 col2\">\n",
+ " \n",
+ " 0.104011\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow3_col3\" class=\"data row3 col3\">\n",
+ " \n",
+ " -0.481165\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow3_col4\" class=\"data row3 col4\">\n",
+ " \n",
+ " 0.850229\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fb\" class=\"row_heading level4 row4\">\n",
+ " \n",
+ " 4\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow4_col0\" class=\"data row4 col0\">\n",
+ " \n",
+ " 5.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow4_col1\" class=\"data row4 col1\">\n",
+ " \n",
+ " 1.453425\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow4_col2\" class=\"data row4 col2\">\n",
+ " \n",
+ " 1.057737\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow4_col3\" class=\"data row4 col3\">\n",
+ " \n",
+ " 0.165562\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow4_col4\" class=\"data row4 col4\">\n",
+ " \n",
+ " 0.515018\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fb\" class=\"row_heading level4 row5\">\n",
+ " \n",
+ " 5\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow5_col0\" class=\"data row5 col0\">\n",
+ " \n",
+ " 6.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow5_col1\" class=\"data row5 col1\">\n",
+ " \n",
+ " -1.336936\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow5_col2\" class=\"data row5 col2\">\n",
+ " \n",
+ " 0.562861\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow5_col3\" class=\"data row5 col3\">\n",
+ " \n",
+ " 1.392855\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow5_col4\" class=\"data row5 col4\">\n",
+ " \n",
+ " -0.063328\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fb\" class=\"row_heading level4 row6\">\n",
+ " \n",
+ " 6\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow6_col0\" class=\"data row6 col0\">\n",
+ " \n",
+ " 7.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow6_col1\" class=\"data row6 col1\">\n",
+ " \n",
+ " 0.121668\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow6_col2\" class=\"data row6 col2\">\n",
+ " \n",
+ " 1.207603\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow6_col3\" class=\"data row6 col3\">\n",
+ " \n",
+ " -0.00204\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow6_col4\" class=\"data row6 col4\">\n",
+ " \n",
+ " 1.627796\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fb\" class=\"row_heading level4 row7\">\n",
+ " \n",
+ " 7\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow7_col0\" class=\"data row7 col0\">\n",
+ " \n",
+ " 8.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow7_col1\" class=\"data row7 col1\">\n",
+ " \n",
+ " 0.354493\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow7_col2\" class=\"data row7 col2\">\n",
+ " \n",
+ " 1.037528\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow7_col3\" class=\"data row7 col3\">\n",
+ " \n",
+ " -0.385684\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow7_col4\" class=\"data row7 col4\">\n",
+ " \n",
+ " 0.519818\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fb\" class=\"row_heading level4 row8\">\n",
+ " \n",
+ " 8\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow8_col0\" class=\"data row8 col0\">\n",
+ " \n",
+ " 9.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow8_col1\" class=\"data row8 col1\">\n",
+ " \n",
+ " 1.686583\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow8_col2\" class=\"data row8 col2\">\n",
+ " \n",
+ " -1.325963\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow8_col3\" class=\"data row8 col3\">\n",
+ " \n",
+ " 1.428984\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow8_col4\" class=\"data row8 col4\">\n",
+ " \n",
+ " -2.089354\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fb\" class=\"row_heading level4 row9\">\n",
+ " \n",
+ " 9\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow9_col0\" class=\"data row9 col0\">\n",
+ " \n",
+ " 10.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow9_col1\" class=\"data row9 col1\">\n",
+ " \n",
+ " -0.12982\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow9_col2\" class=\"data row9 col2\">\n",
+ " \n",
+ " 0.631523\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow9_col3\" class=\"data row9 col3\">\n",
+ " \n",
+ " -0.586538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e802cdae_8bd5_11e5_acc8_a45e60bd97fbrow9_col4\" class=\"data row9 col4\">\n",
+ " \n",
+ " 0.29072\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </tbody>\n",
+ " </table>\n",
+ " "
+ ],
+ "text/plain": [
+ "<pandas.core.style.Styler at 0x11335ecf8>"
+ ]
+ },
+ "execution_count": 17,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df.style.bar(subset=['A', 'B'], color='#d65f5f')"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "There's also `.highlight_min` and `.highlight_max`."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 18,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ " <style type=\"text/css\" >\n",
+ " \n",
+ " \n",
+ " #T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow2_col4 {\n",
+ " \n",
+ " background-color: yellow;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow6_col2 {\n",
+ " \n",
+ " background-color: yellow;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow8_col1 {\n",
+ " \n",
+ " background-color: yellow;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow8_col3 {\n",
+ " \n",
+ " background-color: yellow;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow9_col0 {\n",
+ " \n",
+ " background-color: yellow;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " </style>\n",
+ "\n",
+ " <table id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fb\">\n",
+ " \n",
+ "\n",
+ " <thead>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th class=\"blank\">\n",
+ " \n",
+ " <th class=\"col_heading level0 col0\">A\n",
+ " \n",
+ " <th class=\"col_heading level0 col1\">B\n",
+ " \n",
+ " <th class=\"col_heading level0 col2\">C\n",
+ " \n",
+ " <th class=\"col_heading level0 col3\">D\n",
+ " \n",
+ " <th class=\"col_heading level0 col4\">E\n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </thead>\n",
+ " <tbody>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fb\" class=\"row_heading level4 row0\">\n",
+ " \n",
+ " 0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow0_col0\" class=\"data row0 col0\">\n",
+ " \n",
+ " 1.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow0_col1\" class=\"data row0 col1\">\n",
+ " \n",
+ " 1.329212\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow0_col2\" class=\"data row0 col2\">\n",
+ " \n",
+ " nan\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow0_col3\" class=\"data row0 col3\">\n",
+ " \n",
+ " -0.31628\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow0_col4\" class=\"data row0 col4\">\n",
+ " \n",
+ " -0.99081\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fb\" class=\"row_heading level4 row1\">\n",
+ " \n",
+ " 1\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow1_col0\" class=\"data row1 col0\">\n",
+ " \n",
+ " 2.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow1_col1\" class=\"data row1 col1\">\n",
+ " \n",
+ " -1.070816\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow1_col2\" class=\"data row1 col2\">\n",
+ " \n",
+ " -1.438713\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow1_col3\" class=\"data row1 col3\">\n",
+ " \n",
+ " 0.564417\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow1_col4\" class=\"data row1 col4\">\n",
+ " \n",
+ " 0.295722\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fb\" class=\"row_heading level4 row2\">\n",
+ " \n",
+ " 2\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow2_col0\" class=\"data row2 col0\">\n",
+ " \n",
+ " 3.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow2_col1\" class=\"data row2 col1\">\n",
+ " \n",
+ " -1.626404\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow2_col2\" class=\"data row2 col2\">\n",
+ " \n",
+ " 0.219565\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow2_col3\" class=\"data row2 col3\">\n",
+ " \n",
+ " 0.678805\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow2_col4\" class=\"data row2 col4\">\n",
+ " \n",
+ " 1.889273\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fb\" class=\"row_heading level4 row3\">\n",
+ " \n",
+ " 3\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow3_col0\" class=\"data row3 col0\">\n",
+ " \n",
+ " 4.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow3_col1\" class=\"data row3 col1\">\n",
+ " \n",
+ " 0.961538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow3_col2\" class=\"data row3 col2\">\n",
+ " \n",
+ " 0.104011\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow3_col3\" class=\"data row3 col3\">\n",
+ " \n",
+ " -0.481165\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow3_col4\" class=\"data row3 col4\">\n",
+ " \n",
+ " 0.850229\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fb\" class=\"row_heading level4 row4\">\n",
+ " \n",
+ " 4\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow4_col0\" class=\"data row4 col0\">\n",
+ " \n",
+ " 5.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow4_col1\" class=\"data row4 col1\">\n",
+ " \n",
+ " 1.453425\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow4_col2\" class=\"data row4 col2\">\n",
+ " \n",
+ " 1.057737\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow4_col3\" class=\"data row4 col3\">\n",
+ " \n",
+ " 0.165562\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow4_col4\" class=\"data row4 col4\">\n",
+ " \n",
+ " 0.515018\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fb\" class=\"row_heading level4 row5\">\n",
+ " \n",
+ " 5\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow5_col0\" class=\"data row5 col0\">\n",
+ " \n",
+ " 6.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow5_col1\" class=\"data row5 col1\">\n",
+ " \n",
+ " -1.336936\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow5_col2\" class=\"data row5 col2\">\n",
+ " \n",
+ " 0.562861\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow5_col3\" class=\"data row5 col3\">\n",
+ " \n",
+ " 1.392855\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow5_col4\" class=\"data row5 col4\">\n",
+ " \n",
+ " -0.063328\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fb\" class=\"row_heading level4 row6\">\n",
+ " \n",
+ " 6\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow6_col0\" class=\"data row6 col0\">\n",
+ " \n",
+ " 7.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow6_col1\" class=\"data row6 col1\">\n",
+ " \n",
+ " 0.121668\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow6_col2\" class=\"data row6 col2\">\n",
+ " \n",
+ " 1.207603\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow6_col3\" class=\"data row6 col3\">\n",
+ " \n",
+ " -0.00204\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow6_col4\" class=\"data row6 col4\">\n",
+ " \n",
+ " 1.627796\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fb\" class=\"row_heading level4 row7\">\n",
+ " \n",
+ " 7\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow7_col0\" class=\"data row7 col0\">\n",
+ " \n",
+ " 8.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow7_col1\" class=\"data row7 col1\">\n",
+ " \n",
+ " 0.354493\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow7_col2\" class=\"data row7 col2\">\n",
+ " \n",
+ " 1.037528\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow7_col3\" class=\"data row7 col3\">\n",
+ " \n",
+ " -0.385684\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow7_col4\" class=\"data row7 col4\">\n",
+ " \n",
+ " 0.519818\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fb\" class=\"row_heading level4 row8\">\n",
+ " \n",
+ " 8\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow8_col0\" class=\"data row8 col0\">\n",
+ " \n",
+ " 9.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow8_col1\" class=\"data row8 col1\">\n",
+ " \n",
+ " 1.686583\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow8_col2\" class=\"data row8 col2\">\n",
+ " \n",
+ " -1.325963\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow8_col3\" class=\"data row8 col3\">\n",
+ " \n",
+ " 1.428984\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow8_col4\" class=\"data row8 col4\">\n",
+ " \n",
+ " -2.089354\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fb\" class=\"row_heading level4 row9\">\n",
+ " \n",
+ " 9\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow9_col0\" class=\"data row9 col0\">\n",
+ " \n",
+ " 10.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow9_col1\" class=\"data row9 col1\">\n",
+ " \n",
+ " -0.12982\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow9_col2\" class=\"data row9 col2\">\n",
+ " \n",
+ " 0.631523\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow9_col3\" class=\"data row9 col3\">\n",
+ " \n",
+ " -0.586538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e80cc464_8bd5_11e5_8a2b_a45e60bd97fbrow9_col4\" class=\"data row9 col4\">\n",
+ " \n",
+ " 0.29072\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </tbody>\n",
+ " </table>\n",
+ " "
+ ],
+ "text/plain": [
+ "<pandas.core.style.Styler at 0x11335e5f8>"
+ ]
+ },
+ "execution_count": 18,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df.style.highlight_max(axis=0)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 19,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ " <style type=\"text/css\" >\n",
+ " \n",
+ " \n",
+ " #T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow0_col0 {\n",
+ " \n",
+ " background-color: yellow;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow1_col2 {\n",
+ " \n",
+ " background-color: yellow;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow2_col1 {\n",
+ " \n",
+ " background-color: yellow;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow8_col4 {\n",
+ " \n",
+ " background-color: yellow;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow9_col3 {\n",
+ " \n",
+ " background-color: yellow;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " </style>\n",
+ "\n",
+ " <table id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fb\">\n",
+ " \n",
+ "\n",
+ " <thead>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th class=\"blank\">\n",
+ " \n",
+ " <th class=\"col_heading level0 col0\">A\n",
+ " \n",
+ " <th class=\"col_heading level0 col1\">B\n",
+ " \n",
+ " <th class=\"col_heading level0 col2\">C\n",
+ " \n",
+ " <th class=\"col_heading level0 col3\">D\n",
+ " \n",
+ " <th class=\"col_heading level0 col4\">E\n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </thead>\n",
+ " <tbody>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fb\" class=\"row_heading level4 row0\">\n",
+ " \n",
+ " 0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow0_col0\" class=\"data row0 col0\">\n",
+ " \n",
+ " 1.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow0_col1\" class=\"data row0 col1\">\n",
+ " \n",
+ " 1.329212\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow0_col2\" class=\"data row0 col2\">\n",
+ " \n",
+ " nan\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow0_col3\" class=\"data row0 col3\">\n",
+ " \n",
+ " -0.31628\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow0_col4\" class=\"data row0 col4\">\n",
+ " \n",
+ " -0.99081\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fb\" class=\"row_heading level4 row1\">\n",
+ " \n",
+ " 1\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow1_col0\" class=\"data row1 col0\">\n",
+ " \n",
+ " 2.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow1_col1\" class=\"data row1 col1\">\n",
+ " \n",
+ " -1.070816\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow1_col2\" class=\"data row1 col2\">\n",
+ " \n",
+ " -1.438713\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow1_col3\" class=\"data row1 col3\">\n",
+ " \n",
+ " 0.564417\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow1_col4\" class=\"data row1 col4\">\n",
+ " \n",
+ " 0.295722\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fb\" class=\"row_heading level4 row2\">\n",
+ " \n",
+ " 2\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow2_col0\" class=\"data row2 col0\">\n",
+ " \n",
+ " 3.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow2_col1\" class=\"data row2 col1\">\n",
+ " \n",
+ " -1.626404\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow2_col2\" class=\"data row2 col2\">\n",
+ " \n",
+ " 0.219565\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow2_col3\" class=\"data row2 col3\">\n",
+ " \n",
+ " 0.678805\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow2_col4\" class=\"data row2 col4\">\n",
+ " \n",
+ " 1.889273\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fb\" class=\"row_heading level4 row3\">\n",
+ " \n",
+ " 3\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow3_col0\" class=\"data row3 col0\">\n",
+ " \n",
+ " 4.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow3_col1\" class=\"data row3 col1\">\n",
+ " \n",
+ " 0.961538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow3_col2\" class=\"data row3 col2\">\n",
+ " \n",
+ " 0.104011\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow3_col3\" class=\"data row3 col3\">\n",
+ " \n",
+ " -0.481165\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow3_col4\" class=\"data row3 col4\">\n",
+ " \n",
+ " 0.850229\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fb\" class=\"row_heading level4 row4\">\n",
+ " \n",
+ " 4\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow4_col0\" class=\"data row4 col0\">\n",
+ " \n",
+ " 5.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow4_col1\" class=\"data row4 col1\">\n",
+ " \n",
+ " 1.453425\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow4_col2\" class=\"data row4 col2\">\n",
+ " \n",
+ " 1.057737\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow4_col3\" class=\"data row4 col3\">\n",
+ " \n",
+ " 0.165562\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow4_col4\" class=\"data row4 col4\">\n",
+ " \n",
+ " 0.515018\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fb\" class=\"row_heading level4 row5\">\n",
+ " \n",
+ " 5\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow5_col0\" class=\"data row5 col0\">\n",
+ " \n",
+ " 6.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow5_col1\" class=\"data row5 col1\">\n",
+ " \n",
+ " -1.336936\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow5_col2\" class=\"data row5 col2\">\n",
+ " \n",
+ " 0.562861\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow5_col3\" class=\"data row5 col3\">\n",
+ " \n",
+ " 1.392855\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow5_col4\" class=\"data row5 col4\">\n",
+ " \n",
+ " -0.063328\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fb\" class=\"row_heading level4 row6\">\n",
+ " \n",
+ " 6\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow6_col0\" class=\"data row6 col0\">\n",
+ " \n",
+ " 7.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow6_col1\" class=\"data row6 col1\">\n",
+ " \n",
+ " 0.121668\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow6_col2\" class=\"data row6 col2\">\n",
+ " \n",
+ " 1.207603\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow6_col3\" class=\"data row6 col3\">\n",
+ " \n",
+ " -0.00204\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow6_col4\" class=\"data row6 col4\">\n",
+ " \n",
+ " 1.627796\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fb\" class=\"row_heading level4 row7\">\n",
+ " \n",
+ " 7\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow7_col0\" class=\"data row7 col0\">\n",
+ " \n",
+ " 8.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow7_col1\" class=\"data row7 col1\">\n",
+ " \n",
+ " 0.354493\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow7_col2\" class=\"data row7 col2\">\n",
+ " \n",
+ " 1.037528\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow7_col3\" class=\"data row7 col3\">\n",
+ " \n",
+ " -0.385684\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow7_col4\" class=\"data row7 col4\">\n",
+ " \n",
+ " 0.519818\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fb\" class=\"row_heading level4 row8\">\n",
+ " \n",
+ " 8\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow8_col0\" class=\"data row8 col0\">\n",
+ " \n",
+ " 9.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow8_col1\" class=\"data row8 col1\">\n",
+ " \n",
+ " 1.686583\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow8_col2\" class=\"data row8 col2\">\n",
+ " \n",
+ " -1.325963\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow8_col3\" class=\"data row8 col3\">\n",
+ " \n",
+ " 1.428984\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow8_col4\" class=\"data row8 col4\">\n",
+ " \n",
+ " -2.089354\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fb\" class=\"row_heading level4 row9\">\n",
+ " \n",
+ " 9\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow9_col0\" class=\"data row9 col0\">\n",
+ " \n",
+ " 10.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow9_col1\" class=\"data row9 col1\">\n",
+ " \n",
+ " -0.12982\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow9_col2\" class=\"data row9 col2\">\n",
+ " \n",
+ " 0.631523\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow9_col3\" class=\"data row9 col3\">\n",
+ " \n",
+ " -0.586538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81733fe_8bd5_11e5_871a_a45e60bd97fbrow9_col4\" class=\"data row9 col4\">\n",
+ " \n",
+ " 0.29072\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </tbody>\n",
+ " </table>\n",
+ " "
+ ],
+ "text/plain": [
+ "<pandas.core.style.Styler at 0x11335e390>"
+ ]
+ },
+ "execution_count": 19,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df.style.highlight_min(axis=0)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Use `Styler.set_properties` when the style doesn't actually depend on the values."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 20,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ " <style type=\"text/css\" >\n",
+ " \n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow0_col0 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow0_col1 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow0_col2 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow0_col3 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow0_col4 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow1_col0 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow1_col1 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow1_col2 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow1_col3 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow1_col4 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow2_col0 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow2_col1 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow2_col2 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow2_col3 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow2_col4 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow3_col0 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow3_col1 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow3_col2 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow3_col3 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow3_col4 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow4_col0 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow4_col1 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow4_col2 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow4_col3 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow4_col4 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow5_col0 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow5_col1 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow5_col2 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow5_col3 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow5_col4 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow6_col0 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow6_col1 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow6_col2 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow6_col3 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow6_col4 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow7_col0 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow7_col1 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow7_col2 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow7_col3 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow7_col4 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow8_col0 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow8_col1 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow8_col2 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow8_col3 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow8_col4 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow9_col0 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow9_col1 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow9_col2 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow9_col3 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow9_col4 {\n",
+ " \n",
+ " color: lawngreen;\n",
+ " \n",
+ " background-color: black;\n",
+ " \n",
+ " border-color: white;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " </style>\n",
+ "\n",
+ " <table id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fb\">\n",
+ " \n",
+ "\n",
+ " <thead>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th class=\"blank\">\n",
+ " \n",
+ " <th class=\"col_heading level0 col0\">A\n",
+ " \n",
+ " <th class=\"col_heading level0 col1\">B\n",
+ " \n",
+ " <th class=\"col_heading level0 col2\">C\n",
+ " \n",
+ " <th class=\"col_heading level0 col3\">D\n",
+ " \n",
+ " <th class=\"col_heading level0 col4\">E\n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </thead>\n",
+ " <tbody>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fb\" class=\"row_heading level4 row0\">\n",
+ " \n",
+ " 0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow0_col0\" class=\"data row0 col0\">\n",
+ " \n",
+ " 1.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow0_col1\" class=\"data row0 col1\">\n",
+ " \n",
+ " 1.329212\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow0_col2\" class=\"data row0 col2\">\n",
+ " \n",
+ " nan\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow0_col3\" class=\"data row0 col3\">\n",
+ " \n",
+ " -0.31628\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow0_col4\" class=\"data row0 col4\">\n",
+ " \n",
+ " -0.99081\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fb\" class=\"row_heading level4 row1\">\n",
+ " \n",
+ " 1\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow1_col0\" class=\"data row1 col0\">\n",
+ " \n",
+ " 2.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow1_col1\" class=\"data row1 col1\">\n",
+ " \n",
+ " -1.070816\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow1_col2\" class=\"data row1 col2\">\n",
+ " \n",
+ " -1.438713\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow1_col3\" class=\"data row1 col3\">\n",
+ " \n",
+ " 0.564417\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow1_col4\" class=\"data row1 col4\">\n",
+ " \n",
+ " 0.295722\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fb\" class=\"row_heading level4 row2\">\n",
+ " \n",
+ " 2\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow2_col0\" class=\"data row2 col0\">\n",
+ " \n",
+ " 3.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow2_col1\" class=\"data row2 col1\">\n",
+ " \n",
+ " -1.626404\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow2_col2\" class=\"data row2 col2\">\n",
+ " \n",
+ " 0.219565\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow2_col3\" class=\"data row2 col3\">\n",
+ " \n",
+ " 0.678805\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow2_col4\" class=\"data row2 col4\">\n",
+ " \n",
+ " 1.889273\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fb\" class=\"row_heading level4 row3\">\n",
+ " \n",
+ " 3\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow3_col0\" class=\"data row3 col0\">\n",
+ " \n",
+ " 4.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow3_col1\" class=\"data row3 col1\">\n",
+ " \n",
+ " 0.961538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow3_col2\" class=\"data row3 col2\">\n",
+ " \n",
+ " 0.104011\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow3_col3\" class=\"data row3 col3\">\n",
+ " \n",
+ " -0.481165\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow3_col4\" class=\"data row3 col4\">\n",
+ " \n",
+ " 0.850229\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fb\" class=\"row_heading level4 row4\">\n",
+ " \n",
+ " 4\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow4_col0\" class=\"data row4 col0\">\n",
+ " \n",
+ " 5.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow4_col1\" class=\"data row4 col1\">\n",
+ " \n",
+ " 1.453425\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow4_col2\" class=\"data row4 col2\">\n",
+ " \n",
+ " 1.057737\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow4_col3\" class=\"data row4 col3\">\n",
+ " \n",
+ " 0.165562\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow4_col4\" class=\"data row4 col4\">\n",
+ " \n",
+ " 0.515018\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fb\" class=\"row_heading level4 row5\">\n",
+ " \n",
+ " 5\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow5_col0\" class=\"data row5 col0\">\n",
+ " \n",
+ " 6.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow5_col1\" class=\"data row5 col1\">\n",
+ " \n",
+ " -1.336936\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow5_col2\" class=\"data row5 col2\">\n",
+ " \n",
+ " 0.562861\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow5_col3\" class=\"data row5 col3\">\n",
+ " \n",
+ " 1.392855\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow5_col4\" class=\"data row5 col4\">\n",
+ " \n",
+ " -0.063328\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fb\" class=\"row_heading level4 row6\">\n",
+ " \n",
+ " 6\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow6_col0\" class=\"data row6 col0\">\n",
+ " \n",
+ " 7.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow6_col1\" class=\"data row6 col1\">\n",
+ " \n",
+ " 0.121668\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow6_col2\" class=\"data row6 col2\">\n",
+ " \n",
+ " 1.207603\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow6_col3\" class=\"data row6 col3\">\n",
+ " \n",
+ " -0.00204\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow6_col4\" class=\"data row6 col4\">\n",
+ " \n",
+ " 1.627796\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fb\" class=\"row_heading level4 row7\">\n",
+ " \n",
+ " 7\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow7_col0\" class=\"data row7 col0\">\n",
+ " \n",
+ " 8.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow7_col1\" class=\"data row7 col1\">\n",
+ " \n",
+ " 0.354493\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow7_col2\" class=\"data row7 col2\">\n",
+ " \n",
+ " 1.037528\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow7_col3\" class=\"data row7 col3\">\n",
+ " \n",
+ " -0.385684\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow7_col4\" class=\"data row7 col4\">\n",
+ " \n",
+ " 0.519818\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fb\" class=\"row_heading level4 row8\">\n",
+ " \n",
+ " 8\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow8_col0\" class=\"data row8 col0\">\n",
+ " \n",
+ " 9.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow8_col1\" class=\"data row8 col1\">\n",
+ " \n",
+ " 1.686583\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow8_col2\" class=\"data row8 col2\">\n",
+ " \n",
+ " -1.325963\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow8_col3\" class=\"data row8 col3\">\n",
+ " \n",
+ " 1.428984\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow8_col4\" class=\"data row8 col4\">\n",
+ " \n",
+ " -2.089354\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fb\" class=\"row_heading level4 row9\">\n",
+ " \n",
+ " 9\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow9_col0\" class=\"data row9 col0\">\n",
+ " \n",
+ " 10.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow9_col1\" class=\"data row9 col1\">\n",
+ " \n",
+ " -0.12982\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow9_col2\" class=\"data row9 col2\">\n",
+ " \n",
+ " 0.631523\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow9_col3\" class=\"data row9 col3\">\n",
+ " \n",
+ " -0.586538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e81d9d50_8bd5_11e5_a344_a45e60bd97fbrow9_col4\" class=\"data row9 col4\">\n",
+ " \n",
+ " 0.29072\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </tbody>\n",
+ " </table>\n",
+ " "
+ ],
+ "text/plain": [
+ "<pandas.core.style.Styler at 0x113367ef0>"
+ ]
+ },
+ "execution_count": 20,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df.style.set_properties(**{'background-color': 'black',\n",
+ " 'color': 'lawngreen',\n",
+ " 'border-color': 'white'})"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Sharing Styles"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Say you have a lovely style built up for a DataFrame, and now you want to apply the same style to a second DataFrame. Export the style with `df1.style.export`, and import it on the second DataFrame with `df1.style.set`"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 21,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ " <style type=\"text/css\" >\n",
+ " \n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow0_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow0_col1 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow0_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow0_col3 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow0_col4 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow1_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow1_col1 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow1_col2 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow1_col3 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow1_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow2_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow2_col1 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow2_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow2_col3 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow2_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow3_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow3_col1 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow3_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow3_col3 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow3_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow4_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow4_col1 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow4_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow4_col3 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow4_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow5_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow5_col1 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow5_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow5_col3 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow5_col4 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow6_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow6_col1 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow6_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow6_col3 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow6_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow7_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow7_col1 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow7_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow7_col3 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow7_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow8_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow8_col1 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow8_col2 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow8_col3 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow8_col4 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow9_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow9_col1 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow9_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow9_col3 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow9_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " </style>\n",
+ "\n",
+ " <table id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fb\">\n",
+ " \n",
+ "\n",
+ " <thead>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th class=\"blank\">\n",
+ " \n",
+ " <th class=\"col_heading level0 col0\">A\n",
+ " \n",
+ " <th class=\"col_heading level0 col1\">B\n",
+ " \n",
+ " <th class=\"col_heading level0 col2\">C\n",
+ " \n",
+ " <th class=\"col_heading level0 col3\">D\n",
+ " \n",
+ " <th class=\"col_heading level0 col4\">E\n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </thead>\n",
+ " <tbody>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fb\" class=\"row_heading level4 row0\">\n",
+ " \n",
+ " 0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow0_col0\" class=\"data row0 col0\">\n",
+ " \n",
+ " 1.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow0_col1\" class=\"data row0 col1\">\n",
+ " \n",
+ " 1.329212\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow0_col2\" class=\"data row0 col2\">\n",
+ " \n",
+ " nan\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow0_col3\" class=\"data row0 col3\">\n",
+ " \n",
+ " -0.31628\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow0_col4\" class=\"data row0 col4\">\n",
+ " \n",
+ " -0.99081\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fb\" class=\"row_heading level4 row1\">\n",
+ " \n",
+ " 1\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow1_col0\" class=\"data row1 col0\">\n",
+ " \n",
+ " 2.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow1_col1\" class=\"data row1 col1\">\n",
+ " \n",
+ " -1.070816\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow1_col2\" class=\"data row1 col2\">\n",
+ " \n",
+ " -1.438713\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow1_col3\" class=\"data row1 col3\">\n",
+ " \n",
+ " 0.564417\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow1_col4\" class=\"data row1 col4\">\n",
+ " \n",
+ " 0.295722\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fb\" class=\"row_heading level4 row2\">\n",
+ " \n",
+ " 2\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow2_col0\" class=\"data row2 col0\">\n",
+ " \n",
+ " 3.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow2_col1\" class=\"data row2 col1\">\n",
+ " \n",
+ " -1.626404\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow2_col2\" class=\"data row2 col2\">\n",
+ " \n",
+ " 0.219565\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow2_col3\" class=\"data row2 col3\">\n",
+ " \n",
+ " 0.678805\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow2_col4\" class=\"data row2 col4\">\n",
+ " \n",
+ " 1.889273\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fb\" class=\"row_heading level4 row3\">\n",
+ " \n",
+ " 3\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow3_col0\" class=\"data row3 col0\">\n",
+ " \n",
+ " 4.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow3_col1\" class=\"data row3 col1\">\n",
+ " \n",
+ " 0.961538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow3_col2\" class=\"data row3 col2\">\n",
+ " \n",
+ " 0.104011\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow3_col3\" class=\"data row3 col3\">\n",
+ " \n",
+ " -0.481165\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow3_col4\" class=\"data row3 col4\">\n",
+ " \n",
+ " 0.850229\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fb\" class=\"row_heading level4 row4\">\n",
+ " \n",
+ " 4\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow4_col0\" class=\"data row4 col0\">\n",
+ " \n",
+ " 5.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow4_col1\" class=\"data row4 col1\">\n",
+ " \n",
+ " 1.453425\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow4_col2\" class=\"data row4 col2\">\n",
+ " \n",
+ " 1.057737\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow4_col3\" class=\"data row4 col3\">\n",
+ " \n",
+ " 0.165562\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow4_col4\" class=\"data row4 col4\">\n",
+ " \n",
+ " 0.515018\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fb\" class=\"row_heading level4 row5\">\n",
+ " \n",
+ " 5\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow5_col0\" class=\"data row5 col0\">\n",
+ " \n",
+ " 6.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow5_col1\" class=\"data row5 col1\">\n",
+ " \n",
+ " -1.336936\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow5_col2\" class=\"data row5 col2\">\n",
+ " \n",
+ " 0.562861\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow5_col3\" class=\"data row5 col3\">\n",
+ " \n",
+ " 1.392855\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow5_col4\" class=\"data row5 col4\">\n",
+ " \n",
+ " -0.063328\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fb\" class=\"row_heading level4 row6\">\n",
+ " \n",
+ " 6\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow6_col0\" class=\"data row6 col0\">\n",
+ " \n",
+ " 7.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow6_col1\" class=\"data row6 col1\">\n",
+ " \n",
+ " 0.121668\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow6_col2\" class=\"data row6 col2\">\n",
+ " \n",
+ " 1.207603\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow6_col3\" class=\"data row6 col3\">\n",
+ " \n",
+ " -0.00204\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow6_col4\" class=\"data row6 col4\">\n",
+ " \n",
+ " 1.627796\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fb\" class=\"row_heading level4 row7\">\n",
+ " \n",
+ " 7\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow7_col0\" class=\"data row7 col0\">\n",
+ " \n",
+ " 8.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow7_col1\" class=\"data row7 col1\">\n",
+ " \n",
+ " 0.354493\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow7_col2\" class=\"data row7 col2\">\n",
+ " \n",
+ " 1.037528\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow7_col3\" class=\"data row7 col3\">\n",
+ " \n",
+ " -0.385684\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow7_col4\" class=\"data row7 col4\">\n",
+ " \n",
+ " 0.519818\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fb\" class=\"row_heading level4 row8\">\n",
+ " \n",
+ " 8\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow8_col0\" class=\"data row8 col0\">\n",
+ " \n",
+ " 9.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow8_col1\" class=\"data row8 col1\">\n",
+ " \n",
+ " 1.686583\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow8_col2\" class=\"data row8 col2\">\n",
+ " \n",
+ " -1.325963\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow8_col3\" class=\"data row8 col3\">\n",
+ " \n",
+ " 1.428984\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow8_col4\" class=\"data row8 col4\">\n",
+ " \n",
+ " -2.089354\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fb\" class=\"row_heading level4 row9\">\n",
+ " \n",
+ " 9\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow9_col0\" class=\"data row9 col0\">\n",
+ " \n",
+ " 10.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow9_col1\" class=\"data row9 col1\">\n",
+ " \n",
+ " -0.12982\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow9_col2\" class=\"data row9 col2\">\n",
+ " \n",
+ " 0.631523\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow9_col3\" class=\"data row9 col3\">\n",
+ " \n",
+ " -0.586538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8233c92_8bd5_11e5_aa43_a45e60bd97fbrow9_col4\" class=\"data row9 col4\">\n",
+ " \n",
+ " 0.29072\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </tbody>\n",
+ " </table>\n",
+ " "
+ ],
+ "text/plain": [
+ "<pandas.core.style.Styler at 0x1133670f0>"
+ ]
+ },
+ "execution_count": 21,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df2 = -df\n",
+ "style1 = df.style.applymap(color_negative_red)\n",
+ "style1"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 22,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ " <style type=\"text/css\" >\n",
+ " \n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow0_col0 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow0_col1 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow0_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow0_col3 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow0_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow1_col0 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow1_col1 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow1_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow1_col3 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow1_col4 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow2_col0 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow2_col1 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow2_col2 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow2_col3 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow2_col4 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow3_col0 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow3_col1 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow3_col2 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow3_col3 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow3_col4 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow4_col0 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow4_col1 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow4_col2 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow4_col3 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow4_col4 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow5_col0 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow5_col1 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow5_col2 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow5_col3 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow5_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow6_col0 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow6_col1 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow6_col2 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow6_col3 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow6_col4 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow7_col0 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow7_col1 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow7_col2 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow7_col3 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow7_col4 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow8_col0 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow8_col1 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow8_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow8_col3 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow8_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow9_col0 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow9_col1 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow9_col2 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow9_col3 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow9_col4 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " </style>\n",
+ "\n",
+ " <table id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fb\">\n",
+ " \n",
+ "\n",
+ " <thead>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th class=\"blank\">\n",
+ " \n",
+ " <th class=\"col_heading level0 col0\">A\n",
+ " \n",
+ " <th class=\"col_heading level0 col1\">B\n",
+ " \n",
+ " <th class=\"col_heading level0 col2\">C\n",
+ " \n",
+ " <th class=\"col_heading level0 col3\">D\n",
+ " \n",
+ " <th class=\"col_heading level0 col4\">E\n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </thead>\n",
+ " <tbody>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fb\" class=\"row_heading level4 row0\">\n",
+ " \n",
+ " 0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow0_col0\" class=\"data row0 col0\">\n",
+ " \n",
+ " -1.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow0_col1\" class=\"data row0 col1\">\n",
+ " \n",
+ " -1.329212\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow0_col2\" class=\"data row0 col2\">\n",
+ " \n",
+ " nan\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow0_col3\" class=\"data row0 col3\">\n",
+ " \n",
+ " 0.31628\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow0_col4\" class=\"data row0 col4\">\n",
+ " \n",
+ " 0.99081\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fb\" class=\"row_heading level4 row1\">\n",
+ " \n",
+ " 1\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow1_col0\" class=\"data row1 col0\">\n",
+ " \n",
+ " -2.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow1_col1\" class=\"data row1 col1\">\n",
+ " \n",
+ " 1.070816\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow1_col2\" class=\"data row1 col2\">\n",
+ " \n",
+ " 1.438713\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow1_col3\" class=\"data row1 col3\">\n",
+ " \n",
+ " -0.564417\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow1_col4\" class=\"data row1 col4\">\n",
+ " \n",
+ " -0.295722\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fb\" class=\"row_heading level4 row2\">\n",
+ " \n",
+ " 2\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow2_col0\" class=\"data row2 col0\">\n",
+ " \n",
+ " -3.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow2_col1\" class=\"data row2 col1\">\n",
+ " \n",
+ " 1.626404\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow2_col2\" class=\"data row2 col2\">\n",
+ " \n",
+ " -0.219565\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow2_col3\" class=\"data row2 col3\">\n",
+ " \n",
+ " -0.678805\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow2_col4\" class=\"data row2 col4\">\n",
+ " \n",
+ " -1.889273\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fb\" class=\"row_heading level4 row3\">\n",
+ " \n",
+ " 3\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow3_col0\" class=\"data row3 col0\">\n",
+ " \n",
+ " -4.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow3_col1\" class=\"data row3 col1\">\n",
+ " \n",
+ " -0.961538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow3_col2\" class=\"data row3 col2\">\n",
+ " \n",
+ " -0.104011\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow3_col3\" class=\"data row3 col3\">\n",
+ " \n",
+ " 0.481165\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow3_col4\" class=\"data row3 col4\">\n",
+ " \n",
+ " -0.850229\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fb\" class=\"row_heading level4 row4\">\n",
+ " \n",
+ " 4\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow4_col0\" class=\"data row4 col0\">\n",
+ " \n",
+ " -5.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow4_col1\" class=\"data row4 col1\">\n",
+ " \n",
+ " -1.453425\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow4_col2\" class=\"data row4 col2\">\n",
+ " \n",
+ " -1.057737\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow4_col3\" class=\"data row4 col3\">\n",
+ " \n",
+ " -0.165562\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow4_col4\" class=\"data row4 col4\">\n",
+ " \n",
+ " -0.515018\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fb\" class=\"row_heading level4 row5\">\n",
+ " \n",
+ " 5\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow5_col0\" class=\"data row5 col0\">\n",
+ " \n",
+ " -6.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow5_col1\" class=\"data row5 col1\">\n",
+ " \n",
+ " 1.336936\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow5_col2\" class=\"data row5 col2\">\n",
+ " \n",
+ " -0.562861\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow5_col3\" class=\"data row5 col3\">\n",
+ " \n",
+ " -1.392855\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow5_col4\" class=\"data row5 col4\">\n",
+ " \n",
+ " 0.063328\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fb\" class=\"row_heading level4 row6\">\n",
+ " \n",
+ " 6\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow6_col0\" class=\"data row6 col0\">\n",
+ " \n",
+ " -7.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow6_col1\" class=\"data row6 col1\">\n",
+ " \n",
+ " -0.121668\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow6_col2\" class=\"data row6 col2\">\n",
+ " \n",
+ " -1.207603\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow6_col3\" class=\"data row6 col3\">\n",
+ " \n",
+ " 0.00204\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow6_col4\" class=\"data row6 col4\">\n",
+ " \n",
+ " -1.627796\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fb\" class=\"row_heading level4 row7\">\n",
+ " \n",
+ " 7\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow7_col0\" class=\"data row7 col0\">\n",
+ " \n",
+ " -8.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow7_col1\" class=\"data row7 col1\">\n",
+ " \n",
+ " -0.354493\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow7_col2\" class=\"data row7 col2\">\n",
+ " \n",
+ " -1.037528\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow7_col3\" class=\"data row7 col3\">\n",
+ " \n",
+ " 0.385684\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow7_col4\" class=\"data row7 col4\">\n",
+ " \n",
+ " -0.519818\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fb\" class=\"row_heading level4 row8\">\n",
+ " \n",
+ " 8\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow8_col0\" class=\"data row8 col0\">\n",
+ " \n",
+ " -9.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow8_col1\" class=\"data row8 col1\">\n",
+ " \n",
+ " -1.686583\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow8_col2\" class=\"data row8 col2\">\n",
+ " \n",
+ " 1.325963\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow8_col3\" class=\"data row8 col3\">\n",
+ " \n",
+ " -1.428984\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow8_col4\" class=\"data row8 col4\">\n",
+ " \n",
+ " 2.089354\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fb\" class=\"row_heading level4 row9\">\n",
+ " \n",
+ " 9\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow9_col0\" class=\"data row9 col0\">\n",
+ " \n",
+ " -10.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow9_col1\" class=\"data row9 col1\">\n",
+ " \n",
+ " 0.12982\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow9_col2\" class=\"data row9 col2\">\n",
+ " \n",
+ " -0.631523\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow9_col3\" class=\"data row9 col3\">\n",
+ " \n",
+ " 0.586538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8287d92_8bd5_11e5_ad98_a45e60bd97fbrow9_col4\" class=\"data row9 col4\">\n",
+ " \n",
+ " -0.29072\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </tbody>\n",
+ " </table>\n",
+ " "
+ ],
+ "text/plain": [
+ "<pandas.core.style.Styler at 0x113367470>"
+ ]
+ },
+ "execution_count": 22,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "style2 = df2.style\n",
+ "style2.use(style1.export())\n",
+ "style2"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Other options\n",
+ "\n",
+ "You've seen a few methods for data-driven styling.\n",
+ "`Styler` also provides a few other options for styles that don't depend on the data.\n",
+ "\n",
+ "- precision\n",
+ "- captions\n",
+ "- table-wide styles\n",
+ "\n",
+ "Each of these can be specified in two ways:\n",
+ "\n",
+ "- A keyword argument to `pandas.core.Styler`\n",
+ "- A call to one of the `.set_` methods, e.g. `.set_caption`\n",
+ "\n",
+ "The best method to use depends on the context. Use the `Styler` constructor when building many styled DataFrames that should all share the same properties. For interactive use, the`.set_` methods are more convenient."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Precision"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "You can control the precision of floats using pandas' regular `display.precision` option."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 23,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ " <style type=\"text/css\" >\n",
+ " \n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow0_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow0_col1 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow0_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow0_col3 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow0_col4 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow1_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow1_col1 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow1_col2 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow1_col3 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow1_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow2_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow2_col1 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow2_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow2_col3 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow2_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " background-color: yellow;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow3_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow3_col1 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow3_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow3_col3 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow3_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow4_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow4_col1 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow4_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow4_col3 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow4_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow5_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow5_col1 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow5_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow5_col3 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow5_col4 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow6_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow6_col1 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow6_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " background-color: yellow;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow6_col3 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow6_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow7_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow7_col1 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow7_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow7_col3 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow7_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow8_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow8_col1 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " background-color: yellow;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow8_col2 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow8_col3 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " background-color: yellow;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow8_col4 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow9_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " background-color: yellow;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow9_col1 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow9_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow9_col3 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow9_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " </style>\n",
+ "\n",
+ " <table id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fb\">\n",
+ " \n",
+ "\n",
+ " <thead>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th class=\"blank\">\n",
+ " \n",
+ " <th class=\"col_heading level0 col0\">A\n",
+ " \n",
+ " <th class=\"col_heading level0 col1\">B\n",
+ " \n",
+ " <th class=\"col_heading level0 col2\">C\n",
+ " \n",
+ " <th class=\"col_heading level0 col3\">D\n",
+ " \n",
+ " <th class=\"col_heading level0 col4\">E\n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </thead>\n",
+ " <tbody>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fb\" class=\"row_heading level4 row0\">\n",
+ " \n",
+ " 0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow0_col0\" class=\"data row0 col0\">\n",
+ " \n",
+ " 1.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow0_col1\" class=\"data row0 col1\">\n",
+ " \n",
+ " 1.33\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow0_col2\" class=\"data row0 col2\">\n",
+ " \n",
+ " nan\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow0_col3\" class=\"data row0 col3\">\n",
+ " \n",
+ " -0.32\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow0_col4\" class=\"data row0 col4\">\n",
+ " \n",
+ " -0.99\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fb\" class=\"row_heading level4 row1\">\n",
+ " \n",
+ " 1\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow1_col0\" class=\"data row1 col0\">\n",
+ " \n",
+ " 2.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow1_col1\" class=\"data row1 col1\">\n",
+ " \n",
+ " -1.07\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow1_col2\" class=\"data row1 col2\">\n",
+ " \n",
+ " -1.44\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow1_col3\" class=\"data row1 col3\">\n",
+ " \n",
+ " 0.56\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow1_col4\" class=\"data row1 col4\">\n",
+ " \n",
+ " 0.3\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fb\" class=\"row_heading level4 row2\">\n",
+ " \n",
+ " 2\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow2_col0\" class=\"data row2 col0\">\n",
+ " \n",
+ " 3.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow2_col1\" class=\"data row2 col1\">\n",
+ " \n",
+ " -1.63\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow2_col2\" class=\"data row2 col2\">\n",
+ " \n",
+ " 0.22\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow2_col3\" class=\"data row2 col3\">\n",
+ " \n",
+ " 0.68\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow2_col4\" class=\"data row2 col4\">\n",
+ " \n",
+ " 1.89\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fb\" class=\"row_heading level4 row3\">\n",
+ " \n",
+ " 3\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow3_col0\" class=\"data row3 col0\">\n",
+ " \n",
+ " 4.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow3_col1\" class=\"data row3 col1\">\n",
+ " \n",
+ " 0.96\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow3_col2\" class=\"data row3 col2\">\n",
+ " \n",
+ " 0.1\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow3_col3\" class=\"data row3 col3\">\n",
+ " \n",
+ " -0.48\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow3_col4\" class=\"data row3 col4\">\n",
+ " \n",
+ " 0.85\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fb\" class=\"row_heading level4 row4\">\n",
+ " \n",
+ " 4\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow4_col0\" class=\"data row4 col0\">\n",
+ " \n",
+ " 5.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow4_col1\" class=\"data row4 col1\">\n",
+ " \n",
+ " 1.45\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow4_col2\" class=\"data row4 col2\">\n",
+ " \n",
+ " 1.06\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow4_col3\" class=\"data row4 col3\">\n",
+ " \n",
+ " 0.17\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow4_col4\" class=\"data row4 col4\">\n",
+ " \n",
+ " 0.52\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fb\" class=\"row_heading level4 row5\">\n",
+ " \n",
+ " 5\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow5_col0\" class=\"data row5 col0\">\n",
+ " \n",
+ " 6.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow5_col1\" class=\"data row5 col1\">\n",
+ " \n",
+ " -1.34\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow5_col2\" class=\"data row5 col2\">\n",
+ " \n",
+ " 0.56\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow5_col3\" class=\"data row5 col3\">\n",
+ " \n",
+ " 1.39\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow5_col4\" class=\"data row5 col4\">\n",
+ " \n",
+ " -0.06\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fb\" class=\"row_heading level4 row6\">\n",
+ " \n",
+ " 6\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow6_col0\" class=\"data row6 col0\">\n",
+ " \n",
+ " 7.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow6_col1\" class=\"data row6 col1\">\n",
+ " \n",
+ " 0.12\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow6_col2\" class=\"data row6 col2\">\n",
+ " \n",
+ " 1.21\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow6_col3\" class=\"data row6 col3\">\n",
+ " \n",
+ " -0.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow6_col4\" class=\"data row6 col4\">\n",
+ " \n",
+ " 1.63\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fb\" class=\"row_heading level4 row7\">\n",
+ " \n",
+ " 7\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow7_col0\" class=\"data row7 col0\">\n",
+ " \n",
+ " 8.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow7_col1\" class=\"data row7 col1\">\n",
+ " \n",
+ " 0.35\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow7_col2\" class=\"data row7 col2\">\n",
+ " \n",
+ " 1.04\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow7_col3\" class=\"data row7 col3\">\n",
+ " \n",
+ " -0.39\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow7_col4\" class=\"data row7 col4\">\n",
+ " \n",
+ " 0.52\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fb\" class=\"row_heading level4 row8\">\n",
+ " \n",
+ " 8\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow8_col0\" class=\"data row8 col0\">\n",
+ " \n",
+ " 9.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow8_col1\" class=\"data row8 col1\">\n",
+ " \n",
+ " 1.69\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow8_col2\" class=\"data row8 col2\">\n",
+ " \n",
+ " -1.33\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow8_col3\" class=\"data row8 col3\">\n",
+ " \n",
+ " 1.43\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow8_col4\" class=\"data row8 col4\">\n",
+ " \n",
+ " -2.09\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fb\" class=\"row_heading level4 row9\">\n",
+ " \n",
+ " 9\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow9_col0\" class=\"data row9 col0\">\n",
+ " \n",
+ " 10.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow9_col1\" class=\"data row9 col1\">\n",
+ " \n",
+ " -0.13\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow9_col2\" class=\"data row9 col2\">\n",
+ " \n",
+ " 0.63\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow9_col3\" class=\"data row9 col3\">\n",
+ " \n",
+ " -0.59\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e83075ae_8bd5_11e5_88d4_a45e60bd97fbrow9_col4\" class=\"data row9 col4\">\n",
+ " \n",
+ " 0.29\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </tbody>\n",
+ " </table>\n",
+ " "
+ ],
+ "text/plain": [
+ "<pandas.core.style.Styler at 0x1133679b0>"
+ ]
+ },
+ "execution_count": 23,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "with pd.option_context('display.precision', 2):\n",
+ " html = (df.style\n",
+ " .applymap(color_negative_red)\n",
+ " .apply(highlight_max))\n",
+ "html"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Or through a `set_precision` method."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 24,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ " <style type=\"text/css\" >\n",
+ " \n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow0_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow0_col1 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow0_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow0_col3 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow0_col4 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow1_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow1_col1 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow1_col2 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow1_col3 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow1_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow2_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow2_col1 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow2_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow2_col3 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow2_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " background-color: yellow;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow3_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow3_col1 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow3_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow3_col3 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow3_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow4_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow4_col1 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow4_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow4_col3 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow4_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow5_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow5_col1 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow5_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow5_col3 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow5_col4 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow6_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow6_col1 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow6_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " background-color: yellow;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow6_col3 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow6_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow7_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow7_col1 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow7_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow7_col3 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow7_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow8_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow8_col1 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " background-color: yellow;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow8_col2 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow8_col3 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " background-color: yellow;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow8_col4 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow9_col0 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " background-color: yellow;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow9_col1 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow9_col2 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow9_col3 {\n",
+ " \n",
+ " color: red;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow9_col4 {\n",
+ " \n",
+ " color: black;\n",
+ " \n",
+ " : ;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " </style>\n",
+ "\n",
+ " <table id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fb\">\n",
+ " \n",
+ "\n",
+ " <thead>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th class=\"blank\">\n",
+ " \n",
+ " <th class=\"col_heading level0 col0\">A\n",
+ " \n",
+ " <th class=\"col_heading level0 col1\">B\n",
+ " \n",
+ " <th class=\"col_heading level0 col2\">C\n",
+ " \n",
+ " <th class=\"col_heading level0 col3\">D\n",
+ " \n",
+ " <th class=\"col_heading level0 col4\">E\n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </thead>\n",
+ " <tbody>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fb\" class=\"row_heading level4 row0\">\n",
+ " \n",
+ " 0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow0_col0\" class=\"data row0 col0\">\n",
+ " \n",
+ " 1.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow0_col1\" class=\"data row0 col1\">\n",
+ " \n",
+ " 1.33\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow0_col2\" class=\"data row0 col2\">\n",
+ " \n",
+ " nan\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow0_col3\" class=\"data row0 col3\">\n",
+ " \n",
+ " -0.32\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow0_col4\" class=\"data row0 col4\">\n",
+ " \n",
+ " -0.99\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fb\" class=\"row_heading level4 row1\">\n",
+ " \n",
+ " 1\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow1_col0\" class=\"data row1 col0\">\n",
+ " \n",
+ " 2.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow1_col1\" class=\"data row1 col1\">\n",
+ " \n",
+ " -1.07\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow1_col2\" class=\"data row1 col2\">\n",
+ " \n",
+ " -1.44\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow1_col3\" class=\"data row1 col3\">\n",
+ " \n",
+ " 0.56\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow1_col4\" class=\"data row1 col4\">\n",
+ " \n",
+ " 0.3\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fb\" class=\"row_heading level4 row2\">\n",
+ " \n",
+ " 2\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow2_col0\" class=\"data row2 col0\">\n",
+ " \n",
+ " 3.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow2_col1\" class=\"data row2 col1\">\n",
+ " \n",
+ " -1.63\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow2_col2\" class=\"data row2 col2\">\n",
+ " \n",
+ " 0.22\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow2_col3\" class=\"data row2 col3\">\n",
+ " \n",
+ " 0.68\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow2_col4\" class=\"data row2 col4\">\n",
+ " \n",
+ " 1.89\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fb\" class=\"row_heading level4 row3\">\n",
+ " \n",
+ " 3\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow3_col0\" class=\"data row3 col0\">\n",
+ " \n",
+ " 4.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow3_col1\" class=\"data row3 col1\">\n",
+ " \n",
+ " 0.96\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow3_col2\" class=\"data row3 col2\">\n",
+ " \n",
+ " 0.1\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow3_col3\" class=\"data row3 col3\">\n",
+ " \n",
+ " -0.48\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow3_col4\" class=\"data row3 col4\">\n",
+ " \n",
+ " 0.85\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fb\" class=\"row_heading level4 row4\">\n",
+ " \n",
+ " 4\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow4_col0\" class=\"data row4 col0\">\n",
+ " \n",
+ " 5.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow4_col1\" class=\"data row4 col1\">\n",
+ " \n",
+ " 1.45\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow4_col2\" class=\"data row4 col2\">\n",
+ " \n",
+ " 1.06\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow4_col3\" class=\"data row4 col3\">\n",
+ " \n",
+ " 0.17\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow4_col4\" class=\"data row4 col4\">\n",
+ " \n",
+ " 0.52\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fb\" class=\"row_heading level4 row5\">\n",
+ " \n",
+ " 5\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow5_col0\" class=\"data row5 col0\">\n",
+ " \n",
+ " 6.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow5_col1\" class=\"data row5 col1\">\n",
+ " \n",
+ " -1.34\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow5_col2\" class=\"data row5 col2\">\n",
+ " \n",
+ " 0.56\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow5_col3\" class=\"data row5 col3\">\n",
+ " \n",
+ " 1.39\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow5_col4\" class=\"data row5 col4\">\n",
+ " \n",
+ " -0.06\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fb\" class=\"row_heading level4 row6\">\n",
+ " \n",
+ " 6\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow6_col0\" class=\"data row6 col0\">\n",
+ " \n",
+ " 7.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow6_col1\" class=\"data row6 col1\">\n",
+ " \n",
+ " 0.12\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow6_col2\" class=\"data row6 col2\">\n",
+ " \n",
+ " 1.21\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow6_col3\" class=\"data row6 col3\">\n",
+ " \n",
+ " -0.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow6_col4\" class=\"data row6 col4\">\n",
+ " \n",
+ " 1.63\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fb\" class=\"row_heading level4 row7\">\n",
+ " \n",
+ " 7\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow7_col0\" class=\"data row7 col0\">\n",
+ " \n",
+ " 8.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow7_col1\" class=\"data row7 col1\">\n",
+ " \n",
+ " 0.35\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow7_col2\" class=\"data row7 col2\">\n",
+ " \n",
+ " 1.04\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow7_col3\" class=\"data row7 col3\">\n",
+ " \n",
+ " -0.39\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow7_col4\" class=\"data row7 col4\">\n",
+ " \n",
+ " 0.52\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fb\" class=\"row_heading level4 row8\">\n",
+ " \n",
+ " 8\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow8_col0\" class=\"data row8 col0\">\n",
+ " \n",
+ " 9.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow8_col1\" class=\"data row8 col1\">\n",
+ " \n",
+ " 1.69\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow8_col2\" class=\"data row8 col2\">\n",
+ " \n",
+ " -1.33\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow8_col3\" class=\"data row8 col3\">\n",
+ " \n",
+ " 1.43\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow8_col4\" class=\"data row8 col4\">\n",
+ " \n",
+ " -2.09\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fb\" class=\"row_heading level4 row9\">\n",
+ " \n",
+ " 9\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow9_col0\" class=\"data row9 col0\">\n",
+ " \n",
+ " 10.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow9_col1\" class=\"data row9 col1\">\n",
+ " \n",
+ " -0.13\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow9_col2\" class=\"data row9 col2\">\n",
+ " \n",
+ " 0.63\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow9_col3\" class=\"data row9 col3\">\n",
+ " \n",
+ " -0.59\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8394654_8bd5_11e5_b698_a45e60bd97fbrow9_col4\" class=\"data row9 col4\">\n",
+ " \n",
+ " 0.29\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </tbody>\n",
+ " </table>\n",
+ " "
+ ],
+ "text/plain": [
+ "<pandas.core.style.Styler at 0x11338e3c8>"
+ ]
+ },
+ "execution_count": 24,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df.style\\\n",
+ " .applymap(color_negative_red)\\\n",
+ " .apply(highlight_max)\\\n",
+ " .set_precision(2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Setting the precision only affects the printed number; the full-precision values are always passed to your style functions. You can always use `df.round(2).style` if you'd prefer to round from the start."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Captions"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Regular table captions can be added in a few ways."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 25,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ " <style type=\"text/css\" >\n",
+ " \n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow0_col0 {\n",
+ " \n",
+ " background-color: #e5ffe5;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow0_col1 {\n",
+ " \n",
+ " background-color: #188d18;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow0_col2 {\n",
+ " \n",
+ " background-color: #e5ffe5;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow0_col3 {\n",
+ " \n",
+ " background-color: #c7eec7;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow0_col4 {\n",
+ " \n",
+ " background-color: #a6dca6;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow1_col0 {\n",
+ " \n",
+ " background-color: #ccf1cc;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow1_col1 {\n",
+ " \n",
+ " background-color: #c0eac0;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow1_col2 {\n",
+ " \n",
+ " background-color: #e5ffe5;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow1_col3 {\n",
+ " \n",
+ " background-color: #62b662;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow1_col4 {\n",
+ " \n",
+ " background-color: #5cb35c;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow2_col0 {\n",
+ " \n",
+ " background-color: #b3e3b3;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow2_col1 {\n",
+ " \n",
+ " background-color: #e5ffe5;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow2_col2 {\n",
+ " \n",
+ " background-color: #56af56;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow2_col3 {\n",
+ " \n",
+ " background-color: #56af56;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow2_col4 {\n",
+ " \n",
+ " background-color: #008000;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow3_col0 {\n",
+ " \n",
+ " background-color: #99d599;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow3_col1 {\n",
+ " \n",
+ " background-color: #329c32;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow3_col2 {\n",
+ " \n",
+ " background-color: #5fb55f;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow3_col3 {\n",
+ " \n",
+ " background-color: #daf9da;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow3_col4 {\n",
+ " \n",
+ " background-color: #3ba13b;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow4_col0 {\n",
+ " \n",
+ " background-color: #80c780;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow4_col1 {\n",
+ " \n",
+ " background-color: #108910;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow4_col2 {\n",
+ " \n",
+ " background-color: #0d870d;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow4_col3 {\n",
+ " \n",
+ " background-color: #90d090;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow4_col4 {\n",
+ " \n",
+ " background-color: #4fac4f;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow5_col0 {\n",
+ " \n",
+ " background-color: #66b866;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow5_col1 {\n",
+ " \n",
+ " background-color: #d2f4d2;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow5_col2 {\n",
+ " \n",
+ " background-color: #389f38;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow5_col3 {\n",
+ " \n",
+ " background-color: #048204;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow5_col4 {\n",
+ " \n",
+ " background-color: #70be70;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow6_col0 {\n",
+ " \n",
+ " background-color: #4daa4d;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow6_col1 {\n",
+ " \n",
+ " background-color: #6cbc6c;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow6_col2 {\n",
+ " \n",
+ " background-color: #008000;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow6_col3 {\n",
+ " \n",
+ " background-color: #a3daa3;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow6_col4 {\n",
+ " \n",
+ " background-color: #0e880e;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow7_col0 {\n",
+ " \n",
+ " background-color: #329c32;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow7_col1 {\n",
+ " \n",
+ " background-color: #5cb35c;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow7_col2 {\n",
+ " \n",
+ " background-color: #0e880e;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow7_col3 {\n",
+ " \n",
+ " background-color: #cff3cf;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow7_col4 {\n",
+ " \n",
+ " background-color: #4fac4f;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow8_col0 {\n",
+ " \n",
+ " background-color: #198e19;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow8_col1 {\n",
+ " \n",
+ " background-color: #008000;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow8_col2 {\n",
+ " \n",
+ " background-color: #dcfadc;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow8_col3 {\n",
+ " \n",
+ " background-color: #008000;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow8_col4 {\n",
+ " \n",
+ " background-color: #e5ffe5;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow9_col0 {\n",
+ " \n",
+ " background-color: #008000;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow9_col1 {\n",
+ " \n",
+ " background-color: #7ec67e;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow9_col2 {\n",
+ " \n",
+ " background-color: #319b31;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow9_col3 {\n",
+ " \n",
+ " background-color: #e5ffe5;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow9_col4 {\n",
+ " \n",
+ " background-color: #5cb35c;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " </style>\n",
+ "\n",
+ " <table id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fb\">\n",
+ " \n",
+ " <caption>Colormaps, with a caption.</caption>\n",
+ " \n",
+ "\n",
+ " <thead>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th class=\"blank\">\n",
+ " \n",
+ " <th class=\"col_heading level0 col0\">A\n",
+ " \n",
+ " <th class=\"col_heading level0 col1\">B\n",
+ " \n",
+ " <th class=\"col_heading level0 col2\">C\n",
+ " \n",
+ " <th class=\"col_heading level0 col3\">D\n",
+ " \n",
+ " <th class=\"col_heading level0 col4\">E\n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </thead>\n",
+ " <tbody>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fb\" class=\"row_heading level4 row0\">\n",
+ " \n",
+ " 0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow0_col0\" class=\"data row0 col0\">\n",
+ " \n",
+ " 1.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow0_col1\" class=\"data row0 col1\">\n",
+ " \n",
+ " 1.329212\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow0_col2\" class=\"data row0 col2\">\n",
+ " \n",
+ " nan\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow0_col3\" class=\"data row0 col3\">\n",
+ " \n",
+ " -0.31628\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow0_col4\" class=\"data row0 col4\">\n",
+ " \n",
+ " -0.99081\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fb\" class=\"row_heading level4 row1\">\n",
+ " \n",
+ " 1\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow1_col0\" class=\"data row1 col0\">\n",
+ " \n",
+ " 2.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow1_col1\" class=\"data row1 col1\">\n",
+ " \n",
+ " -1.070816\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow1_col2\" class=\"data row1 col2\">\n",
+ " \n",
+ " -1.438713\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow1_col3\" class=\"data row1 col3\">\n",
+ " \n",
+ " 0.564417\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow1_col4\" class=\"data row1 col4\">\n",
+ " \n",
+ " 0.295722\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fb\" class=\"row_heading level4 row2\">\n",
+ " \n",
+ " 2\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow2_col0\" class=\"data row2 col0\">\n",
+ " \n",
+ " 3.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow2_col1\" class=\"data row2 col1\">\n",
+ " \n",
+ " -1.626404\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow2_col2\" class=\"data row2 col2\">\n",
+ " \n",
+ " 0.219565\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow2_col3\" class=\"data row2 col3\">\n",
+ " \n",
+ " 0.678805\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow2_col4\" class=\"data row2 col4\">\n",
+ " \n",
+ " 1.889273\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fb\" class=\"row_heading level4 row3\">\n",
+ " \n",
+ " 3\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow3_col0\" class=\"data row3 col0\">\n",
+ " \n",
+ " 4.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow3_col1\" class=\"data row3 col1\">\n",
+ " \n",
+ " 0.961538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow3_col2\" class=\"data row3 col2\">\n",
+ " \n",
+ " 0.104011\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow3_col3\" class=\"data row3 col3\">\n",
+ " \n",
+ " -0.481165\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow3_col4\" class=\"data row3 col4\">\n",
+ " \n",
+ " 0.850229\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fb\" class=\"row_heading level4 row4\">\n",
+ " \n",
+ " 4\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow4_col0\" class=\"data row4 col0\">\n",
+ " \n",
+ " 5.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow4_col1\" class=\"data row4 col1\">\n",
+ " \n",
+ " 1.453425\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow4_col2\" class=\"data row4 col2\">\n",
+ " \n",
+ " 1.057737\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow4_col3\" class=\"data row4 col3\">\n",
+ " \n",
+ " 0.165562\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow4_col4\" class=\"data row4 col4\">\n",
+ " \n",
+ " 0.515018\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fb\" class=\"row_heading level4 row5\">\n",
+ " \n",
+ " 5\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow5_col0\" class=\"data row5 col0\">\n",
+ " \n",
+ " 6.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow5_col1\" class=\"data row5 col1\">\n",
+ " \n",
+ " -1.336936\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow5_col2\" class=\"data row5 col2\">\n",
+ " \n",
+ " 0.562861\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow5_col3\" class=\"data row5 col3\">\n",
+ " \n",
+ " 1.392855\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow5_col4\" class=\"data row5 col4\">\n",
+ " \n",
+ " -0.063328\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fb\" class=\"row_heading level4 row6\">\n",
+ " \n",
+ " 6\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow6_col0\" class=\"data row6 col0\">\n",
+ " \n",
+ " 7.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow6_col1\" class=\"data row6 col1\">\n",
+ " \n",
+ " 0.121668\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow6_col2\" class=\"data row6 col2\">\n",
+ " \n",
+ " 1.207603\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow6_col3\" class=\"data row6 col3\">\n",
+ " \n",
+ " -0.00204\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow6_col4\" class=\"data row6 col4\">\n",
+ " \n",
+ " 1.627796\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fb\" class=\"row_heading level4 row7\">\n",
+ " \n",
+ " 7\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow7_col0\" class=\"data row7 col0\">\n",
+ " \n",
+ " 8.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow7_col1\" class=\"data row7 col1\">\n",
+ " \n",
+ " 0.354493\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow7_col2\" class=\"data row7 col2\">\n",
+ " \n",
+ " 1.037528\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow7_col3\" class=\"data row7 col3\">\n",
+ " \n",
+ " -0.385684\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow7_col4\" class=\"data row7 col4\">\n",
+ " \n",
+ " 0.519818\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fb\" class=\"row_heading level4 row8\">\n",
+ " \n",
+ " 8\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow8_col0\" class=\"data row8 col0\">\n",
+ " \n",
+ " 9.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow8_col1\" class=\"data row8 col1\">\n",
+ " \n",
+ " 1.686583\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow8_col2\" class=\"data row8 col2\">\n",
+ " \n",
+ " -1.325963\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow8_col3\" class=\"data row8 col3\">\n",
+ " \n",
+ " 1.428984\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow8_col4\" class=\"data row8 col4\">\n",
+ " \n",
+ " -2.089354\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fb\" class=\"row_heading level4 row9\">\n",
+ " \n",
+ " 9\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow9_col0\" class=\"data row9 col0\">\n",
+ " \n",
+ " 10.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow9_col1\" class=\"data row9 col1\">\n",
+ " \n",
+ " -0.12982\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow9_col2\" class=\"data row9 col2\">\n",
+ " \n",
+ " 0.631523\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow9_col3\" class=\"data row9 col3\">\n",
+ " \n",
+ " -0.586538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8430ee4_8bd5_11e5_9d59_a45e60bd97fbrow9_col4\" class=\"data row9 col4\">\n",
+ " \n",
+ " 0.29072\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </tbody>\n",
+ " </table>\n",
+ " "
+ ],
+ "text/plain": [
+ "<pandas.core.style.Styler at 0x113367978>"
+ ]
+ },
+ "execution_count": 25,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df.style.set_caption('Colormaps, with a caption.')\\\n",
+ " .background_gradient(cmap=cm)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Table Styles"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "The next option you have are \"table styles\".\n",
+ "These are styles that apply to the table as a whole, but don't look at the data.\n",
+ "Certain sytlings, including pseudo-selectors like `:hover` can only be used this way."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 26,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ " <style type=\"text/css\" >\n",
+ " \n",
+ " #T_e8482f22_8bd5_11e5_9937_a45e60bd97fb tr:hover {\n",
+ " \n",
+ " background-color: #ffff99;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8482f22_8bd5_11e5_9937_a45e60bd97fb th {\n",
+ " \n",
+ " font-size: 150%;\n",
+ " \n",
+ " text-align: center;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8482f22_8bd5_11e5_9937_a45e60bd97fb caption {\n",
+ " \n",
+ " caption-side: bottom;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " \n",
+ " </style>\n",
+ "\n",
+ " <table id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fb\">\n",
+ " \n",
+ " <caption>Hover to highlight.</caption>\n",
+ " \n",
+ "\n",
+ " <thead>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th class=\"blank\">\n",
+ " \n",
+ " <th class=\"col_heading level0 col0\">A\n",
+ " \n",
+ " <th class=\"col_heading level0 col1\">B\n",
+ " \n",
+ " <th class=\"col_heading level0 col2\">C\n",
+ " \n",
+ " <th class=\"col_heading level0 col3\">D\n",
+ " \n",
+ " <th class=\"col_heading level0 col4\">E\n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </thead>\n",
+ " <tbody>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fb\" class=\"row_heading level4 row0\">\n",
+ " \n",
+ " 0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow0_col0\" class=\"data row0 col0\">\n",
+ " \n",
+ " 1.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow0_col1\" class=\"data row0 col1\">\n",
+ " \n",
+ " 1.329212\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow0_col2\" class=\"data row0 col2\">\n",
+ " \n",
+ " nan\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow0_col3\" class=\"data row0 col3\">\n",
+ " \n",
+ " -0.31628\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow0_col4\" class=\"data row0 col4\">\n",
+ " \n",
+ " -0.99081\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fb\" class=\"row_heading level4 row1\">\n",
+ " \n",
+ " 1\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow1_col0\" class=\"data row1 col0\">\n",
+ " \n",
+ " 2.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow1_col1\" class=\"data row1 col1\">\n",
+ " \n",
+ " -1.070816\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow1_col2\" class=\"data row1 col2\">\n",
+ " \n",
+ " -1.438713\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow1_col3\" class=\"data row1 col3\">\n",
+ " \n",
+ " 0.564417\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow1_col4\" class=\"data row1 col4\">\n",
+ " \n",
+ " 0.295722\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fb\" class=\"row_heading level4 row2\">\n",
+ " \n",
+ " 2\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow2_col0\" class=\"data row2 col0\">\n",
+ " \n",
+ " 3.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow2_col1\" class=\"data row2 col1\">\n",
+ " \n",
+ " -1.626404\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow2_col2\" class=\"data row2 col2\">\n",
+ " \n",
+ " 0.219565\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow2_col3\" class=\"data row2 col3\">\n",
+ " \n",
+ " 0.678805\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow2_col4\" class=\"data row2 col4\">\n",
+ " \n",
+ " 1.889273\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fb\" class=\"row_heading level4 row3\">\n",
+ " \n",
+ " 3\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow3_col0\" class=\"data row3 col0\">\n",
+ " \n",
+ " 4.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow3_col1\" class=\"data row3 col1\">\n",
+ " \n",
+ " 0.961538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow3_col2\" class=\"data row3 col2\">\n",
+ " \n",
+ " 0.104011\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow3_col3\" class=\"data row3 col3\">\n",
+ " \n",
+ " -0.481165\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow3_col4\" class=\"data row3 col4\">\n",
+ " \n",
+ " 0.850229\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fb\" class=\"row_heading level4 row4\">\n",
+ " \n",
+ " 4\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow4_col0\" class=\"data row4 col0\">\n",
+ " \n",
+ " 5.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow4_col1\" class=\"data row4 col1\">\n",
+ " \n",
+ " 1.453425\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow4_col2\" class=\"data row4 col2\">\n",
+ " \n",
+ " 1.057737\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow4_col3\" class=\"data row4 col3\">\n",
+ " \n",
+ " 0.165562\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow4_col4\" class=\"data row4 col4\">\n",
+ " \n",
+ " 0.515018\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fb\" class=\"row_heading level4 row5\">\n",
+ " \n",
+ " 5\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow5_col0\" class=\"data row5 col0\">\n",
+ " \n",
+ " 6.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow5_col1\" class=\"data row5 col1\">\n",
+ " \n",
+ " -1.336936\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow5_col2\" class=\"data row5 col2\">\n",
+ " \n",
+ " 0.562861\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow5_col3\" class=\"data row5 col3\">\n",
+ " \n",
+ " 1.392855\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow5_col4\" class=\"data row5 col4\">\n",
+ " \n",
+ " -0.063328\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fb\" class=\"row_heading level4 row6\">\n",
+ " \n",
+ " 6\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow6_col0\" class=\"data row6 col0\">\n",
+ " \n",
+ " 7.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow6_col1\" class=\"data row6 col1\">\n",
+ " \n",
+ " 0.121668\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow6_col2\" class=\"data row6 col2\">\n",
+ " \n",
+ " 1.207603\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow6_col3\" class=\"data row6 col3\">\n",
+ " \n",
+ " -0.00204\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow6_col4\" class=\"data row6 col4\">\n",
+ " \n",
+ " 1.627796\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fb\" class=\"row_heading level4 row7\">\n",
+ " \n",
+ " 7\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow7_col0\" class=\"data row7 col0\">\n",
+ " \n",
+ " 8.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow7_col1\" class=\"data row7 col1\">\n",
+ " \n",
+ " 0.354493\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow7_col2\" class=\"data row7 col2\">\n",
+ " \n",
+ " 1.037528\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow7_col3\" class=\"data row7 col3\">\n",
+ " \n",
+ " -0.385684\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow7_col4\" class=\"data row7 col4\">\n",
+ " \n",
+ " 0.519818\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fb\" class=\"row_heading level4 row8\">\n",
+ " \n",
+ " 8\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow8_col0\" class=\"data row8 col0\">\n",
+ " \n",
+ " 9.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow8_col1\" class=\"data row8 col1\">\n",
+ " \n",
+ " 1.686583\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow8_col2\" class=\"data row8 col2\">\n",
+ " \n",
+ " -1.325963\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow8_col3\" class=\"data row8 col3\">\n",
+ " \n",
+ " 1.428984\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow8_col4\" class=\"data row8 col4\">\n",
+ " \n",
+ " -2.089354\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fb\" class=\"row_heading level4 row9\">\n",
+ " \n",
+ " 9\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow9_col0\" class=\"data row9 col0\">\n",
+ " \n",
+ " 10.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow9_col1\" class=\"data row9 col1\">\n",
+ " \n",
+ " -0.12982\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow9_col2\" class=\"data row9 col2\">\n",
+ " \n",
+ " 0.631523\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow9_col3\" class=\"data row9 col3\">\n",
+ " \n",
+ " -0.586538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8482f22_8bd5_11e5_9937_a45e60bd97fbrow9_col4\" class=\"data row9 col4\">\n",
+ " \n",
+ " 0.29072\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </tbody>\n",
+ " </table>\n",
+ " "
+ ],
+ "text/plain": [
+ "<pandas.core.style.Styler at 0x11338e4a8>"
+ ]
+ },
+ "execution_count": 26,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "from IPython.display import HTML\n",
+ "\n",
+ "def hover(hover_color=\"#ffff99\"):\n",
+ " return dict(selector=\"tr:hover\",\n",
+ " props=[(\"background-color\", \"%s\" % hover_color)])\n",
+ "\n",
+ "styles = [\n",
+ " hover(),\n",
+ " dict(selector=\"th\", props=[(\"font-size\", \"150%\"),\n",
+ " (\"text-align\", \"center\")]),\n",
+ " dict(selector=\"caption\", props=[(\"caption-side\", \"bottom\")])\n",
+ "]\n",
+ "html = (df.style.set_table_styles(styles)\n",
+ " .set_caption(\"Hover to highlight.\"))\n",
+ "html"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "`table_styles` should be a list of dictionaries.\n",
+ "Each dictionary should have the `selector` and `props` keys.\n",
+ "The value for `selector` should be a valid CSS selector.\n",
+ "Recall that all the styles are already attached to an `id`, unique to\n",
+ "each `Styler`. This selector is in addition to that `id`.\n",
+ "The value for `props` should be a list of tuples of `('attribute', 'value')`.\n",
+ "\n",
+ "`table_styles` are extremely flexible, but not as fun to type out by hand.\n",
+ "We hope to collect some useful ones either in pandas, or preferable in a new package that [builds on top](#Extensibility) the tools here."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Limitations\n",
+ "\n",
+ "- DataFrame only `(use Series.to_frame().style)`\n",
+ "- The index and columns must be unique\n",
+ "- No large repr, and performance isn't great; this is intended for summary DataFrames\n",
+ "- You can only style the *values*, not the index or columns\n",
+ "- You can only apply styles, you can't insert new HTML entities\n",
+ "\n",
+ "Some of these will be addressed in the future.\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Terms\n",
+ "\n",
+ "- Style function: a function that's passed into `Styler.apply` or `Styler.applymap` and returns values like `'css attribute: value'`\n",
+ "- Builtin style functions: style functions that are methods on `Styler`\n",
+ "- table style: a dictionary with the two keys `selector` and `props`. `selector` is the CSS selector that `props` will apply to. `props` is a list of `(attribute, value)` tuples. A list of table styles passed into `Styler`."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Fun stuff\n",
+ "\n",
+ "Here are a few interesting examples.\n",
+ "\n",
+ "`Styler` interacts pretty well with widgets. If you're viewing this online instead of running the notebook yourself, you're missing out on interactively adjusting the color palette."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 27,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ " <style type=\"text/css\" >\n",
+ " \n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow0_col0 {\n",
+ " \n",
+ " background-color: #557e79;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow0_col1 {\n",
+ " \n",
+ " background-color: #779894;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow0_col2 {\n",
+ " \n",
+ " background-color: #557e79;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow0_col3 {\n",
+ " \n",
+ " background-color: #809f9b;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow0_col4 {\n",
+ " \n",
+ " background-color: #aec2bf;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow1_col0 {\n",
+ " \n",
+ " background-color: #799995;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow1_col1 {\n",
+ " \n",
+ " background-color: #8ba7a3;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow1_col2 {\n",
+ " \n",
+ " background-color: #557e79;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow1_col3 {\n",
+ " \n",
+ " background-color: #dfe8e7;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow1_col4 {\n",
+ " \n",
+ " background-color: #d7e2e0;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow2_col0 {\n",
+ " \n",
+ " background-color: #9cb5b1;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow2_col1 {\n",
+ " \n",
+ " background-color: #557e79;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow2_col2 {\n",
+ " \n",
+ " background-color: #cedbd9;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow2_col3 {\n",
+ " \n",
+ " background-color: #cedbd9;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow2_col4 {\n",
+ " \n",
+ " background-color: #557e79;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow3_col0 {\n",
+ " \n",
+ " background-color: #c1d1cf;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow3_col1 {\n",
+ " \n",
+ " background-color: #9cb5b1;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow3_col2 {\n",
+ " \n",
+ " background-color: #dce5e4;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow3_col3 {\n",
+ " \n",
+ " background-color: #668b86;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow3_col4 {\n",
+ " \n",
+ " background-color: #a9bebb;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow4_col0 {\n",
+ " \n",
+ " background-color: #e5eceb;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow4_col1 {\n",
+ " \n",
+ " background-color: #6c908b;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow4_col2 {\n",
+ " \n",
+ " background-color: #678c87;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow4_col3 {\n",
+ " \n",
+ " background-color: #cedbd9;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow4_col4 {\n",
+ " \n",
+ " background-color: #c5d4d2;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow5_col0 {\n",
+ " \n",
+ " background-color: #e5eceb;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow5_col1 {\n",
+ " \n",
+ " background-color: #71948f;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow5_col2 {\n",
+ " \n",
+ " background-color: #a4bbb8;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow5_col3 {\n",
+ " \n",
+ " background-color: #5a827d;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow5_col4 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow6_col0 {\n",
+ " \n",
+ " background-color: #c1d1cf;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow6_col1 {\n",
+ " \n",
+ " background-color: #edf3f2;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow6_col2 {\n",
+ " \n",
+ " background-color: #557e79;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow6_col3 {\n",
+ " \n",
+ " background-color: #b3c6c4;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow6_col4 {\n",
+ " \n",
+ " background-color: #698e89;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow7_col0 {\n",
+ " \n",
+ " background-color: #9cb5b1;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow7_col1 {\n",
+ " \n",
+ " background-color: #d7e2e0;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow7_col2 {\n",
+ " \n",
+ " background-color: #698e89;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow7_col3 {\n",
+ " \n",
+ " background-color: #759792;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow7_col4 {\n",
+ " \n",
+ " background-color: #c5d4d2;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow8_col0 {\n",
+ " \n",
+ " background-color: #799995;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow8_col1 {\n",
+ " \n",
+ " background-color: #557e79;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow8_col2 {\n",
+ " \n",
+ " background-color: #628882;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow8_col3 {\n",
+ " \n",
+ " background-color: #557e79;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow8_col4 {\n",
+ " \n",
+ " background-color: #557e79;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow9_col0 {\n",
+ " \n",
+ " background-color: #557e79;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow9_col1 {\n",
+ " \n",
+ " background-color: #e7eeed;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow9_col2 {\n",
+ " \n",
+ " background-color: #9bb4b0;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow9_col3 {\n",
+ " \n",
+ " background-color: #557e79;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow9_col4 {\n",
+ " \n",
+ " background-color: #d7e2e0;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " </style>\n",
+ "\n",
+ " <table id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fb\">\n",
+ " \n",
+ "\n",
+ " <thead>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th class=\"blank\">\n",
+ " \n",
+ " <th class=\"col_heading level0 col0\">A\n",
+ " \n",
+ " <th class=\"col_heading level0 col1\">B\n",
+ " \n",
+ " <th class=\"col_heading level0 col2\">C\n",
+ " \n",
+ " <th class=\"col_heading level0 col3\">D\n",
+ " \n",
+ " <th class=\"col_heading level0 col4\">E\n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </thead>\n",
+ " <tbody>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fb\" class=\"row_heading level4 row0\">\n",
+ " \n",
+ " 0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow0_col0\" class=\"data row0 col0\">\n",
+ " \n",
+ " 1.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow0_col1\" class=\"data row0 col1\">\n",
+ " \n",
+ " 1.329212\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow0_col2\" class=\"data row0 col2\">\n",
+ " \n",
+ " nan\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow0_col3\" class=\"data row0 col3\">\n",
+ " \n",
+ " -0.31628\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow0_col4\" class=\"data row0 col4\">\n",
+ " \n",
+ " -0.99081\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fb\" class=\"row_heading level4 row1\">\n",
+ " \n",
+ " 1\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow1_col0\" class=\"data row1 col0\">\n",
+ " \n",
+ " 2.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow1_col1\" class=\"data row1 col1\">\n",
+ " \n",
+ " -1.070816\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow1_col2\" class=\"data row1 col2\">\n",
+ " \n",
+ " -1.438713\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow1_col3\" class=\"data row1 col3\">\n",
+ " \n",
+ " 0.564417\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow1_col4\" class=\"data row1 col4\">\n",
+ " \n",
+ " 0.295722\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fb\" class=\"row_heading level4 row2\">\n",
+ " \n",
+ " 2\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow2_col0\" class=\"data row2 col0\">\n",
+ " \n",
+ " 3.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow2_col1\" class=\"data row2 col1\">\n",
+ " \n",
+ " -1.626404\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow2_col2\" class=\"data row2 col2\">\n",
+ " \n",
+ " 0.219565\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow2_col3\" class=\"data row2 col3\">\n",
+ " \n",
+ " 0.678805\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow2_col4\" class=\"data row2 col4\">\n",
+ " \n",
+ " 1.889273\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fb\" class=\"row_heading level4 row3\">\n",
+ " \n",
+ " 3\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow3_col0\" class=\"data row3 col0\">\n",
+ " \n",
+ " 4.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow3_col1\" class=\"data row3 col1\">\n",
+ " \n",
+ " 0.961538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow3_col2\" class=\"data row3 col2\">\n",
+ " \n",
+ " 0.104011\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow3_col3\" class=\"data row3 col3\">\n",
+ " \n",
+ " -0.481165\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow3_col4\" class=\"data row3 col4\">\n",
+ " \n",
+ " 0.850229\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fb\" class=\"row_heading level4 row4\">\n",
+ " \n",
+ " 4\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow4_col0\" class=\"data row4 col0\">\n",
+ " \n",
+ " 5.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow4_col1\" class=\"data row4 col1\">\n",
+ " \n",
+ " 1.453425\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow4_col2\" class=\"data row4 col2\">\n",
+ " \n",
+ " 1.057737\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow4_col3\" class=\"data row4 col3\">\n",
+ " \n",
+ " 0.165562\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow4_col4\" class=\"data row4 col4\">\n",
+ " \n",
+ " 0.515018\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fb\" class=\"row_heading level4 row5\">\n",
+ " \n",
+ " 5\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow5_col0\" class=\"data row5 col0\">\n",
+ " \n",
+ " 6.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow5_col1\" class=\"data row5 col1\">\n",
+ " \n",
+ " -1.336936\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow5_col2\" class=\"data row5 col2\">\n",
+ " \n",
+ " 0.562861\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow5_col3\" class=\"data row5 col3\">\n",
+ " \n",
+ " 1.392855\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow5_col4\" class=\"data row5 col4\">\n",
+ " \n",
+ " -0.063328\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fb\" class=\"row_heading level4 row6\">\n",
+ " \n",
+ " 6\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow6_col0\" class=\"data row6 col0\">\n",
+ " \n",
+ " 7.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow6_col1\" class=\"data row6 col1\">\n",
+ " \n",
+ " 0.121668\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow6_col2\" class=\"data row6 col2\">\n",
+ " \n",
+ " 1.207603\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow6_col3\" class=\"data row6 col3\">\n",
+ " \n",
+ " -0.00204\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow6_col4\" class=\"data row6 col4\">\n",
+ " \n",
+ " 1.627796\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fb\" class=\"row_heading level4 row7\">\n",
+ " \n",
+ " 7\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow7_col0\" class=\"data row7 col0\">\n",
+ " \n",
+ " 8.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow7_col1\" class=\"data row7 col1\">\n",
+ " \n",
+ " 0.354493\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow7_col2\" class=\"data row7 col2\">\n",
+ " \n",
+ " 1.037528\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow7_col3\" class=\"data row7 col3\">\n",
+ " \n",
+ " -0.385684\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow7_col4\" class=\"data row7 col4\">\n",
+ " \n",
+ " 0.519818\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fb\" class=\"row_heading level4 row8\">\n",
+ " \n",
+ " 8\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow8_col0\" class=\"data row8 col0\">\n",
+ " \n",
+ " 9.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow8_col1\" class=\"data row8 col1\">\n",
+ " \n",
+ " 1.686583\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow8_col2\" class=\"data row8 col2\">\n",
+ " \n",
+ " -1.325963\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow8_col3\" class=\"data row8 col3\">\n",
+ " \n",
+ " 1.428984\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow8_col4\" class=\"data row8 col4\">\n",
+ " \n",
+ " -2.089354\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fb\" class=\"row_heading level4 row9\">\n",
+ " \n",
+ " 9\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow9_col0\" class=\"data row9 col0\">\n",
+ " \n",
+ " 10.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow9_col1\" class=\"data row9 col1\">\n",
+ " \n",
+ " -0.12982\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow9_col2\" class=\"data row9 col2\">\n",
+ " \n",
+ " 0.631523\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow9_col3\" class=\"data row9 col3\">\n",
+ " \n",
+ " -0.586538\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8588302_8bd5_11e5_aa89_a45e60bd97fbrow9_col4\" class=\"data row9 col4\">\n",
+ " \n",
+ " 0.29072\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </tbody>\n",
+ " </table>\n",
+ " "
+ ],
+ "text/plain": [
+ "<pandas.core.style.Styler at 0x11338e0f0>"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "from IPython.html import widgets\n",
+ "@widgets.interact\n",
+ "def f(h_neg=(0, 359, 1), h_pos=(0, 359), s=(0., 99.9), l=(0., 99.9)):\n",
+ " return df.style.background_gradient(\n",
+ " cmap=sns.palettes.diverging_palette(h_neg=h_neg, h_pos=h_pos, s=s, l=l,\n",
+ " as_cmap=True)\n",
+ " )"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 28,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [],
+ "source": [
+ "def magnify():\n",
+ " return [dict(selector=\"th\",\n",
+ " props=[(\"font-size\", \"4pt\")]),\n",
+ " dict(selector=\"th:hover\",\n",
+ " props=[(\"font-size\", \"12pt\")]),\n",
+ " dict(selector=\"tr:hover td:hover\",\n",
+ " props=[('max-width', '200px'),\n",
+ " ('font-size', '12pt')])\n",
+ "]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 29,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ " <style type=\"text/css\" >\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb th {\n",
+ " \n",
+ " font-size: 4pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb th:hover {\n",
+ " \n",
+ " font-size: 12pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb tr:hover td:hover {\n",
+ " \n",
+ " max-width: 200px;\n",
+ " \n",
+ " font-size: 12pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col0 {\n",
+ " \n",
+ " background-color: #ecf2f8;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col1 {\n",
+ " \n",
+ " background-color: #b8cce5;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col2 {\n",
+ " \n",
+ " background-color: #efb1be;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col3 {\n",
+ " \n",
+ " background-color: #f3c2cc;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col4 {\n",
+ " \n",
+ " background-color: #eeaab7;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col5 {\n",
+ " \n",
+ " background-color: #f8dce2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col6 {\n",
+ " \n",
+ " background-color: #f2c1cb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col7 {\n",
+ " \n",
+ " background-color: #83a6d2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col8 {\n",
+ " \n",
+ " background-color: #de5f79;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col9 {\n",
+ " \n",
+ " background-color: #c3d4e9;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col10 {\n",
+ " \n",
+ " background-color: #eeacba;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col11 {\n",
+ " \n",
+ " background-color: #f7dae0;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col12 {\n",
+ " \n",
+ " background-color: #6f98ca;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col13 {\n",
+ " \n",
+ " background-color: #e890a1;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col14 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col15 {\n",
+ " \n",
+ " background-color: #ea96a7;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col16 {\n",
+ " \n",
+ " background-color: #adc4e1;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col17 {\n",
+ " \n",
+ " background-color: #eca3b1;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col18 {\n",
+ " \n",
+ " background-color: #b7cbe5;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col19 {\n",
+ " \n",
+ " background-color: #f5ced6;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col20 {\n",
+ " \n",
+ " background-color: #6590c7;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col21 {\n",
+ " \n",
+ " background-color: #d73c5b;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col22 {\n",
+ " \n",
+ " background-color: #4479bb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col23 {\n",
+ " \n",
+ " background-color: #cfddee;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col24 {\n",
+ " \n",
+ " background-color: #e58094;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col0 {\n",
+ " \n",
+ " background-color: #e4798e;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col1 {\n",
+ " \n",
+ " background-color: #aec5e1;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col2 {\n",
+ " \n",
+ " background-color: #eb9ead;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col3 {\n",
+ " \n",
+ " background-color: #ec9faf;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col4 {\n",
+ " \n",
+ " background-color: #cbdaec;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col5 {\n",
+ " \n",
+ " background-color: #f9e0e5;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col6 {\n",
+ " \n",
+ " background-color: #db4f6b;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col7 {\n",
+ " \n",
+ " background-color: #4479bb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col8 {\n",
+ " \n",
+ " background-color: #e57f93;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col9 {\n",
+ " \n",
+ " background-color: #bdd0e7;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col10 {\n",
+ " \n",
+ " background-color: #f3c2cc;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col11 {\n",
+ " \n",
+ " background-color: #f8dfe4;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col12 {\n",
+ " \n",
+ " background-color: #b0c6e2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col13 {\n",
+ " \n",
+ " background-color: #ec9faf;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col14 {\n",
+ " \n",
+ " background-color: #e27389;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col15 {\n",
+ " \n",
+ " background-color: #eb9dac;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col16 {\n",
+ " \n",
+ " background-color: #f1b8c3;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col17 {\n",
+ " \n",
+ " background-color: #efb1be;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col18 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col19 {\n",
+ " \n",
+ " background-color: #f8dce2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col20 {\n",
+ " \n",
+ " background-color: #a0bbdc;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col21 {\n",
+ " \n",
+ " background-color: #d73c5b;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col22 {\n",
+ " \n",
+ " background-color: #86a8d3;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col23 {\n",
+ " \n",
+ " background-color: #d9e4f1;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col24 {\n",
+ " \n",
+ " background-color: #ecf2f8;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col0 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col1 {\n",
+ " \n",
+ " background-color: #5887c2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col2 {\n",
+ " \n",
+ " background-color: #f2bfca;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col3 {\n",
+ " \n",
+ " background-color: #c7d7eb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col4 {\n",
+ " \n",
+ " background-color: #82a5d1;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col5 {\n",
+ " \n",
+ " background-color: #ebf1f8;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col6 {\n",
+ " \n",
+ " background-color: #e78a9d;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col7 {\n",
+ " \n",
+ " background-color: #4479bb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col8 {\n",
+ " \n",
+ " background-color: #f1bbc6;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col9 {\n",
+ " \n",
+ " background-color: #779dcd;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col10 {\n",
+ " \n",
+ " background-color: #d4e0ef;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col11 {\n",
+ " \n",
+ " background-color: #e6edf6;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col12 {\n",
+ " \n",
+ " background-color: #e0e9f4;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col13 {\n",
+ " \n",
+ " background-color: #fbeaed;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col14 {\n",
+ " \n",
+ " background-color: #e78a9d;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col15 {\n",
+ " \n",
+ " background-color: #fae7eb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col16 {\n",
+ " \n",
+ " background-color: #e6edf6;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col17 {\n",
+ " \n",
+ " background-color: #e6edf6;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col18 {\n",
+ " \n",
+ " background-color: #b9cde6;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col19 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col20 {\n",
+ " \n",
+ " background-color: #a0bbdc;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col21 {\n",
+ " \n",
+ " background-color: #d73c5b;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col22 {\n",
+ " \n",
+ " background-color: #618ec5;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col23 {\n",
+ " \n",
+ " background-color: #8faed6;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col24 {\n",
+ " \n",
+ " background-color: #c3d4e9;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col0 {\n",
+ " \n",
+ " background-color: #f6d5db;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col1 {\n",
+ " \n",
+ " background-color: #5384c0;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col2 {\n",
+ " \n",
+ " background-color: #f1bbc6;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col3 {\n",
+ " \n",
+ " background-color: #c7d7eb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col4 {\n",
+ " \n",
+ " background-color: #4479bb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col5 {\n",
+ " \n",
+ " background-color: #e7eef6;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col6 {\n",
+ " \n",
+ " background-color: #e58195;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col7 {\n",
+ " \n",
+ " background-color: #4479bb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col8 {\n",
+ " \n",
+ " background-color: #f2c1cb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col9 {\n",
+ " \n",
+ " background-color: #b1c7e2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col10 {\n",
+ " \n",
+ " background-color: #d4e0ef;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col11 {\n",
+ " \n",
+ " background-color: #c1d3e8;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col12 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col13 {\n",
+ " \n",
+ " background-color: #cedced;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col14 {\n",
+ " \n",
+ " background-color: #e7899c;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col15 {\n",
+ " \n",
+ " background-color: #eeacba;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col16 {\n",
+ " \n",
+ " background-color: #e2eaf4;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col17 {\n",
+ " \n",
+ " background-color: #f7d6dd;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col18 {\n",
+ " \n",
+ " background-color: #a8c0df;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col19 {\n",
+ " \n",
+ " background-color: #f5ccd4;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col20 {\n",
+ " \n",
+ " background-color: #b7cbe5;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col21 {\n",
+ " \n",
+ " background-color: #d73c5b;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col22 {\n",
+ " \n",
+ " background-color: #739acc;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col23 {\n",
+ " \n",
+ " background-color: #8dadd5;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col24 {\n",
+ " \n",
+ " background-color: #cddbed;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col0 {\n",
+ " \n",
+ " background-color: #ea9aaa;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col1 {\n",
+ " \n",
+ " background-color: #5887c2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col2 {\n",
+ " \n",
+ " background-color: #f4c9d2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col3 {\n",
+ " \n",
+ " background-color: #f5ced6;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col4 {\n",
+ " \n",
+ " background-color: #4479bb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col5 {\n",
+ " \n",
+ " background-color: #fae4e9;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col6 {\n",
+ " \n",
+ " background-color: #e78c9e;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col7 {\n",
+ " \n",
+ " background-color: #5182bf;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col8 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col9 {\n",
+ " \n",
+ " background-color: #c1d3e8;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col10 {\n",
+ " \n",
+ " background-color: #e8eff7;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col11 {\n",
+ " \n",
+ " background-color: #c9d8eb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col12 {\n",
+ " \n",
+ " background-color: #eaf0f7;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col13 {\n",
+ " \n",
+ " background-color: #f9e2e6;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col14 {\n",
+ " \n",
+ " background-color: #e47c91;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col15 {\n",
+ " \n",
+ " background-color: #eda8b6;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col16 {\n",
+ " \n",
+ " background-color: #fae6ea;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col17 {\n",
+ " \n",
+ " background-color: #f5ccd4;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col18 {\n",
+ " \n",
+ " background-color: #b3c9e3;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col19 {\n",
+ " \n",
+ " background-color: #f4cad3;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col20 {\n",
+ " \n",
+ " background-color: #9fbadc;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col21 {\n",
+ " \n",
+ " background-color: #d73c5b;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col22 {\n",
+ " \n",
+ " background-color: #7da2cf;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col23 {\n",
+ " \n",
+ " background-color: #95b3d8;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col24 {\n",
+ " \n",
+ " background-color: #a2bcdd;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col0 {\n",
+ " \n",
+ " background-color: #fbeaed;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col1 {\n",
+ " \n",
+ " background-color: #6490c6;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col2 {\n",
+ " \n",
+ " background-color: #f6d1d8;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col3 {\n",
+ " \n",
+ " background-color: #f3c6cf;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col4 {\n",
+ " \n",
+ " background-color: #4479bb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col5 {\n",
+ " \n",
+ " background-color: #fae6ea;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col6 {\n",
+ " \n",
+ " background-color: #e68598;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col7 {\n",
+ " \n",
+ " background-color: #6d96ca;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col8 {\n",
+ " \n",
+ " background-color: #f9e3e7;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col9 {\n",
+ " \n",
+ " background-color: #fae7eb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col10 {\n",
+ " \n",
+ " background-color: #bdd0e7;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col11 {\n",
+ " \n",
+ " background-color: #e0e9f4;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col12 {\n",
+ " \n",
+ " background-color: #f5ced6;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col13 {\n",
+ " \n",
+ " background-color: #e6edf6;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col14 {\n",
+ " \n",
+ " background-color: #e47a90;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col15 {\n",
+ " \n",
+ " background-color: #fbeaed;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col16 {\n",
+ " \n",
+ " background-color: #f3c5ce;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col17 {\n",
+ " \n",
+ " background-color: #f7dae0;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col18 {\n",
+ " \n",
+ " background-color: #cbdaec;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col19 {\n",
+ " \n",
+ " background-color: #f6d2d9;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col20 {\n",
+ " \n",
+ " background-color: #b5cae4;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col21 {\n",
+ " \n",
+ " background-color: #d73c5b;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col22 {\n",
+ " \n",
+ " background-color: #8faed6;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col23 {\n",
+ " \n",
+ " background-color: #a3bddd;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col24 {\n",
+ " \n",
+ " background-color: #7199cb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col0 {\n",
+ " \n",
+ " background-color: #e6edf6;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col1 {\n",
+ " \n",
+ " background-color: #4e80be;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col2 {\n",
+ " \n",
+ " background-color: #f8dee3;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col3 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col4 {\n",
+ " \n",
+ " background-color: #6a94c9;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col5 {\n",
+ " \n",
+ " background-color: #fae4e9;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col6 {\n",
+ " \n",
+ " background-color: #f3c2cc;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col7 {\n",
+ " \n",
+ " background-color: #759ccd;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col8 {\n",
+ " \n",
+ " background-color: #f2c1cb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col9 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col10 {\n",
+ " \n",
+ " background-color: #cbdaec;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col11 {\n",
+ " \n",
+ " background-color: #c5d5ea;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col12 {\n",
+ " \n",
+ " background-color: #fae6ea;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col13 {\n",
+ " \n",
+ " background-color: #c6d6ea;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col14 {\n",
+ " \n",
+ " background-color: #eca3b1;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col15 {\n",
+ " \n",
+ " background-color: #fae4e9;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col16 {\n",
+ " \n",
+ " background-color: #eeacba;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col17 {\n",
+ " \n",
+ " background-color: #f6d1d8;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col18 {\n",
+ " \n",
+ " background-color: #d8e3f1;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col19 {\n",
+ " \n",
+ " background-color: #eb9bab;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col20 {\n",
+ " \n",
+ " background-color: #a3bddd;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col21 {\n",
+ " \n",
+ " background-color: #d73c5b;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col22 {\n",
+ " \n",
+ " background-color: #81a4d1;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col23 {\n",
+ " \n",
+ " background-color: #95b3d8;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col24 {\n",
+ " \n",
+ " background-color: #4479bb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col0 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col1 {\n",
+ " \n",
+ " background-color: #759ccd;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col2 {\n",
+ " \n",
+ " background-color: #f2bdc8;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col3 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col4 {\n",
+ " \n",
+ " background-color: #5686c1;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col5 {\n",
+ " \n",
+ " background-color: #f0b5c1;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col6 {\n",
+ " \n",
+ " background-color: #f4c9d2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col7 {\n",
+ " \n",
+ " background-color: #628fc6;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col8 {\n",
+ " \n",
+ " background-color: #e68396;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col9 {\n",
+ " \n",
+ " background-color: #eda7b5;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col10 {\n",
+ " \n",
+ " background-color: #f5ccd4;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col11 {\n",
+ " \n",
+ " background-color: #e8eff7;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col12 {\n",
+ " \n",
+ " background-color: #eaf0f7;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col13 {\n",
+ " \n",
+ " background-color: #ebf1f8;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col14 {\n",
+ " \n",
+ " background-color: #de5c76;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col15 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col16 {\n",
+ " \n",
+ " background-color: #dd5671;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col17 {\n",
+ " \n",
+ " background-color: #e993a4;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col18 {\n",
+ " \n",
+ " background-color: #dae5f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col19 {\n",
+ " \n",
+ " background-color: #e991a3;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col20 {\n",
+ " \n",
+ " background-color: #dce6f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col21 {\n",
+ " \n",
+ " background-color: #d73c5b;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col22 {\n",
+ " \n",
+ " background-color: #a0bbdc;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col23 {\n",
+ " \n",
+ " background-color: #96b4d9;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col24 {\n",
+ " \n",
+ " background-color: #4479bb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col0 {\n",
+ " \n",
+ " background-color: #d3dfef;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col1 {\n",
+ " \n",
+ " background-color: #487cbc;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col2 {\n",
+ " \n",
+ " background-color: #ea9aaa;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col3 {\n",
+ " \n",
+ " background-color: #fae7eb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col4 {\n",
+ " \n",
+ " background-color: #4479bb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col5 {\n",
+ " \n",
+ " background-color: #eb9ead;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col6 {\n",
+ " \n",
+ " background-color: #f3c5ce;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col7 {\n",
+ " \n",
+ " background-color: #4d7fbe;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col8 {\n",
+ " \n",
+ " background-color: #e994a5;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col9 {\n",
+ " \n",
+ " background-color: #f6d5db;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col10 {\n",
+ " \n",
+ " background-color: #f5ccd4;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col11 {\n",
+ " \n",
+ " background-color: #d5e1f0;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col12 {\n",
+ " \n",
+ " background-color: #f0b4c0;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col13 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col14 {\n",
+ " \n",
+ " background-color: #da4966;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col15 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col16 {\n",
+ " \n",
+ " background-color: #d73c5b;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col17 {\n",
+ " \n",
+ " background-color: #ea96a7;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col18 {\n",
+ " \n",
+ " background-color: #ecf2f8;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col19 {\n",
+ " \n",
+ " background-color: #e3748a;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col20 {\n",
+ " \n",
+ " background-color: #dde7f3;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col21 {\n",
+ " \n",
+ " background-color: #dc516d;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col22 {\n",
+ " \n",
+ " background-color: #91b0d7;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col23 {\n",
+ " \n",
+ " background-color: #a8c0df;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col24 {\n",
+ " \n",
+ " background-color: #5c8ac4;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col0 {\n",
+ " \n",
+ " background-color: #dce6f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col1 {\n",
+ " \n",
+ " background-color: #6590c7;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col2 {\n",
+ " \n",
+ " background-color: #ea99a9;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col3 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col4 {\n",
+ " \n",
+ " background-color: #4479bb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col5 {\n",
+ " \n",
+ " background-color: #f3c5ce;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col6 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col7 {\n",
+ " \n",
+ " background-color: #6a94c9;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col8 {\n",
+ " \n",
+ " background-color: #f6d5db;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col9 {\n",
+ " \n",
+ " background-color: #ebf1f8;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col10 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col11 {\n",
+ " \n",
+ " background-color: #dfe8f3;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col12 {\n",
+ " \n",
+ " background-color: #efb2bf;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col13 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col14 {\n",
+ " \n",
+ " background-color: #e27389;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col15 {\n",
+ " \n",
+ " background-color: #f3c5ce;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col16 {\n",
+ " \n",
+ " background-color: #d73c5b;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col17 {\n",
+ " \n",
+ " background-color: #ea9aaa;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col18 {\n",
+ " \n",
+ " background-color: #dae5f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col19 {\n",
+ " \n",
+ " background-color: #e993a4;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col20 {\n",
+ " \n",
+ " background-color: #b9cde6;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col21 {\n",
+ " \n",
+ " background-color: #de5f79;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col22 {\n",
+ " \n",
+ " background-color: #b3c9e3;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col23 {\n",
+ " \n",
+ " background-color: #9fbadc;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col24 {\n",
+ " \n",
+ " background-color: #6f98ca;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col0 {\n",
+ " \n",
+ " background-color: #c6d6ea;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col1 {\n",
+ " \n",
+ " background-color: #6f98ca;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col2 {\n",
+ " \n",
+ " background-color: #ea96a7;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col3 {\n",
+ " \n",
+ " background-color: #f7dae0;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col4 {\n",
+ " \n",
+ " background-color: #4479bb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col5 {\n",
+ " \n",
+ " background-color: #f0b7c2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col6 {\n",
+ " \n",
+ " background-color: #fae4e9;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col7 {\n",
+ " \n",
+ " background-color: #759ccd;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col8 {\n",
+ " \n",
+ " background-color: #f2bdc8;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col9 {\n",
+ " \n",
+ " background-color: #f9e2e6;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col10 {\n",
+ " \n",
+ " background-color: #fae7eb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col11 {\n",
+ " \n",
+ " background-color: #cbdaec;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col12 {\n",
+ " \n",
+ " background-color: #efb1be;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col13 {\n",
+ " \n",
+ " background-color: #eaf0f7;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col14 {\n",
+ " \n",
+ " background-color: #e0657d;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col15 {\n",
+ " \n",
+ " background-color: #eca1b0;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col16 {\n",
+ " \n",
+ " background-color: #d73c5b;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col17 {\n",
+ " \n",
+ " background-color: #e27087;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col18 {\n",
+ " \n",
+ " background-color: #f9e2e6;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col19 {\n",
+ " \n",
+ " background-color: #e68699;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col20 {\n",
+ " \n",
+ " background-color: #fae6ea;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col21 {\n",
+ " \n",
+ " background-color: #d73c5b;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col22 {\n",
+ " \n",
+ " background-color: #d1deee;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col23 {\n",
+ " \n",
+ " background-color: #82a5d1;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col24 {\n",
+ " \n",
+ " background-color: #7099cb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col0 {\n",
+ " \n",
+ " background-color: #a9c1e0;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col1 {\n",
+ " \n",
+ " background-color: #6892c8;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col2 {\n",
+ " \n",
+ " background-color: #f7d6dd;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col3 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col4 {\n",
+ " \n",
+ " background-color: #4479bb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col5 {\n",
+ " \n",
+ " background-color: #e4ecf5;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col6 {\n",
+ " \n",
+ " background-color: #d8e3f1;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col7 {\n",
+ " \n",
+ " background-color: #477bbc;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col8 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col9 {\n",
+ " \n",
+ " background-color: #e7eef6;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col10 {\n",
+ " \n",
+ " background-color: #cbdaec;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col11 {\n",
+ " \n",
+ " background-color: #a6bfde;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col12 {\n",
+ " \n",
+ " background-color: #fae8ec;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col13 {\n",
+ " \n",
+ " background-color: #a9c1e0;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col14 {\n",
+ " \n",
+ " background-color: #e3748a;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col15 {\n",
+ " \n",
+ " background-color: #ea99a9;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col16 {\n",
+ " \n",
+ " background-color: #d73c5b;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col17 {\n",
+ " \n",
+ " background-color: #f0b7c2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col18 {\n",
+ " \n",
+ " background-color: #f6d5db;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col19 {\n",
+ " \n",
+ " background-color: #eb9ead;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col20 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col21 {\n",
+ " \n",
+ " background-color: #d8415f;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col22 {\n",
+ " \n",
+ " background-color: #b5cae4;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col23 {\n",
+ " \n",
+ " background-color: #5182bf;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col24 {\n",
+ " \n",
+ " background-color: #457abb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col0 {\n",
+ " \n",
+ " background-color: #92b1d7;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col1 {\n",
+ " \n",
+ " background-color: #7ba0cf;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col2 {\n",
+ " \n",
+ " background-color: #f3c5ce;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col3 {\n",
+ " \n",
+ " background-color: #f7d7de;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col4 {\n",
+ " \n",
+ " background-color: #5485c1;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col5 {\n",
+ " \n",
+ " background-color: #f5cfd7;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col6 {\n",
+ " \n",
+ " background-color: #d4e0ef;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col7 {\n",
+ " \n",
+ " background-color: #4479bb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col8 {\n",
+ " \n",
+ " background-color: #f4cad3;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col9 {\n",
+ " \n",
+ " background-color: #dfe8f3;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col10 {\n",
+ " \n",
+ " background-color: #b0c6e2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col11 {\n",
+ " \n",
+ " background-color: #9fbadc;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col12 {\n",
+ " \n",
+ " background-color: #fae8ec;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col13 {\n",
+ " \n",
+ " background-color: #cad9ec;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col14 {\n",
+ " \n",
+ " background-color: #e991a3;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col15 {\n",
+ " \n",
+ " background-color: #eca3b1;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col16 {\n",
+ " \n",
+ " background-color: #de5c76;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col17 {\n",
+ " \n",
+ " background-color: #f4cad3;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col18 {\n",
+ " \n",
+ " background-color: #f7dae0;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col19 {\n",
+ " \n",
+ " background-color: #eb9dac;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col20 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col21 {\n",
+ " \n",
+ " background-color: #d73c5b;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col22 {\n",
+ " \n",
+ " background-color: #acc3e1;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col23 {\n",
+ " \n",
+ " background-color: #497dbd;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col24 {\n",
+ " \n",
+ " background-color: #5c8ac4;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col0 {\n",
+ " \n",
+ " background-color: #bccfe7;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col1 {\n",
+ " \n",
+ " background-color: #8faed6;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col2 {\n",
+ " \n",
+ " background-color: #eda6b4;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col3 {\n",
+ " \n",
+ " background-color: #f5ced6;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col4 {\n",
+ " \n",
+ " background-color: #5c8ac4;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col5 {\n",
+ " \n",
+ " background-color: #efb2bf;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col6 {\n",
+ " \n",
+ " background-color: #f4cad3;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col7 {\n",
+ " \n",
+ " background-color: #4479bb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col8 {\n",
+ " \n",
+ " background-color: #f3c2cc;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col9 {\n",
+ " \n",
+ " background-color: #fae8ec;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col10 {\n",
+ " \n",
+ " background-color: #dde7f3;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col11 {\n",
+ " \n",
+ " background-color: #bbcee6;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col12 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col13 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col14 {\n",
+ " \n",
+ " background-color: #e78a9d;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col15 {\n",
+ " \n",
+ " background-color: #eda7b5;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col16 {\n",
+ " \n",
+ " background-color: #dc546f;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col17 {\n",
+ " \n",
+ " background-color: #eca3b1;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col18 {\n",
+ " \n",
+ " background-color: #e6edf6;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col19 {\n",
+ " \n",
+ " background-color: #eeaab7;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col20 {\n",
+ " \n",
+ " background-color: #f9e3e7;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col21 {\n",
+ " \n",
+ " background-color: #d73c5b;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col22 {\n",
+ " \n",
+ " background-color: #b8cce5;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col23 {\n",
+ " \n",
+ " background-color: #7099cb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col24 {\n",
+ " \n",
+ " background-color: #5e8bc4;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col0 {\n",
+ " \n",
+ " background-color: #91b0d7;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col1 {\n",
+ " \n",
+ " background-color: #86a8d3;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col2 {\n",
+ " \n",
+ " background-color: #efb2bf;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col3 {\n",
+ " \n",
+ " background-color: #f9e3e7;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col4 {\n",
+ " \n",
+ " background-color: #5e8bc4;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col5 {\n",
+ " \n",
+ " background-color: #f2bfca;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col6 {\n",
+ " \n",
+ " background-color: #fae6ea;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col7 {\n",
+ " \n",
+ " background-color: #6b95c9;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col8 {\n",
+ " \n",
+ " background-color: #f3c6cf;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col9 {\n",
+ " \n",
+ " background-color: #e8eff7;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col10 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col11 {\n",
+ " \n",
+ " background-color: #bdd0e7;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col12 {\n",
+ " \n",
+ " background-color: #95b3d8;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col13 {\n",
+ " \n",
+ " background-color: #dae5f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col14 {\n",
+ " \n",
+ " background-color: #eeabb8;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col15 {\n",
+ " \n",
+ " background-color: #eeacba;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col16 {\n",
+ " \n",
+ " background-color: #e3748a;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col17 {\n",
+ " \n",
+ " background-color: #eca4b3;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col18 {\n",
+ " \n",
+ " background-color: #f7d6dd;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col19 {\n",
+ " \n",
+ " background-color: #f6d2d9;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col20 {\n",
+ " \n",
+ " background-color: #f9e3e7;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col21 {\n",
+ " \n",
+ " background-color: #d73c5b;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col22 {\n",
+ " \n",
+ " background-color: #9bb7da;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col23 {\n",
+ " \n",
+ " background-color: #618ec5;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col24 {\n",
+ " \n",
+ " background-color: #4479bb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col0 {\n",
+ " \n",
+ " background-color: #5787c2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col1 {\n",
+ " \n",
+ " background-color: #5e8bc4;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col2 {\n",
+ " \n",
+ " background-color: #f5cfd7;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col3 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col4 {\n",
+ " \n",
+ " background-color: #5384c0;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col5 {\n",
+ " \n",
+ " background-color: #f8dee3;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col6 {\n",
+ " \n",
+ " background-color: #dce6f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col7 {\n",
+ " \n",
+ " background-color: #5787c2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col8 {\n",
+ " \n",
+ " background-color: #f9e3e7;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col9 {\n",
+ " \n",
+ " background-color: #cedced;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col10 {\n",
+ " \n",
+ " background-color: #dde7f3;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col11 {\n",
+ " \n",
+ " background-color: #9cb8db;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col12 {\n",
+ " \n",
+ " background-color: #749bcc;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col13 {\n",
+ " \n",
+ " background-color: #b2c8e3;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col14 {\n",
+ " \n",
+ " background-color: #f8dfe4;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col15 {\n",
+ " \n",
+ " background-color: #f4c9d2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col16 {\n",
+ " \n",
+ " background-color: #eeabb8;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col17 {\n",
+ " \n",
+ " background-color: #f3c6cf;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col18 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col19 {\n",
+ " \n",
+ " background-color: #e2eaf4;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col20 {\n",
+ " \n",
+ " background-color: #dfe8f3;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col21 {\n",
+ " \n",
+ " background-color: #d73c5b;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col22 {\n",
+ " \n",
+ " background-color: #94b2d8;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col23 {\n",
+ " \n",
+ " background-color: #4479bb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col24 {\n",
+ " \n",
+ " background-color: #5384c0;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col0 {\n",
+ " \n",
+ " background-color: #6993c8;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col1 {\n",
+ " \n",
+ " background-color: #6590c7;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col2 {\n",
+ " \n",
+ " background-color: #e2eaf4;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col3 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col4 {\n",
+ " \n",
+ " background-color: #457abb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col5 {\n",
+ " \n",
+ " background-color: #e3ebf5;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col6 {\n",
+ " \n",
+ " background-color: #bdd0e7;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col7 {\n",
+ " \n",
+ " background-color: #5384c0;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col8 {\n",
+ " \n",
+ " background-color: #f7d7de;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col9 {\n",
+ " \n",
+ " background-color: #96b4d9;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col10 {\n",
+ " \n",
+ " background-color: #b0c6e2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col11 {\n",
+ " \n",
+ " background-color: #b2c8e3;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col12 {\n",
+ " \n",
+ " background-color: #4a7ebd;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col13 {\n",
+ " \n",
+ " background-color: #92b1d7;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col14 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col15 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col16 {\n",
+ " \n",
+ " background-color: #f4cad3;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col17 {\n",
+ " \n",
+ " background-color: #ebf1f8;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col18 {\n",
+ " \n",
+ " background-color: #dce6f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col19 {\n",
+ " \n",
+ " background-color: #c9d8eb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col20 {\n",
+ " \n",
+ " background-color: #bfd1e8;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col21 {\n",
+ " \n",
+ " background-color: #d73c5b;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col22 {\n",
+ " \n",
+ " background-color: #8faed6;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col23 {\n",
+ " \n",
+ " background-color: #4479bb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col24 {\n",
+ " \n",
+ " background-color: #5a88c3;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col0 {\n",
+ " \n",
+ " background-color: #628fc6;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col1 {\n",
+ " \n",
+ " background-color: #749bcc;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col2 {\n",
+ " \n",
+ " background-color: #f9e2e6;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col3 {\n",
+ " \n",
+ " background-color: #f8dee3;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col4 {\n",
+ " \n",
+ " background-color: #5182bf;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col5 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col6 {\n",
+ " \n",
+ " background-color: #d4e0ef;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col7 {\n",
+ " \n",
+ " background-color: #5182bf;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col8 {\n",
+ " \n",
+ " background-color: #f4cad3;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col9 {\n",
+ " \n",
+ " background-color: #85a7d2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col10 {\n",
+ " \n",
+ " background-color: #cbdaec;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col11 {\n",
+ " \n",
+ " background-color: #bccfe7;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col12 {\n",
+ " \n",
+ " background-color: #5f8cc5;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col13 {\n",
+ " \n",
+ " background-color: #a2bcdd;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col14 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col15 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col16 {\n",
+ " \n",
+ " background-color: #f3c6cf;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col17 {\n",
+ " \n",
+ " background-color: #fae7eb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col18 {\n",
+ " \n",
+ " background-color: #fbeaed;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col19 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col20 {\n",
+ " \n",
+ " background-color: #b7cbe5;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col21 {\n",
+ " \n",
+ " background-color: #d73c5b;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col22 {\n",
+ " \n",
+ " background-color: #86a8d3;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col23 {\n",
+ " \n",
+ " background-color: #4479bb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col24 {\n",
+ " \n",
+ " background-color: #739acc;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col0 {\n",
+ " \n",
+ " background-color: #6a94c9;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col1 {\n",
+ " \n",
+ " background-color: #6d96ca;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col2 {\n",
+ " \n",
+ " background-color: #f4c9d2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col3 {\n",
+ " \n",
+ " background-color: #eeaebb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col4 {\n",
+ " \n",
+ " background-color: #5384c0;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col5 {\n",
+ " \n",
+ " background-color: #f2bfca;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col6 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col7 {\n",
+ " \n",
+ " background-color: #4479bb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col8 {\n",
+ " \n",
+ " background-color: #ec9faf;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col9 {\n",
+ " \n",
+ " background-color: #c6d6ea;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col10 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col11 {\n",
+ " \n",
+ " background-color: #dae5f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col12 {\n",
+ " \n",
+ " background-color: #4c7ebd;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col13 {\n",
+ " \n",
+ " background-color: #d1deee;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col14 {\n",
+ " \n",
+ " background-color: #fae6ea;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col15 {\n",
+ " \n",
+ " background-color: #f7d9df;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col16 {\n",
+ " \n",
+ " background-color: #eeacba;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col17 {\n",
+ " \n",
+ " background-color: #f6d1d8;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col18 {\n",
+ " \n",
+ " background-color: #f6d2d9;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col19 {\n",
+ " \n",
+ " background-color: #f4c9d2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col20 {\n",
+ " \n",
+ " background-color: #bccfe7;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col21 {\n",
+ " \n",
+ " background-color: #d73c5b;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col22 {\n",
+ " \n",
+ " background-color: #9eb9db;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col23 {\n",
+ " \n",
+ " background-color: #5485c1;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col24 {\n",
+ " \n",
+ " background-color: #8babd4;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col0 {\n",
+ " \n",
+ " background-color: #86a8d3;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col1 {\n",
+ " \n",
+ " background-color: #5b89c3;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col2 {\n",
+ " \n",
+ " background-color: #f2bfca;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col3 {\n",
+ " \n",
+ " background-color: #f2bfca;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col4 {\n",
+ " \n",
+ " background-color: #497dbd;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col5 {\n",
+ " \n",
+ " background-color: #f2bfca;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col6 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col7 {\n",
+ " \n",
+ " background-color: #5686c1;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col8 {\n",
+ " \n",
+ " background-color: #eda8b6;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col9 {\n",
+ " \n",
+ " background-color: #d9e4f1;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col10 {\n",
+ " \n",
+ " background-color: #d5e1f0;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col11 {\n",
+ " \n",
+ " background-color: #bfd1e8;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col12 {\n",
+ " \n",
+ " background-color: #5787c2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col13 {\n",
+ " \n",
+ " background-color: #fbeaed;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col14 {\n",
+ " \n",
+ " background-color: #f8dee3;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col15 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col16 {\n",
+ " \n",
+ " background-color: #eeaab7;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col17 {\n",
+ " \n",
+ " background-color: #f6d1d8;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col18 {\n",
+ " \n",
+ " background-color: #f7d7de;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col19 {\n",
+ " \n",
+ " background-color: #f2f2f2;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col20 {\n",
+ " \n",
+ " background-color: #b5cae4;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col21 {\n",
+ " \n",
+ " background-color: #d73c5b;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col22 {\n",
+ " \n",
+ " background-color: #9eb9db;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col23 {\n",
+ " \n",
+ " background-color: #4479bb;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " #T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col24 {\n",
+ " \n",
+ " background-color: #89aad4;\n",
+ " \n",
+ " max-width: 80px;\n",
+ " \n",
+ " font-size: 1pt;\n",
+ " \n",
+ " }\n",
+ " \n",
+ " </style>\n",
+ "\n",
+ " <table id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb\">\n",
+ " \n",
+ " <caption>Hover to magify</caption>\n",
+ " \n",
+ "\n",
+ " <thead>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th class=\"blank\">\n",
+ " \n",
+ " <th class=\"col_heading level0 col0\">0\n",
+ " \n",
+ " <th class=\"col_heading level0 col1\">1\n",
+ " \n",
+ " <th class=\"col_heading level0 col2\">2\n",
+ " \n",
+ " <th class=\"col_heading level0 col3\">3\n",
+ " \n",
+ " <th class=\"col_heading level0 col4\">4\n",
+ " \n",
+ " <th class=\"col_heading level0 col5\">5\n",
+ " \n",
+ " <th class=\"col_heading level0 col6\">6\n",
+ " \n",
+ " <th class=\"col_heading level0 col7\">7\n",
+ " \n",
+ " <th class=\"col_heading level0 col8\">8\n",
+ " \n",
+ " <th class=\"col_heading level0 col9\">9\n",
+ " \n",
+ " <th class=\"col_heading level0 col10\">10\n",
+ " \n",
+ " <th class=\"col_heading level0 col11\">11\n",
+ " \n",
+ " <th class=\"col_heading level0 col12\">12\n",
+ " \n",
+ " <th class=\"col_heading level0 col13\">13\n",
+ " \n",
+ " <th class=\"col_heading level0 col14\">14\n",
+ " \n",
+ " <th class=\"col_heading level0 col15\">15\n",
+ " \n",
+ " <th class=\"col_heading level0 col16\">16\n",
+ " \n",
+ " <th class=\"col_heading level0 col17\">17\n",
+ " \n",
+ " <th class=\"col_heading level0 col18\">18\n",
+ " \n",
+ " <th class=\"col_heading level0 col19\">19\n",
+ " \n",
+ " <th class=\"col_heading level0 col20\">20\n",
+ " \n",
+ " <th class=\"col_heading level0 col21\">21\n",
+ " \n",
+ " <th class=\"col_heading level0 col22\">22\n",
+ " \n",
+ " <th class=\"col_heading level0 col23\">23\n",
+ " \n",
+ " <th class=\"col_heading level0 col24\">24\n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </thead>\n",
+ " <tbody>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb\" class=\"row_heading level24 row0\">\n",
+ " \n",
+ " 0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col0\" class=\"data row0 col0\">\n",
+ " \n",
+ " 0.23\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col1\" class=\"data row0 col1\">\n",
+ " \n",
+ " 1.03\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col2\" class=\"data row0 col2\">\n",
+ " \n",
+ " -0.84\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col3\" class=\"data row0 col3\">\n",
+ " \n",
+ " -0.59\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col4\" class=\"data row0 col4\">\n",
+ " \n",
+ " -0.96\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col5\" class=\"data row0 col5\">\n",
+ " \n",
+ " -0.22\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col6\" class=\"data row0 col6\">\n",
+ " \n",
+ " -0.62\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col7\" class=\"data row0 col7\">\n",
+ " \n",
+ " 1.84\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col8\" class=\"data row0 col8\">\n",
+ " \n",
+ " -2.05\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col9\" class=\"data row0 col9\">\n",
+ " \n",
+ " 0.87\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col10\" class=\"data row0 col10\">\n",
+ " \n",
+ " -0.92\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col11\" class=\"data row0 col11\">\n",
+ " \n",
+ " -0.23\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col12\" class=\"data row0 col12\">\n",
+ " \n",
+ " 2.15\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col13\" class=\"data row0 col13\">\n",
+ " \n",
+ " -1.33\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col14\" class=\"data row0 col14\">\n",
+ " \n",
+ " 0.08\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col15\" class=\"data row0 col15\">\n",
+ " \n",
+ " -1.25\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col16\" class=\"data row0 col16\">\n",
+ " \n",
+ " 1.2\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col17\" class=\"data row0 col17\">\n",
+ " \n",
+ " -1.05\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col18\" class=\"data row0 col18\">\n",
+ " \n",
+ " 1.06\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col19\" class=\"data row0 col19\">\n",
+ " \n",
+ " -0.42\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col20\" class=\"data row0 col20\">\n",
+ " \n",
+ " 2.29\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col21\" class=\"data row0 col21\">\n",
+ " \n",
+ " -2.59\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col22\" class=\"data row0 col22\">\n",
+ " \n",
+ " 2.82\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col23\" class=\"data row0 col23\">\n",
+ " \n",
+ " 0.68\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow0_col24\" class=\"data row0 col24\">\n",
+ " \n",
+ " -1.58\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb\" class=\"row_heading level24 row1\">\n",
+ " \n",
+ " 1\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col0\" class=\"data row1 col0\">\n",
+ " \n",
+ " -1.75\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col1\" class=\"data row1 col1\">\n",
+ " \n",
+ " 1.56\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col2\" class=\"data row1 col2\">\n",
+ " \n",
+ " -1.13\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col3\" class=\"data row1 col3\">\n",
+ " \n",
+ " -1.1\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col4\" class=\"data row1 col4\">\n",
+ " \n",
+ " 1.03\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col5\" class=\"data row1 col5\">\n",
+ " \n",
+ " 0.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col6\" class=\"data row1 col6\">\n",
+ " \n",
+ " -2.46\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col7\" class=\"data row1 col7\">\n",
+ " \n",
+ " 3.45\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col8\" class=\"data row1 col8\">\n",
+ " \n",
+ " -1.66\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col9\" class=\"data row1 col9\">\n",
+ " \n",
+ " 1.27\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col10\" class=\"data row1 col10\">\n",
+ " \n",
+ " -0.52\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col11\" class=\"data row1 col11\">\n",
+ " \n",
+ " -0.02\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col12\" class=\"data row1 col12\">\n",
+ " \n",
+ " 1.52\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col13\" class=\"data row1 col13\">\n",
+ " \n",
+ " -1.09\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col14\" class=\"data row1 col14\">\n",
+ " \n",
+ " -1.86\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col15\" class=\"data row1 col15\">\n",
+ " \n",
+ " -1.13\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col16\" class=\"data row1 col16\">\n",
+ " \n",
+ " -0.68\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col17\" class=\"data row1 col17\">\n",
+ " \n",
+ " -0.81\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col18\" class=\"data row1 col18\">\n",
+ " \n",
+ " 0.35\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col19\" class=\"data row1 col19\">\n",
+ " \n",
+ " -0.06\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col20\" class=\"data row1 col20\">\n",
+ " \n",
+ " 1.79\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col21\" class=\"data row1 col21\">\n",
+ " \n",
+ " -2.82\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col22\" class=\"data row1 col22\">\n",
+ " \n",
+ " 2.26\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col23\" class=\"data row1 col23\">\n",
+ " \n",
+ " 0.78\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow1_col24\" class=\"data row1 col24\">\n",
+ " \n",
+ " 0.44\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb\" class=\"row_heading level24 row2\">\n",
+ " \n",
+ " 2\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col0\" class=\"data row2 col0\">\n",
+ " \n",
+ " -0.65\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col1\" class=\"data row2 col1\">\n",
+ " \n",
+ " 3.22\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col2\" class=\"data row2 col2\">\n",
+ " \n",
+ " -1.76\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col3\" class=\"data row2 col3\">\n",
+ " \n",
+ " 0.52\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col4\" class=\"data row2 col4\">\n",
+ " \n",
+ " 2.2\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col5\" class=\"data row2 col5\">\n",
+ " \n",
+ " -0.37\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col6\" class=\"data row2 col6\">\n",
+ " \n",
+ " -3.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col7\" class=\"data row2 col7\">\n",
+ " \n",
+ " 3.73\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col8\" class=\"data row2 col8\">\n",
+ " \n",
+ " -1.87\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col9\" class=\"data row2 col9\">\n",
+ " \n",
+ " 2.46\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col10\" class=\"data row2 col10\">\n",
+ " \n",
+ " 0.21\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col11\" class=\"data row2 col11\">\n",
+ " \n",
+ " -0.24\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col12\" class=\"data row2 col12\">\n",
+ " \n",
+ " -0.1\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col13\" class=\"data row2 col13\">\n",
+ " \n",
+ " -0.78\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col14\" class=\"data row2 col14\">\n",
+ " \n",
+ " -3.02\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col15\" class=\"data row2 col15\">\n",
+ " \n",
+ " -0.82\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col16\" class=\"data row2 col16\">\n",
+ " \n",
+ " -0.21\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col17\" class=\"data row2 col17\">\n",
+ " \n",
+ " -0.23\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col18\" class=\"data row2 col18\">\n",
+ " \n",
+ " 0.86\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col19\" class=\"data row2 col19\">\n",
+ " \n",
+ " -0.68\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col20\" class=\"data row2 col20\">\n",
+ " \n",
+ " 1.45\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col21\" class=\"data row2 col21\">\n",
+ " \n",
+ " -4.89\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col22\" class=\"data row2 col22\">\n",
+ " \n",
+ " 3.03\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col23\" class=\"data row2 col23\">\n",
+ " \n",
+ " 1.91\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow2_col24\" class=\"data row2 col24\">\n",
+ " \n",
+ " 0.61\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb\" class=\"row_heading level24 row3\">\n",
+ " \n",
+ " 3\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col0\" class=\"data row3 col0\">\n",
+ " \n",
+ " -1.62\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col1\" class=\"data row3 col1\">\n",
+ " \n",
+ " 3.71\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col2\" class=\"data row3 col2\">\n",
+ " \n",
+ " -2.31\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col3\" class=\"data row3 col3\">\n",
+ " \n",
+ " 0.43\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col4\" class=\"data row3 col4\">\n",
+ " \n",
+ " 4.17\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col5\" class=\"data row3 col5\">\n",
+ " \n",
+ " -0.43\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col6\" class=\"data row3 col6\">\n",
+ " \n",
+ " -3.86\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col7\" class=\"data row3 col7\">\n",
+ " \n",
+ " 4.16\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col8\" class=\"data row3 col8\">\n",
+ " \n",
+ " -2.15\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col9\" class=\"data row3 col9\">\n",
+ " \n",
+ " 1.08\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col10\" class=\"data row3 col10\">\n",
+ " \n",
+ " 0.12\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col11\" class=\"data row3 col11\">\n",
+ " \n",
+ " 0.6\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col12\" class=\"data row3 col12\">\n",
+ " \n",
+ " -0.89\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col13\" class=\"data row3 col13\">\n",
+ " \n",
+ " 0.27\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col14\" class=\"data row3 col14\">\n",
+ " \n",
+ " -3.67\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col15\" class=\"data row3 col15\">\n",
+ " \n",
+ " -2.71\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col16\" class=\"data row3 col16\">\n",
+ " \n",
+ " -0.31\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col17\" class=\"data row3 col17\">\n",
+ " \n",
+ " -1.59\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col18\" class=\"data row3 col18\">\n",
+ " \n",
+ " 1.35\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col19\" class=\"data row3 col19\">\n",
+ " \n",
+ " -1.83\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col20\" class=\"data row3 col20\">\n",
+ " \n",
+ " 0.91\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col21\" class=\"data row3 col21\">\n",
+ " \n",
+ " -5.8\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col22\" class=\"data row3 col22\">\n",
+ " \n",
+ " 2.81\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col23\" class=\"data row3 col23\">\n",
+ " \n",
+ " 2.11\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow3_col24\" class=\"data row3 col24\">\n",
+ " \n",
+ " 0.28\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb\" class=\"row_heading level24 row4\">\n",
+ " \n",
+ " 4\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col0\" class=\"data row4 col0\">\n",
+ " \n",
+ " -3.35\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col1\" class=\"data row4 col1\">\n",
+ " \n",
+ " 4.48\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col2\" class=\"data row4 col2\">\n",
+ " \n",
+ " -1.86\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col3\" class=\"data row4 col3\">\n",
+ " \n",
+ " -1.7\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col4\" class=\"data row4 col4\">\n",
+ " \n",
+ " 5.19\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col5\" class=\"data row4 col5\">\n",
+ " \n",
+ " -1.02\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col6\" class=\"data row4 col6\">\n",
+ " \n",
+ " -3.81\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col7\" class=\"data row4 col7\">\n",
+ " \n",
+ " 4.72\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col8\" class=\"data row4 col8\">\n",
+ " \n",
+ " -0.72\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col9\" class=\"data row4 col9\">\n",
+ " \n",
+ " 1.08\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col10\" class=\"data row4 col10\">\n",
+ " \n",
+ " -0.18\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col11\" class=\"data row4 col11\">\n",
+ " \n",
+ " 0.83\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col12\" class=\"data row4 col12\">\n",
+ " \n",
+ " -0.22\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col13\" class=\"data row4 col13\">\n",
+ " \n",
+ " -1.08\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col14\" class=\"data row4 col14\">\n",
+ " \n",
+ " -4.27\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col15\" class=\"data row4 col15\">\n",
+ " \n",
+ " -2.88\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col16\" class=\"data row4 col16\">\n",
+ " \n",
+ " -0.97\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col17\" class=\"data row4 col17\">\n",
+ " \n",
+ " -1.78\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col18\" class=\"data row4 col18\">\n",
+ " \n",
+ " 1.53\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col19\" class=\"data row4 col19\">\n",
+ " \n",
+ " -1.8\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col20\" class=\"data row4 col20\">\n",
+ " \n",
+ " 2.21\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col21\" class=\"data row4 col21\">\n",
+ " \n",
+ " -6.34\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col22\" class=\"data row4 col22\">\n",
+ " \n",
+ " 3.34\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col23\" class=\"data row4 col23\">\n",
+ " \n",
+ " 2.49\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow4_col24\" class=\"data row4 col24\">\n",
+ " \n",
+ " 2.09\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb\" class=\"row_heading level24 row5\">\n",
+ " \n",
+ " 5\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col0\" class=\"data row5 col0\">\n",
+ " \n",
+ " -0.84\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col1\" class=\"data row5 col1\">\n",
+ " \n",
+ " 4.23\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col2\" class=\"data row5 col2\">\n",
+ " \n",
+ " -1.65\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col3\" class=\"data row5 col3\">\n",
+ " \n",
+ " -2.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col4\" class=\"data row5 col4\">\n",
+ " \n",
+ " 5.34\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col5\" class=\"data row5 col5\">\n",
+ " \n",
+ " -0.99\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col6\" class=\"data row5 col6\">\n",
+ " \n",
+ " -4.13\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col7\" class=\"data row5 col7\">\n",
+ " \n",
+ " 3.94\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col8\" class=\"data row5 col8\">\n",
+ " \n",
+ " -1.06\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col9\" class=\"data row5 col9\">\n",
+ " \n",
+ " -0.94\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col10\" class=\"data row5 col10\">\n",
+ " \n",
+ " 1.24\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col11\" class=\"data row5 col11\">\n",
+ " \n",
+ " 0.09\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col12\" class=\"data row5 col12\">\n",
+ " \n",
+ " -1.78\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col13\" class=\"data row5 col13\">\n",
+ " \n",
+ " -0.11\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col14\" class=\"data row5 col14\">\n",
+ " \n",
+ " -4.45\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col15\" class=\"data row5 col15\">\n",
+ " \n",
+ " -0.85\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col16\" class=\"data row5 col16\">\n",
+ " \n",
+ " -2.06\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col17\" class=\"data row5 col17\">\n",
+ " \n",
+ " -1.35\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col18\" class=\"data row5 col18\">\n",
+ " \n",
+ " 0.8\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col19\" class=\"data row5 col19\">\n",
+ " \n",
+ " -1.63\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col20\" class=\"data row5 col20\">\n",
+ " \n",
+ " 1.54\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col21\" class=\"data row5 col21\">\n",
+ " \n",
+ " -6.51\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col22\" class=\"data row5 col22\">\n",
+ " \n",
+ " 2.8\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col23\" class=\"data row5 col23\">\n",
+ " \n",
+ " 2.14\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow5_col24\" class=\"data row5 col24\">\n",
+ " \n",
+ " 3.77\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb\" class=\"row_heading level24 row6\">\n",
+ " \n",
+ " 6\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col0\" class=\"data row6 col0\">\n",
+ " \n",
+ " -0.74\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col1\" class=\"data row6 col1\">\n",
+ " \n",
+ " 5.35\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col2\" class=\"data row6 col2\">\n",
+ " \n",
+ " -2.11\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col3\" class=\"data row6 col3\">\n",
+ " \n",
+ " -1.13\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col4\" class=\"data row6 col4\">\n",
+ " \n",
+ " 4.2\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col5\" class=\"data row6 col5\">\n",
+ " \n",
+ " -1.85\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col6\" class=\"data row6 col6\">\n",
+ " \n",
+ " -3.2\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col7\" class=\"data row6 col7\">\n",
+ " \n",
+ " 3.76\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col8\" class=\"data row6 col8\">\n",
+ " \n",
+ " -3.22\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col9\" class=\"data row6 col9\">\n",
+ " \n",
+ " -1.23\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col10\" class=\"data row6 col10\">\n",
+ " \n",
+ " 0.34\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col11\" class=\"data row6 col11\">\n",
+ " \n",
+ " 0.57\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col12\" class=\"data row6 col12\">\n",
+ " \n",
+ " -1.82\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col13\" class=\"data row6 col13\">\n",
+ " \n",
+ " 0.54\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col14\" class=\"data row6 col14\">\n",
+ " \n",
+ " -4.43\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col15\" class=\"data row6 col15\">\n",
+ " \n",
+ " -1.83\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col16\" class=\"data row6 col16\">\n",
+ " \n",
+ " -4.03\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col17\" class=\"data row6 col17\">\n",
+ " \n",
+ " -2.62\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col18\" class=\"data row6 col18\">\n",
+ " \n",
+ " -0.2\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col19\" class=\"data row6 col19\">\n",
+ " \n",
+ " -4.68\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col20\" class=\"data row6 col20\">\n",
+ " \n",
+ " 1.93\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col21\" class=\"data row6 col21\">\n",
+ " \n",
+ " -8.46\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col22\" class=\"data row6 col22\">\n",
+ " \n",
+ " 3.34\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col23\" class=\"data row6 col23\">\n",
+ " \n",
+ " 2.52\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow6_col24\" class=\"data row6 col24\">\n",
+ " \n",
+ " 5.81\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb\" class=\"row_heading level24 row7\">\n",
+ " \n",
+ " 7\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col0\" class=\"data row7 col0\">\n",
+ " \n",
+ " -0.44\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col1\" class=\"data row7 col1\">\n",
+ " \n",
+ " 4.69\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col2\" class=\"data row7 col2\">\n",
+ " \n",
+ " -2.3\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col3\" class=\"data row7 col3\">\n",
+ " \n",
+ " -0.21\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col4\" class=\"data row7 col4\">\n",
+ " \n",
+ " 5.93\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col5\" class=\"data row7 col5\">\n",
+ " \n",
+ " -2.63\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col6\" class=\"data row7 col6\">\n",
+ " \n",
+ " -1.83\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col7\" class=\"data row7 col7\">\n",
+ " \n",
+ " 5.46\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col8\" class=\"data row7 col8\">\n",
+ " \n",
+ " -4.5\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col9\" class=\"data row7 col9\">\n",
+ " \n",
+ " -3.16\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col10\" class=\"data row7 col10\">\n",
+ " \n",
+ " -1.73\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col11\" class=\"data row7 col11\">\n",
+ " \n",
+ " 0.18\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col12\" class=\"data row7 col12\">\n",
+ " \n",
+ " 0.11\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col13\" class=\"data row7 col13\">\n",
+ " \n",
+ " 0.04\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col14\" class=\"data row7 col14\">\n",
+ " \n",
+ " -5.99\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col15\" class=\"data row7 col15\">\n",
+ " \n",
+ " -0.45\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col16\" class=\"data row7 col16\">\n",
+ " \n",
+ " -6.2\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col17\" class=\"data row7 col17\">\n",
+ " \n",
+ " -3.89\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col18\" class=\"data row7 col18\">\n",
+ " \n",
+ " 0.71\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col19\" class=\"data row7 col19\">\n",
+ " \n",
+ " -3.95\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col20\" class=\"data row7 col20\">\n",
+ " \n",
+ " 0.67\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col21\" class=\"data row7 col21\">\n",
+ " \n",
+ " -7.26\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col22\" class=\"data row7 col22\">\n",
+ " \n",
+ " 2.97\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col23\" class=\"data row7 col23\">\n",
+ " \n",
+ " 3.39\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow7_col24\" class=\"data row7 col24\">\n",
+ " \n",
+ " 6.66\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb\" class=\"row_heading level24 row8\">\n",
+ " \n",
+ " 8\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col0\" class=\"data row8 col0\">\n",
+ " \n",
+ " 0.92\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col1\" class=\"data row8 col1\">\n",
+ " \n",
+ " 5.8\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col2\" class=\"data row8 col2\">\n",
+ " \n",
+ " -3.33\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col3\" class=\"data row8 col3\">\n",
+ " \n",
+ " -0.65\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col4\" class=\"data row8 col4\">\n",
+ " \n",
+ " 5.99\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col5\" class=\"data row8 col5\">\n",
+ " \n",
+ " -3.19\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col6\" class=\"data row8 col6\">\n",
+ " \n",
+ " -1.83\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col7\" class=\"data row8 col7\">\n",
+ " \n",
+ " 5.63\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col8\" class=\"data row8 col8\">\n",
+ " \n",
+ " -3.53\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col9\" class=\"data row8 col9\">\n",
+ " \n",
+ " -1.3\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col10\" class=\"data row8 col10\">\n",
+ " \n",
+ " -1.61\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col11\" class=\"data row8 col11\">\n",
+ " \n",
+ " 0.82\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col12\" class=\"data row8 col12\">\n",
+ " \n",
+ " -2.45\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col13\" class=\"data row8 col13\">\n",
+ " \n",
+ " -0.4\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col14\" class=\"data row8 col14\">\n",
+ " \n",
+ " -6.06\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col15\" class=\"data row8 col15\">\n",
+ " \n",
+ " -0.52\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col16\" class=\"data row8 col16\">\n",
+ " \n",
+ " -6.6\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col17\" class=\"data row8 col17\">\n",
+ " \n",
+ " -3.48\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col18\" class=\"data row8 col18\">\n",
+ " \n",
+ " -0.04\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col19\" class=\"data row8 col19\">\n",
+ " \n",
+ " -4.6\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col20\" class=\"data row8 col20\">\n",
+ " \n",
+ " 0.51\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col21\" class=\"data row8 col21\">\n",
+ " \n",
+ " -5.85\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col22\" class=\"data row8 col22\">\n",
+ " \n",
+ " 3.23\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col23\" class=\"data row8 col23\">\n",
+ " \n",
+ " 2.4\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow8_col24\" class=\"data row8 col24\">\n",
+ " \n",
+ " 5.08\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb\" class=\"row_heading level24 row9\">\n",
+ " \n",
+ " 9\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col0\" class=\"data row9 col0\">\n",
+ " \n",
+ " 0.38\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col1\" class=\"data row9 col1\">\n",
+ " \n",
+ " 5.54\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col2\" class=\"data row9 col2\">\n",
+ " \n",
+ " -4.49\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col3\" class=\"data row9 col3\">\n",
+ " \n",
+ " -0.8\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col4\" class=\"data row9 col4\">\n",
+ " \n",
+ " 7.05\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col5\" class=\"data row9 col5\">\n",
+ " \n",
+ " -2.64\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col6\" class=\"data row9 col6\">\n",
+ " \n",
+ " -0.44\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col7\" class=\"data row9 col7\">\n",
+ " \n",
+ " 5.35\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col8\" class=\"data row9 col8\">\n",
+ " \n",
+ " -1.96\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col9\" class=\"data row9 col9\">\n",
+ " \n",
+ " -0.33\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col10\" class=\"data row9 col10\">\n",
+ " \n",
+ " -0.8\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col11\" class=\"data row9 col11\">\n",
+ " \n",
+ " 0.26\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col12\" class=\"data row9 col12\">\n",
+ " \n",
+ " -3.37\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col13\" class=\"data row9 col13\">\n",
+ " \n",
+ " -0.82\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col14\" class=\"data row9 col14\">\n",
+ " \n",
+ " -6.05\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col15\" class=\"data row9 col15\">\n",
+ " \n",
+ " -2.61\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col16\" class=\"data row9 col16\">\n",
+ " \n",
+ " -8.45\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col17\" class=\"data row9 col17\">\n",
+ " \n",
+ " -4.45\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col18\" class=\"data row9 col18\">\n",
+ " \n",
+ " 0.41\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col19\" class=\"data row9 col19\">\n",
+ " \n",
+ " -4.71\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col20\" class=\"data row9 col20\">\n",
+ " \n",
+ " 1.89\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col21\" class=\"data row9 col21\">\n",
+ " \n",
+ " -6.93\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col22\" class=\"data row9 col22\">\n",
+ " \n",
+ " 2.14\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col23\" class=\"data row9 col23\">\n",
+ " \n",
+ " 3.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow9_col24\" class=\"data row9 col24\">\n",
+ " \n",
+ " 5.16\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb\" class=\"row_heading level24 row10\">\n",
+ " \n",
+ " 10\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col0\" class=\"data row10 col0\">\n",
+ " \n",
+ " 2.06\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col1\" class=\"data row10 col1\">\n",
+ " \n",
+ " 5.84\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col2\" class=\"data row10 col2\">\n",
+ " \n",
+ " -3.9\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col3\" class=\"data row10 col3\">\n",
+ " \n",
+ " -0.98\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col4\" class=\"data row10 col4\">\n",
+ " \n",
+ " 7.78\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col5\" class=\"data row10 col5\">\n",
+ " \n",
+ " -2.49\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col6\" class=\"data row10 col6\">\n",
+ " \n",
+ " -0.59\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col7\" class=\"data row10 col7\">\n",
+ " \n",
+ " 5.59\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col8\" class=\"data row10 col8\">\n",
+ " \n",
+ " -2.22\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col9\" class=\"data row10 col9\">\n",
+ " \n",
+ " -0.71\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col10\" class=\"data row10 col10\">\n",
+ " \n",
+ " -0.46\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col11\" class=\"data row10 col11\">\n",
+ " \n",
+ " 1.8\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col12\" class=\"data row10 col12\">\n",
+ " \n",
+ " -2.79\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col13\" class=\"data row10 col13\">\n",
+ " \n",
+ " 0.48\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col14\" class=\"data row10 col14\">\n",
+ " \n",
+ " -5.97\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col15\" class=\"data row10 col15\">\n",
+ " \n",
+ " -3.44\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col16\" class=\"data row10 col16\">\n",
+ " \n",
+ " -7.77\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col17\" class=\"data row10 col17\">\n",
+ " \n",
+ " -5.49\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col18\" class=\"data row10 col18\">\n",
+ " \n",
+ " -0.7\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col19\" class=\"data row10 col19\">\n",
+ " \n",
+ " -4.61\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col20\" class=\"data row10 col20\">\n",
+ " \n",
+ " -0.52\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col21\" class=\"data row10 col21\">\n",
+ " \n",
+ " -7.72\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col22\" class=\"data row10 col22\">\n",
+ " \n",
+ " 1.54\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col23\" class=\"data row10 col23\">\n",
+ " \n",
+ " 5.02\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow10_col24\" class=\"data row10 col24\">\n",
+ " \n",
+ " 5.81\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb\" class=\"row_heading level24 row11\">\n",
+ " \n",
+ " 11\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col0\" class=\"data row11 col0\">\n",
+ " \n",
+ " 1.86\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col1\" class=\"data row11 col1\">\n",
+ " \n",
+ " 4.47\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col2\" class=\"data row11 col2\">\n",
+ " \n",
+ " -2.17\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col3\" class=\"data row11 col3\">\n",
+ " \n",
+ " -1.38\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col4\" class=\"data row11 col4\">\n",
+ " \n",
+ " 5.9\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col5\" class=\"data row11 col5\">\n",
+ " \n",
+ " -0.49\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col6\" class=\"data row11 col6\">\n",
+ " \n",
+ " 0.02\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col7\" class=\"data row11 col7\">\n",
+ " \n",
+ " 5.78\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col8\" class=\"data row11 col8\">\n",
+ " \n",
+ " -1.04\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col9\" class=\"data row11 col9\">\n",
+ " \n",
+ " -0.6\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col10\" class=\"data row11 col10\">\n",
+ " \n",
+ " 0.49\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col11\" class=\"data row11 col11\">\n",
+ " \n",
+ " 1.96\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col12\" class=\"data row11 col12\">\n",
+ " \n",
+ " -1.47\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col13\" class=\"data row11 col13\">\n",
+ " \n",
+ " 1.88\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col14\" class=\"data row11 col14\">\n",
+ " \n",
+ " -5.92\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col15\" class=\"data row11 col15\">\n",
+ " \n",
+ " -4.55\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col16\" class=\"data row11 col16\">\n",
+ " \n",
+ " -8.15\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col17\" class=\"data row11 col17\">\n",
+ " \n",
+ " -3.42\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col18\" class=\"data row11 col18\">\n",
+ " \n",
+ " -2.24\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col19\" class=\"data row11 col19\">\n",
+ " \n",
+ " -4.33\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col20\" class=\"data row11 col20\">\n",
+ " \n",
+ " -1.17\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col21\" class=\"data row11 col21\">\n",
+ " \n",
+ " -7.9\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col22\" class=\"data row11 col22\">\n",
+ " \n",
+ " 1.36\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col23\" class=\"data row11 col23\">\n",
+ " \n",
+ " 5.31\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow11_col24\" class=\"data row11 col24\">\n",
+ " \n",
+ " 5.83\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb\" class=\"row_heading level24 row12\">\n",
+ " \n",
+ " 12\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col0\" class=\"data row12 col0\">\n",
+ " \n",
+ " 3.19\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col1\" class=\"data row12 col1\">\n",
+ " \n",
+ " 4.22\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col2\" class=\"data row12 col2\">\n",
+ " \n",
+ " -3.06\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col3\" class=\"data row12 col3\">\n",
+ " \n",
+ " -2.27\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col4\" class=\"data row12 col4\">\n",
+ " \n",
+ " 5.93\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col5\" class=\"data row12 col5\">\n",
+ " \n",
+ " -2.64\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col6\" class=\"data row12 col6\">\n",
+ " \n",
+ " 0.33\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col7\" class=\"data row12 col7\">\n",
+ " \n",
+ " 6.72\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col8\" class=\"data row12 col8\">\n",
+ " \n",
+ " -2.84\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col9\" class=\"data row12 col9\">\n",
+ " \n",
+ " -0.2\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col10\" class=\"data row12 col10\">\n",
+ " \n",
+ " 1.89\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col11\" class=\"data row12 col11\">\n",
+ " \n",
+ " 2.63\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col12\" class=\"data row12 col12\">\n",
+ " \n",
+ " -1.53\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col13\" class=\"data row12 col13\">\n",
+ " \n",
+ " 0.75\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col14\" class=\"data row12 col14\">\n",
+ " \n",
+ " -5.27\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col15\" class=\"data row12 col15\">\n",
+ " \n",
+ " -4.53\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col16\" class=\"data row12 col16\">\n",
+ " \n",
+ " -7.57\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col17\" class=\"data row12 col17\">\n",
+ " \n",
+ " -2.85\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col18\" class=\"data row12 col18\">\n",
+ " \n",
+ " -2.17\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col19\" class=\"data row12 col19\">\n",
+ " \n",
+ " -4.78\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col20\" class=\"data row12 col20\">\n",
+ " \n",
+ " -1.13\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col21\" class=\"data row12 col21\">\n",
+ " \n",
+ " -8.99\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col22\" class=\"data row12 col22\">\n",
+ " \n",
+ " 2.11\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col23\" class=\"data row12 col23\">\n",
+ " \n",
+ " 6.42\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow12_col24\" class=\"data row12 col24\">\n",
+ " \n",
+ " 5.6\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb\" class=\"row_heading level24 row13\">\n",
+ " \n",
+ " 13\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col0\" class=\"data row13 col0\">\n",
+ " \n",
+ " 2.31\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col1\" class=\"data row13 col1\">\n",
+ " \n",
+ " 4.45\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col2\" class=\"data row13 col2\">\n",
+ " \n",
+ " -3.87\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col3\" class=\"data row13 col3\">\n",
+ " \n",
+ " -2.05\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col4\" class=\"data row13 col4\">\n",
+ " \n",
+ " 6.76\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col5\" class=\"data row13 col5\">\n",
+ " \n",
+ " -3.25\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col6\" class=\"data row13 col6\">\n",
+ " \n",
+ " -2.17\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col7\" class=\"data row13 col7\">\n",
+ " \n",
+ " 7.99\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col8\" class=\"data row13 col8\">\n",
+ " \n",
+ " -2.56\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col9\" class=\"data row13 col9\">\n",
+ " \n",
+ " -0.8\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col10\" class=\"data row13 col10\">\n",
+ " \n",
+ " 0.71\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col11\" class=\"data row13 col11\">\n",
+ " \n",
+ " 2.33\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col12\" class=\"data row13 col12\">\n",
+ " \n",
+ " -0.16\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col13\" class=\"data row13 col13\">\n",
+ " \n",
+ " -0.46\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col14\" class=\"data row13 col14\">\n",
+ " \n",
+ " -5.1\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col15\" class=\"data row13 col15\">\n",
+ " \n",
+ " -3.79\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col16\" class=\"data row13 col16\">\n",
+ " \n",
+ " -7.58\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col17\" class=\"data row13 col17\">\n",
+ " \n",
+ " -4.0\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col18\" class=\"data row13 col18\">\n",
+ " \n",
+ " 0.33\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col19\" class=\"data row13 col19\">\n",
+ " \n",
+ " -3.67\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col20\" class=\"data row13 col20\">\n",
+ " \n",
+ " -1.05\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col21\" class=\"data row13 col21\">\n",
+ " \n",
+ " -8.71\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col22\" class=\"data row13 col22\">\n",
+ " \n",
+ " 2.47\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col23\" class=\"data row13 col23\">\n",
+ " \n",
+ " 5.87\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow13_col24\" class=\"data row13 col24\">\n",
+ " \n",
+ " 6.71\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb\" class=\"row_heading level24 row14\">\n",
+ " \n",
+ " 14\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col0\" class=\"data row14 col0\">\n",
+ " \n",
+ " 3.78\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col1\" class=\"data row14 col1\">\n",
+ " \n",
+ " 4.33\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col2\" class=\"data row14 col2\">\n",
+ " \n",
+ " -3.88\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col3\" class=\"data row14 col3\">\n",
+ " \n",
+ " -1.58\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col4\" class=\"data row14 col4\">\n",
+ " \n",
+ " 6.22\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col5\" class=\"data row14 col5\">\n",
+ " \n",
+ " -3.23\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col6\" class=\"data row14 col6\">\n",
+ " \n",
+ " -1.46\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col7\" class=\"data row14 col7\">\n",
+ " \n",
+ " 5.57\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col8\" class=\"data row14 col8\">\n",
+ " \n",
+ " -2.93\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col9\" class=\"data row14 col9\">\n",
+ " \n",
+ " -0.33\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col10\" class=\"data row14 col10\">\n",
+ " \n",
+ " -0.97\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col11\" class=\"data row14 col11\">\n",
+ " \n",
+ " 1.72\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col12\" class=\"data row14 col12\">\n",
+ " \n",
+ " 3.61\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col13\" class=\"data row14 col13\">\n",
+ " \n",
+ " 0.29\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col14\" class=\"data row14 col14\">\n",
+ " \n",
+ " -4.21\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col15\" class=\"data row14 col15\">\n",
+ " \n",
+ " -4.1\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col16\" class=\"data row14 col16\">\n",
+ " \n",
+ " -6.68\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col17\" class=\"data row14 col17\">\n",
+ " \n",
+ " -4.5\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col18\" class=\"data row14 col18\">\n",
+ " \n",
+ " -2.19\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col19\" class=\"data row14 col19\">\n",
+ " \n",
+ " -2.43\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col20\" class=\"data row14 col20\">\n",
+ " \n",
+ " -1.64\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col21\" class=\"data row14 col21\">\n",
+ " \n",
+ " -9.36\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col22\" class=\"data row14 col22\">\n",
+ " \n",
+ " 3.36\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col23\" class=\"data row14 col23\">\n",
+ " \n",
+ " 6.11\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow14_col24\" class=\"data row14 col24\">\n",
+ " \n",
+ " 7.53\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb\" class=\"row_heading level24 row15\">\n",
+ " \n",
+ " 15\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col0\" class=\"data row15 col0\">\n",
+ " \n",
+ " 5.64\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col1\" class=\"data row15 col1\">\n",
+ " \n",
+ " 5.31\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col2\" class=\"data row15 col2\">\n",
+ " \n",
+ " -3.98\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col3\" class=\"data row15 col3\">\n",
+ " \n",
+ " -2.26\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col4\" class=\"data row15 col4\">\n",
+ " \n",
+ " 5.91\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col5\" class=\"data row15 col5\">\n",
+ " \n",
+ " -3.3\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col6\" class=\"data row15 col6\">\n",
+ " \n",
+ " -1.03\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col7\" class=\"data row15 col7\">\n",
+ " \n",
+ " 5.68\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col8\" class=\"data row15 col8\">\n",
+ " \n",
+ " -3.06\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col9\" class=\"data row15 col9\">\n",
+ " \n",
+ " -0.33\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col10\" class=\"data row15 col10\">\n",
+ " \n",
+ " -1.16\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col11\" class=\"data row15 col11\">\n",
+ " \n",
+ " 2.19\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col12\" class=\"data row15 col12\">\n",
+ " \n",
+ " 4.2\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col13\" class=\"data row15 col13\">\n",
+ " \n",
+ " 1.01\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col14\" class=\"data row15 col14\">\n",
+ " \n",
+ " -3.22\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col15\" class=\"data row15 col15\">\n",
+ " \n",
+ " -4.31\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col16\" class=\"data row15 col16\">\n",
+ " \n",
+ " -5.74\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col17\" class=\"data row15 col17\">\n",
+ " \n",
+ " -4.44\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col18\" class=\"data row15 col18\">\n",
+ " \n",
+ " -2.3\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col19\" class=\"data row15 col19\">\n",
+ " \n",
+ " -1.36\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col20\" class=\"data row15 col20\">\n",
+ " \n",
+ " -1.2\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col21\" class=\"data row15 col21\">\n",
+ " \n",
+ " -11.27\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col22\" class=\"data row15 col22\">\n",
+ " \n",
+ " 2.59\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col23\" class=\"data row15 col23\">\n",
+ " \n",
+ " 6.69\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow15_col24\" class=\"data row15 col24\">\n",
+ " \n",
+ " 5.91\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb\" class=\"row_heading level24 row16\">\n",
+ " \n",
+ " 16\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col0\" class=\"data row16 col0\">\n",
+ " \n",
+ " 4.08\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col1\" class=\"data row16 col1\">\n",
+ " \n",
+ " 4.34\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col2\" class=\"data row16 col2\">\n",
+ " \n",
+ " -2.44\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col3\" class=\"data row16 col3\">\n",
+ " \n",
+ " -3.3\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col4\" class=\"data row16 col4\">\n",
+ " \n",
+ " 6.04\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col5\" class=\"data row16 col5\">\n",
+ " \n",
+ " -2.52\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col6\" class=\"data row16 col6\">\n",
+ " \n",
+ " -0.47\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col7\" class=\"data row16 col7\">\n",
+ " \n",
+ " 5.28\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col8\" class=\"data row16 col8\">\n",
+ " \n",
+ " -4.84\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col9\" class=\"data row16 col9\">\n",
+ " \n",
+ " 1.58\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col10\" class=\"data row16 col10\">\n",
+ " \n",
+ " 0.23\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col11\" class=\"data row16 col11\">\n",
+ " \n",
+ " 0.1\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col12\" class=\"data row16 col12\">\n",
+ " \n",
+ " 5.79\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col13\" class=\"data row16 col13\">\n",
+ " \n",
+ " 1.8\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col14\" class=\"data row16 col14\">\n",
+ " \n",
+ " -3.13\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col15\" class=\"data row16 col15\">\n",
+ " \n",
+ " -3.85\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col16\" class=\"data row16 col16\">\n",
+ " \n",
+ " -5.53\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col17\" class=\"data row16 col17\">\n",
+ " \n",
+ " -2.97\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col18\" class=\"data row16 col18\">\n",
+ " \n",
+ " -2.13\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col19\" class=\"data row16 col19\">\n",
+ " \n",
+ " -1.15\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col20\" class=\"data row16 col20\">\n",
+ " \n",
+ " -0.56\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col21\" class=\"data row16 col21\">\n",
+ " \n",
+ " -13.13\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col22\" class=\"data row16 col22\">\n",
+ " \n",
+ " 2.07\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col23\" class=\"data row16 col23\">\n",
+ " \n",
+ " 6.16\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow16_col24\" class=\"data row16 col24\">\n",
+ " \n",
+ " 4.94\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb\" class=\"row_heading level24 row17\">\n",
+ " \n",
+ " 17\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col0\" class=\"data row17 col0\">\n",
+ " \n",
+ " 5.64\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col1\" class=\"data row17 col1\">\n",
+ " \n",
+ " 4.57\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col2\" class=\"data row17 col2\">\n",
+ " \n",
+ " -3.53\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col3\" class=\"data row17 col3\">\n",
+ " \n",
+ " -3.76\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col4\" class=\"data row17 col4\">\n",
+ " \n",
+ " 6.58\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col5\" class=\"data row17 col5\">\n",
+ " \n",
+ " -2.58\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col6\" class=\"data row17 col6\">\n",
+ " \n",
+ " -0.75\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col7\" class=\"data row17 col7\">\n",
+ " \n",
+ " 6.58\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col8\" class=\"data row17 col8\">\n",
+ " \n",
+ " -4.78\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col9\" class=\"data row17 col9\">\n",
+ " \n",
+ " 3.63\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col10\" class=\"data row17 col10\">\n",
+ " \n",
+ " -0.29\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col11\" class=\"data row17 col11\">\n",
+ " \n",
+ " 0.56\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col12\" class=\"data row17 col12\">\n",
+ " \n",
+ " 5.76\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col13\" class=\"data row17 col13\">\n",
+ " \n",
+ " 2.05\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col14\" class=\"data row17 col14\">\n",
+ " \n",
+ " -2.27\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col15\" class=\"data row17 col15\">\n",
+ " \n",
+ " -2.31\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col16\" class=\"data row17 col16\">\n",
+ " \n",
+ " -4.95\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col17\" class=\"data row17 col17\">\n",
+ " \n",
+ " -3.16\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col18\" class=\"data row17 col18\">\n",
+ " \n",
+ " -3.06\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col19\" class=\"data row17 col19\">\n",
+ " \n",
+ " -2.43\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col20\" class=\"data row17 col20\">\n",
+ " \n",
+ " 0.84\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col21\" class=\"data row17 col21\">\n",
+ " \n",
+ " -12.57\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col22\" class=\"data row17 col22\">\n",
+ " \n",
+ " 3.56\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col23\" class=\"data row17 col23\">\n",
+ " \n",
+ " 7.36\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow17_col24\" class=\"data row17 col24\">\n",
+ " \n",
+ " 4.7\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb\" class=\"row_heading level24 row18\">\n",
+ " \n",
+ " 18\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col0\" class=\"data row18 col0\">\n",
+ " \n",
+ " 5.99\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col1\" class=\"data row18 col1\">\n",
+ " \n",
+ " 5.82\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col2\" class=\"data row18 col2\">\n",
+ " \n",
+ " -2.85\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col3\" class=\"data row18 col3\">\n",
+ " \n",
+ " -4.15\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col4\" class=\"data row18 col4\">\n",
+ " \n",
+ " 7.12\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col5\" class=\"data row18 col5\">\n",
+ " \n",
+ " -3.32\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col6\" class=\"data row18 col6\">\n",
+ " \n",
+ " -1.21\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col7\" class=\"data row18 col7\">\n",
+ " \n",
+ " 7.93\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col8\" class=\"data row18 col8\">\n",
+ " \n",
+ " -4.85\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col9\" class=\"data row18 col9\">\n",
+ " \n",
+ " 1.44\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col10\" class=\"data row18 col10\">\n",
+ " \n",
+ " -0.63\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col11\" class=\"data row18 col11\">\n",
+ " \n",
+ " 0.35\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col12\" class=\"data row18 col12\">\n",
+ " \n",
+ " 7.47\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col13\" class=\"data row18 col13\">\n",
+ " \n",
+ " 0.87\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col14\" class=\"data row18 col14\">\n",
+ " \n",
+ " -1.52\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col15\" class=\"data row18 col15\">\n",
+ " \n",
+ " -2.09\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col16\" class=\"data row18 col16\">\n",
+ " \n",
+ " -4.23\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col17\" class=\"data row18 col17\">\n",
+ " \n",
+ " -2.55\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col18\" class=\"data row18 col18\">\n",
+ " \n",
+ " -2.46\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col19\" class=\"data row18 col19\">\n",
+ " \n",
+ " -2.89\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col20\" class=\"data row18 col20\">\n",
+ " \n",
+ " 1.9\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col21\" class=\"data row18 col21\">\n",
+ " \n",
+ " -9.74\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col22\" class=\"data row18 col22\">\n",
+ " \n",
+ " 3.43\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col23\" class=\"data row18 col23\">\n",
+ " \n",
+ " 7.07\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow18_col24\" class=\"data row18 col24\">\n",
+ " \n",
+ " 4.39\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " <tr>\n",
+ " \n",
+ " <th id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fb\" class=\"row_heading level24 row19\">\n",
+ " \n",
+ " 19\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col0\" class=\"data row19 col0\">\n",
+ " \n",
+ " 4.03\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col1\" class=\"data row19 col1\">\n",
+ " \n",
+ " 6.23\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col2\" class=\"data row19 col2\">\n",
+ " \n",
+ " -4.1\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col3\" class=\"data row19 col3\">\n",
+ " \n",
+ " -4.11\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col4\" class=\"data row19 col4\">\n",
+ " \n",
+ " 7.19\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col5\" class=\"data row19 col5\">\n",
+ " \n",
+ " -4.1\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col6\" class=\"data row19 col6\">\n",
+ " \n",
+ " -1.52\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col7\" class=\"data row19 col7\">\n",
+ " \n",
+ " 6.53\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col8\" class=\"data row19 col8\">\n",
+ " \n",
+ " -5.21\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col9\" class=\"data row19 col9\">\n",
+ " \n",
+ " -0.24\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col10\" class=\"data row19 col10\">\n",
+ " \n",
+ " 0.01\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col11\" class=\"data row19 col11\">\n",
+ " \n",
+ " 1.16\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col12\" class=\"data row19 col12\">\n",
+ " \n",
+ " 6.43\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col13\" class=\"data row19 col13\">\n",
+ " \n",
+ " -1.97\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col14\" class=\"data row19 col14\">\n",
+ " \n",
+ " -2.64\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col15\" class=\"data row19 col15\">\n",
+ " \n",
+ " -1.66\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col16\" class=\"data row19 col16\">\n",
+ " \n",
+ " -5.2\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col17\" class=\"data row19 col17\">\n",
+ " \n",
+ " -3.25\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col18\" class=\"data row19 col18\">\n",
+ " \n",
+ " -2.87\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col19\" class=\"data row19 col19\">\n",
+ " \n",
+ " -1.65\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col20\" class=\"data row19 col20\">\n",
+ " \n",
+ " 1.64\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col21\" class=\"data row19 col21\">\n",
+ " \n",
+ " -10.66\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col22\" class=\"data row19 col22\">\n",
+ " \n",
+ " 2.83\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col23\" class=\"data row19 col23\">\n",
+ " \n",
+ " 7.48\n",
+ " \n",
+ " \n",
+ " <td id=\"T_e8924e52_8bd5_11e5_bfc1_a45e60bd97fbrow19_col24\" class=\"data row19 col24\">\n",
+ " \n",
+ " 3.94\n",
+ " \n",
+ " \n",
+ " </tr>\n",
+ " \n",
+ " </tbody>\n",
+ " </table>\n",
+ " "
+ ],
+ "text/plain": [
+ "<pandas.core.style.Styler at 0x11335e6a0>"
+ ]
+ },
+ "execution_count": 29,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "np.random.seed(25)\n",
+ "cmap = cmap=sns.diverging_palette(5, 250, as_cmap=True)\n",
+ "df = pd.DataFrame(np.random.randn(20, 25)).cumsum()\n",
+ "\n",
+ "df.style.background_gradient(cmap, axis=1)\\\n",
+ " .set_properties(**{'max-width': '80px', 'font-size': '1pt'})\\\n",
+ " .set_caption(\"Hover to magify\")\\\n",
+ " .set_precision(2)\\\n",
+ " .set_table_styles(magnify())"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Extensibility\n",
+ "\n",
+ "The core of pandas is, and will remain, its \"high-performance, easy-to-use data structures\".\n",
+ "With that in mind, we hope that `DataFrame.style` accomplishes two goals\n",
+ "\n",
+ "- Provide an API that is pleasing to use interactively and is \"good enough\" for many tasks\n",
+ "- Provide the foundations for dedicated libraries to build on\n",
+ "\n",
+ "If you build a great library on top of this, let us know and we'll [link](http://pandas.pydata.org/pandas-docs/stable/ecosystem.html) to it.\n",
+ "\n",
+ "## Subclassing\n",
+ "\n",
+ "This section contains a bit of information about the implementation of `Styler`.\n",
+ "Since the feature is so new all of this is subject to change, even more so than the end-use API.\n",
+ "\n",
+ "As users apply styles (via `.apply`, `.applymap` or one of the builtins), we don't actually calculate anything.\n",
+ "Instead, we append functions and arguments to a list `self._todo`.\n",
+ "When asked (typically in `.render` we'll walk through the list and execute each function (this is in `self._compute()`.\n",
+ "These functions update an internal `defaultdict(list)`, `self.ctx` which maps DataFrame row / column positions to CSS attribute, value pairs.\n",
+ "\n",
+ "We take the extra step through `self._todo` so that we can export styles and set them on other `Styler`s.\n",
+ "\n",
+ "Rendering uses [Jinja](http://jinja.pocoo.org/) templates.\n",
+ "The `.translate` method takes `self.ctx` and builds another dictionary ready to be passed into `Styler.template.render`, the Jinja template.\n",
+ "\n",
+ "\n",
+ "## Alternate templates\n",
+ "\n",
+ "We've used [Jinja](http://jinja.pocoo.org/) templates to build up the HTML.\n",
+ "The template is stored as a class variable ``Styler.template.``. Subclasses can override that.\n",
+ "\n",
+ "```python\n",
+ "class CustomStyle(Styler):\n",
+ " template = Template(\"\"\"...\"\"\")\n",
+ "```"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.4.3"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
diff --git a/doc/source/index.rst.template b/doc/source/index.rst.template
index 621bd33ba5a41..6011c22e9cc2e 100644
--- a/doc/source/index.rst.template
+++ b/doc/source/index.rst.template
@@ -136,6 +136,7 @@ See the package overview for more detail about what's in the library.
timedeltas
categorical
visualization
+ style
io
remote_data
enhancingperf
diff --git a/doc/source/install.rst b/doc/source/install.rst
index 54e7b2d4df350..9accc188d567f 100644
--- a/doc/source/install.rst
+++ b/doc/source/install.rst
@@ -254,6 +254,7 @@ Optional Dependencies
* Needed for Excel I/O
* `XlsxWriter <https://pypi.python.org/pypi/XlsxWriter>`__
* Alternative Excel writer
+* `Jinja2 <http://jinja.pocoo.org/>`__: Template engine for conditional HTML formatting.
* `boto <https://pypi.python.org/pypi/boto>`__: necessary for Amazon S3
access.
* `blosc <https://pypi.python.org/pypi/blosc>`__: for msgpack compression using ``blosc``
diff --git a/doc/source/style.rst b/doc/source/style.rst
new file mode 100644
index 0000000000000..c373a75c98345
--- /dev/null
+++ b/doc/source/style.rst
@@ -0,0 +1,6 @@
+.. _style:
+
+.. currentmodule:: pandas
+
+.. raw:: html
+ :file: html-styling.html
diff --git a/doc/source/whatsnew/v0.17.1.txt b/doc/source/whatsnew/v0.17.1.txt
index 151131a52a4bb..7178be1ffefd2 100755
--- a/doc/source/whatsnew/v0.17.1.txt
+++ b/doc/source/whatsnew/v0.17.1.txt
@@ -15,6 +15,21 @@ Highlights include:
:local:
:backlinks: none
+New features
+~~~~~~~~~~~~
+
+.. _whatsnew_0171.style
+
+Conditional HTML Formatting
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+We've added *experimental* support for conditional HTML formatting,
+the visual styling of a DataFrame based on the data.
+The styling is accomplished with HTML and CSS.
+Acesses the styler class with :attr:`pandas.DataFrame.style`, attribute,
+an instance of :class:`~pandas.core.style.Styler` with your data attached.
+See the :ref:`example notebook <style>` for more.
+
.. _whatsnew_0171.enhancements:
Enhancements
diff --git a/pandas/core/frame.py b/pandas/core/frame.py
index 22d0026f27742..1e40d77839d3c 100644
--- a/pandas/core/frame.py
+++ b/pandas/core/frame.py
@@ -577,6 +577,19 @@ def _repr_html_(self):
else:
return None
+ @property
+ def style(self):
+ """
+ Property returning a Styler object containing methods for
+ building a styled HTML representation fo the DataFrame.
+
+ See Also
+ --------
+ pandas.core.Styler
+ """
+ from pandas.core.style import Styler
+ return Styler(self)
+
def iteritems(self):
"""
Iterator over (column name, Series) pairs.
@@ -1518,6 +1531,7 @@ def to_html(self, buf=None, columns=None, col_space=None, colSpace=None,
max_rows=max_rows,
max_cols=max_cols,
show_dimensions=show_dimensions)
+ # TODO: a generic formatter wld b in DataFrameFormatter
formatter.to_html(classes=classes, notebook=notebook)
if buf is None:
diff --git a/pandas/core/indexing.py b/pandas/core/indexing.py
index 0f3795fcad0c3..25a110ee43039 100644
--- a/pandas/core/indexing.py
+++ b/pandas/core/indexing.py
@@ -524,7 +524,7 @@ def _align_series(self, indexer, ser, multiindex_indexer=False):
Parameters
----------
indexer : tuple, slice, scalar
- The indexer used to get the locations that will be set to
+ The indexer used to get the locations that will be set to
`ser`
ser : pd.Series
@@ -532,7 +532,7 @@ def _align_series(self, indexer, ser, multiindex_indexer=False):
multiindex_indexer : boolean, optional
Defaults to False. Should be set to True if `indexer` was from
- a `pd.MultiIndex`, to avoid unnecessary broadcasting.
+ a `pd.MultiIndex`, to avoid unnecessary broadcasting.
Returns:
@@ -1806,3 +1806,46 @@ def maybe_droplevels(index, key):
pass
return index
+
+
+def _non_reducing_slice(slice_):
+ """
+ Ensurse that a slice doesn't reduce to a Series or Scalar.
+
+ Any user-paseed `subset` should have this called on it
+ to make sure we're always working with DataFrames.
+ """
+ # default to column slice, like DataFrame
+ # ['A', 'B'] -> IndexSlices[:, ['A', 'B']]
+ kinds = tuple(list(compat.string_types) +
+ [ABCSeries, np.ndarray, Index, list])
+ if isinstance(slice_, kinds):
+ slice_ = IndexSlice[:, slice_]
+
+ def pred(part):
+ # true when slice does *not* reduce
+ return isinstance(part, slice) or com.is_list_like(part)
+
+ if not com.is_list_like(slice_):
+ if not isinstance(slice_, slice):
+ # a 1-d slice, like df.loc[1]
+ slice_ = [[slice_]]
+ else:
+ # slice(a, b, c)
+ slice_ = [slice_] # to tuplize later
+ else:
+ slice_ = [part if pred(part) else [part] for part in slice_]
+ return tuple(slice_)
+
+
+def _maybe_numeric_slice(df, slice_, include_bool=False):
+ """
+ want nice defaults for background_gradient that don't break
+ with non-numeric data. But if slice_ is passed go with that.
+ """
+ if slice_ is None:
+ dtypes = [np.number]
+ if include_bool:
+ dtypes.append(bool)
+ slice_ = IndexSlice[:, df.select_dtypes(include=dtypes).columns]
+ return slice_
diff --git a/pandas/core/style.py b/pandas/core/style.py
new file mode 100644
index 0000000000000..11170a6fdbe33
--- /dev/null
+++ b/pandas/core/style.py
@@ -0,0 +1,720 @@
+"""
+Module for applying conditional formatting to
+DataFrames and Series.
+"""
+from functools import partial
+from contextlib import contextmanager
+from uuid import uuid1
+import copy
+from collections import defaultdict
+
+try:
+ from jinja2 import Template
+except ImportError:
+ msg = "pandas.Styler requires jinja2. "\
+ "Please install with `conda install Jinja2`\n"\
+ "or `pip install Jinja2`"
+ raise ImportError(msg)
+
+import numpy as np
+import pandas as pd
+from pandas.compat import lzip
+from pandas.core.indexing import _maybe_numeric_slice, _non_reducing_slice
+try:
+ import matplotlib.pyplot as plt
+ from matplotlib import colors
+ has_mpl = True
+except ImportError:
+ has_mpl = False
+ no_mpl_message = "{0} requires matplotlib."
+
+
+@contextmanager
+def _mpl(func):
+ if has_mpl:
+ yield plt, colors
+ else:
+ raise ImportError(no_mpl_message.format(func.__name__))
+
+
+class Styler(object):
+ """
+ Helps style a DataFrame or Series according to the
+ data with HTML and CSS.
+
+ .. versionadded:: 0.17.1
+
+ Parameters
+ ----------
+ data: Series or DataFrame
+ precision: int
+ precision to round floats to, defaults to pd.options.display.precision
+ table_styles: list-like, default None
+ list of {selector: (attr, value)} dicts; see Notes
+ uuid: str, default None
+ a unique identifier to avoid CSS collisons; generated automatically
+ caption: str, default None
+ caption to attach to the table
+
+ Attributes
+ ----------
+ tempate: Jinja Template
+
+ Notes
+ -----
+ Most styling will be done by passing style functions into
+ Styler.apply or Styler.applymap. Style functions should
+ return values with strings containing CSS 'attr: value' that will
+ be applied to the indicated cells.
+
+ If using in the Jupyter notebook, Styler has defined a _repr_html_
+ to automatically render itself. Otherwise call Styler.render to get
+ the genterated HTML.
+
+ See Also
+ --------
+ pandas.DataFrame.style
+ """
+ template = Template("""
+ <style type="text/css" >
+ {% for s in table_styles %}
+ #T_{{uuid}} {{s.selector}} {
+ {% for p,val in s.props %}
+ {{p}}: {{val}};
+ {% endfor %}
+ }
+ {% endfor %}
+ {% for s in cellstyle %}
+ #T_{{uuid}}{{s.selector}} {
+ {% for p,val in s.props %}
+ {{p}}: {{val}};
+ {% endfor %}
+ }
+ {% endfor %}
+ </style>
+
+ <table id="T_{{uuid}}">
+ {% if caption %}
+ <caption>{{caption}}</caption>
+ {% endif %}
+
+ <thead>
+ {% for r in head %}
+ <tr>
+ {% for c in r %}
+ <{{c.type}} class="{{c.class}}">{{c.value}}
+ {% endfor %}
+ </tr>
+ {% endfor %}
+ </thead>
+ <tbody>
+ {% for r in body %}
+ <tr>
+ {% for c in r %}
+ <{{c.type}} id="T_{{uuid}}{{c.id}}" class="{{c.class}}">
+ {% if c.value is number %}
+ {{c.value|round(precision)}}
+ {% else %}
+ {{c.value}}
+ {% endif %}
+ {% endfor %}
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+ """)
+
+ def __init__(self, data, precision=None, table_styles=None, uuid=None,
+ caption=None):
+ self.ctx = defaultdict(list)
+ self._todo = []
+
+ if not isinstance(data, (pd.Series, pd.DataFrame)):
+ raise TypeError
+ if data.ndim == 1:
+ data = data.to_frame()
+ if not data.index.is_unique or not data.columns.is_unique:
+ raise ValueError("style is not supported for non-unique indicies.")
+
+ self.data = data
+ self.index = data.index
+ self.columns = data.columns
+
+ self.uuid = uuid
+ self.table_styles = table_styles
+ self.caption = caption
+ if precision is None:
+ precision = pd.options.display.precision
+ self.precision = precision
+
+ def _repr_html_(self):
+ '''
+ Hooks into Jupyter notebook rich display system.
+ '''
+ return self.render()
+
+ def _translate(self):
+ """
+ Convert the DataFrame in `self.data` and the attrs from `_build_styles`
+ into a dictionary of {head, body, uuid, cellstyle}
+ """
+ table_styles = self.table_styles or []
+ caption = self.caption
+ ctx = self.ctx
+ precision = self.precision
+ uuid = self.uuid or str(uuid1()).replace("-", "_")
+ ROW_HEADING_CLASS = "row_heading"
+ COL_HEADING_CLASS = "col_heading"
+ DATA_CLASS = "data"
+ BLANK_CLASS = "blank"
+ BLANK_VALUE = ""
+
+ cell_context = dict()
+
+ n_rlvls = self.data.index.nlevels
+ n_clvls = self.data.columns.nlevels
+ rlabels = self.data.index.tolist()
+ clabels = self.data.columns.tolist()
+
+ idx_values = self.data.index.format(sparsify=False, adjoin=False,
+ names=False)
+ idx_values = lzip(*idx_values)
+
+ if n_rlvls == 1:
+ rlabels = [[x] for x in rlabels]
+ if n_clvls == 1:
+ clabels = [[x] for x in clabels]
+ clabels = list(zip(*clabels))
+
+ cellstyle = []
+ head = []
+
+ for r in range(n_clvls):
+ row_es = [{"type": "th", "value": BLANK_VALUE,
+ "class": " ".join([BLANK_CLASS])}] * n_rlvls
+ for c in range(len(clabels[0])):
+ cs = [COL_HEADING_CLASS, "level%s" % r, "col%s" % c]
+ cs.extend(cell_context.get(
+ "col_headings", {}).get(r, {}).get(c, []))
+ row_es.append({"type": "th", "value": clabels[r][c],
+ "class": " ".join(cs)})
+ head.append(row_es)
+
+ body = []
+ for r, idx in enumerate(self.data.index):
+ cs = [ROW_HEADING_CLASS, "level%s" % c, "row%s" % r]
+ cs.extend(cell_context.get(
+ "row_headings", {}).get(r, {}).get(c, []))
+ row_es = [{"type": "th",
+ "value": rlabels[r][c],
+ "class": " ".join(cs)}
+ for c in range(len(rlabels[r]))]
+
+ for c, col in enumerate(self.data.columns):
+ cs = [DATA_CLASS, "row%s" % r, "col%s" % c]
+ cs.extend(cell_context.get("data", {}).get(r, {}).get(c, []))
+ row_es.append({"type": "td", "value": self.data.iloc[r][c],
+ "class": " ".join(cs), "id": "_".join(cs[1:])})
+ props = []
+ for x in ctx[r, c]:
+ # have to handle empty styles like ['']
+ if x.count(":"):
+ props.append(x.split(":"))
+ else:
+ props.append(['', ''])
+ cellstyle.append(
+ {'props': props,
+ 'selector': "row%s_col%s" % (r, c)}
+ )
+ body.append(row_es)
+
+ return dict(head=head, cellstyle=cellstyle, body=body, uuid=uuid,
+ precision=precision, table_styles=table_styles,
+ caption=caption)
+
+ def render(self):
+ """
+ Render the built up styles to HTML
+
+ .. versionadded:: 0.17.1
+
+ Returns
+ -------
+ rendered: str
+ the rendered HTML
+
+ Notes
+ -----
+ ``Styler`` objects have defined the ``_repr_html_`` method
+ which automatically calls ``self.render()`` when it's the
+ last item in a Notebook cell. When calling ``Styler.render()``
+ directly, wrap the resul in ``IPython.display.HTML`` to view
+ the rendered HTML in the notebook.
+ """
+ self._compute()
+ d = self._translate()
+ # filter out empty styles, every cell will have a class
+ # but the list of props may just be [['', '']].
+ # so we have the neested anys below
+ trimmed = [x for x in d['cellstyle'] if
+ any(any(y) for y in x['props'])]
+ d['cellstyle'] = trimmed
+ return self.template.render(**d)
+
+ def _update_ctx(self, attrs):
+ """
+ update the state of the Styler. Collects a mapping
+ of {index_label: ['<property>: <value>']}
+
+ attrs: Series or DataFrame
+ should contain strings of '<property>: <value>;<prop2>: <val2>'
+ Whitespace shouldn't matter and the final trailing ';' shouldn't
+ matter.
+ """
+ for row_label, v in attrs.iterrows():
+ for col_label, col in v.iteritems():
+ i = self.index.get_indexer([row_label])[0]
+ j = self.columns.get_indexer([col_label])[0]
+ for pair in col.rstrip(";").split(";"):
+ self.ctx[(i, j)].append(pair)
+
+ def _copy(self, deepcopy=False):
+ styler = Styler(self.data, precision=self.precision,
+ caption=self.caption, uuid=self.uuid,
+ table_styles=self.table_styles)
+ if deepcopy:
+ styler.ctx = copy.deepcopy(self.ctx)
+ styler._todo = copy.deepcopy(self._todo)
+ else:
+ styler.ctx = self.ctx
+ styler._todo = self._todo
+ return styler
+
+ def __copy__(self):
+ """
+ Deep copy by default.
+ """
+ return self._copy(deepcopy=False)
+
+ def __deepcopy__(self, memo):
+ return self._copy(deepcopy=True)
+
+ def clear(self):
+ self.ctx.clear()
+ self._todo = []
+
+ def _compute(self):
+ '''
+ Execute the style functions built up in `self._todo`.
+
+ Relies on the conventions that all style functions go through
+ .apply or .applymap. The append styles to apply as tuples of
+
+ (application method, *args, **kwargs)
+ '''
+ r = self
+ for func, args, kwargs in self._todo:
+ r = func(self)(*args, **kwargs)
+ return r
+
+ def _apply(self, func, axis=0, subset=None, **kwargs):
+ subset = slice(None) if subset is None else subset
+ subset = _non_reducing_slice(subset)
+ if axis is not None:
+ result = self.data.loc[subset].apply(func, axis=axis, **kwargs)
+ else:
+ # like tee
+ result = func(self.data.loc[subset], **kwargs)
+ self._update_ctx(result)
+ return self
+
+ def apply(self, func, axis=0, subset=None, **kwargs):
+ """
+ Apply a function column-wise, row-wise, or table-wase,
+ updating the HTML representation with the result.
+
+ .. versionadded:: 0.17.1
+
+ Parameters
+ ----------
+ func: function
+ axis: int, str or None
+ apply to each column (``axis=0`` or ``'index'``)
+ or to each row (``axis=1`` or ``'columns'``) or
+ to the entire DataFrame at once with ``axis=None``.
+ subset: IndexSlice
+ a valid indexer to limit ``data`` to *before* applying the
+ function. Consider using a pandas.IndexSlice
+ kwargs: dict
+ pass along to ``func``
+
+ Returns
+ -------
+ self
+
+ Notes
+ -----
+ This is similar to DataFrame.apply, except that axis=None applies
+ the function to the entire DataFrame at once, rather tha column
+ or rowwise.
+ """
+ self._todo.append((lambda instance: getattr(instance, '_apply'),
+ (func, axis, subset),
+ kwargs))
+ return self
+
+ def _applymap(self, func, subset=None, **kwargs):
+ func = partial(func, **kwargs) # applymap doesn't take kwargs?
+ if subset is None:
+ subset = pd.IndexSlice[:]
+ subset = _non_reducing_slice(subset)
+ result = self.data.loc[subset].applymap(func)
+ self._update_ctx(result)
+ return self
+
+ def applymap(self, func, subset=None, **kwargs):
+ """
+ Apply a function elementwise, updating the HTML
+ representation with the result.
+
+ .. versionadded:: 0.17.1
+
+ Parameters
+ ----------
+ func : function
+ subset : IndexSlice
+ a valid indexer to limit ``data`` to *before* applying the
+ function. Consider using a pandas.IndexSlice
+ kwargs : dict
+ pass along to ``func``
+
+ Returns
+ -------
+ self
+
+ """
+ self._todo.append((lambda instance: getattr(instance, '_applymap'),
+ (func, subset),
+ kwargs))
+ return self
+
+ def set_precision(self, precision):
+ """
+ Set the precision used to render.
+
+ .. versionadded:: 0.17.1
+
+ Parameters
+ ----------
+ precision: int
+
+ Returns
+ -------
+ self
+ """
+ self.precision = precision
+ return self
+
+ def export(self):
+ """
+ Export the styles to applied to the current Styler.
+ Can be applied to a second style with `.use`.
+
+ .. versionadded:: 0.17.1
+
+ Returns
+ -------
+ styles: list
+
+ See Also
+ --------
+ Styler.use
+ """
+ return self._todo
+
+ def use(self, styles):
+ """
+ Set the styles on the current Styler, possibly using styles
+ from `Styler.export`
+
+ .. versionadded:: 0.17.1
+
+ Parameters
+ ----------
+ styles: list
+ list of style functions
+
+ Returns
+ -------
+ self
+
+ See Also
+ --------
+ Styler.export
+ """
+ self._todo.extend(styles)
+ return self
+
+ def set_uuid(self, uuid):
+ """
+ Set the uuid for a Styler.
+
+ .. versionadded:: 0.17.1
+
+ Parameters
+ ----------
+ uuid: str
+
+ Returns
+ -------
+ self
+ """
+ self.uuid = uuid
+ return self
+
+ def set_caption(self, caption):
+ """
+ Se the caption on a Styler
+
+ .. versionadded:: 0.17.1
+
+ Parameters
+ ----------
+ caption: str
+
+ Returns
+ -------
+ self
+ """
+ self.caption = caption
+ return self
+
+ def set_table_styles(self, table_styles):
+ """
+ Set the table styles on a Styler
+
+ .. versionadded:: 0.17.1
+
+ Parameters
+ ----------
+ table_styles: list
+
+ Returns
+ -------
+ self
+ """
+ self.table_styles = table_styles
+ return self
+
+ # -----------------------------------------------------------------------
+ # A collection of "builtin" styles
+ # -----------------------------------------------------------------------
+
+ @staticmethod
+ def _highlight_null(v, null_color):
+ return 'background-color: %s' % null_color if pd.isnull(v) else ''
+
+ def highlight_null(self, null_color='red'):
+ """
+ Shade the background ``null_color`` for missing values.
+
+ .. versionadded:: 0.17.1
+
+ Parameters
+ ----------
+ null_color: str
+
+ Returns
+ -------
+ self
+ """
+ self.applymap(self._highlight_null, null_color=null_color)
+ return self
+
+ def background_gradient(self, cmap='PuBu', low=0, high=0,
+ axis=0, subset=None):
+ """
+ Color the background in a gradient according to
+ the data in each column (optionally row).
+ Requires matplotlib.
+
+ .. versionadded:: 0.17.1
+
+ Parameters
+ ----------
+ cmap: str or colormap
+ matplotlib colormap
+ low, high: float
+ compress the range by these values.
+ axis: int or str
+ 1 or 'columns' for colunwise, 0 or 'index' for rowwise
+ subset: IndexSlice
+ a valid slice for ``data`` to limit the style application to
+
+ Returns
+ -------
+ self
+
+ Notes
+ -----
+ Tune ``low`` and ``high`` to keep the text legible by
+ not using the entire range of the color map. These extend
+ the range of the data by ``low * (x.max() - x.min())``
+ and ``high * (x.max() - x.min())`` before normalizing.
+ """
+ subset = _maybe_numeric_slice(self.data, subset)
+ subset = _non_reducing_slice(subset)
+ self.apply(self._background_gradient, cmap=cmap, subset=subset,
+ axis=axis, low=low, high=high)
+ return self
+
+ @staticmethod
+ def _background_gradient(s, cmap='PuBu', low=0, high=0):
+ """Color background in a range according to the data."""
+ with _mpl(Styler.background_gradient) as (plt, colors):
+ rng = s.max() - s.min()
+ # extend lower / upper bounds, compresses color range
+ norm = colors.Normalize(s.min() - (rng * low),
+ s.max() + (rng * high))
+ # matplotlib modifies inplace?
+ # https://github.com/matplotlib/matplotlib/issues/5427
+ normed = norm(s.values)
+ c = [colors.rgb2hex(x) for x in plt.cm.get_cmap(cmap)(normed)]
+ return ['background-color: %s' % color for color in c]
+
+ def set_properties(self, subset=None, **kwargs):
+ """
+ Convience method for setting one or more non-data dependent
+ properties or each cell.
+
+ .. versionadded:: 0.17.1
+
+ Parameters
+ ----------
+ subset: IndexSlice
+ a valid slice for ``data`` to limit the style application to
+ kwargs: dict
+ property: value pairs to be set for each cell
+
+ Returns
+ -------
+ self : Styler
+
+ Examples
+ --------
+ >>> df = pd.DataFrame(np.random.randn(10, 4))
+ >>> df.style.set_properties(color="white", align="right")
+ """
+ values = ';'.join('{p}: {v}'.format(p=p, v=v) for p, v in
+ kwargs.items())
+ f = lambda x: values
+ return self.applymap(f, subset=subset)
+
+ @staticmethod
+ def _bar(s, color, width):
+ normed = width * (s - s.min()) / (s.max() - s.min())
+ attrs = 'width: 10em; height: 80%;'\
+ 'background: linear-gradient(90deg,'\
+ '{c} {w}%, transparent 0%)'
+ return [attrs.format(c=color, w=x) for x in normed]
+
+ def bar(self, subset=None, axis=0, color='#d65f5f', width=100):
+ """
+ Color the background ``color`` proptional to the values in each column.
+ Excludes non-numeric data by default.
+
+ .. versionadded:: 0.17.1
+
+ Parameters
+ ----------
+ subset: IndexSlice, default None
+ a valid slice for ``data`` to limit the style application to
+ axis: int
+ color: str
+ width: float
+ A number between 0 or 100. The largest value will cover ``width``
+ percent of the cell's width
+
+ Returns
+ -------
+ self
+ """
+ subset = _maybe_numeric_slice(self.data, subset)
+ subset = _non_reducing_slice(subset)
+ self.apply(self._bar, subset=subset, axis=axis, color=color,
+ width=width)
+ return self
+
+ def highlight_max(self, subset=None, color='yellow', axis=0):
+ """
+ Highlight the maximum by shading the background
+
+ .. versionadded:: 0.17.1
+
+ Parameters
+ ----------
+ subset: IndexSlice, default None
+ a valid slice for ``data`` to limit the style application to
+ color: str, default 'yellow'
+ axis: int, str, or None; default None
+ 0 or 'index' for columnwise, 1 or 'columns' for rowwise
+ or ``None`` for tablewise (the default)
+
+ Returns
+ -------
+ self
+ """
+ return self._highlight_handler(subset=subset, color=color, axis=axis,
+ max_=True)
+
+ def highlight_min(self, subset=None, color='yellow', axis=0):
+ """
+ Highlight the minimum by shading the background
+
+ .. versionadded:: 0.17.1
+
+ Parameters
+ ----------
+ subset: IndexSlice, default None
+ a valid slice for ``data`` to limit the style application to
+ color: str, default 'yellow'
+ axis: int, str, or None; default None
+ 0 or 'index' for columnwise, 1 or 'columns' for rowwise
+ or ``None`` for tablewise (the default)
+
+ Returns
+ -------
+ self
+ """
+ return self._highlight_handler(subset=subset, color=color, axis=axis,
+ max_=False)
+
+ def _highlight_handler(self, subset=None, color='yellow', axis=None,
+ max_=True):
+ subset = _non_reducing_slice(_maybe_numeric_slice(self.data, subset))
+ self.apply(self._highlight_extrema, color=color, axis=axis,
+ subset=subset, max_=max_)
+ return self
+
+ @staticmethod
+ def _highlight_extrema(data, color='yellow', max_=True):
+ '''
+ highlight the min or max in a Series or DataFrame
+ '''
+ attr = 'background-color: {0}'.format(color)
+ if data.ndim == 1: # Series from .apply
+ if max_:
+ extrema = data == data.max()
+ else:
+ extrema = data == data.min()
+ return [attr if v else '' for v in extrema]
+ else: # DataFrame from .tee
+ if max_:
+ extrema = data == data.max().max()
+ else:
+ extrema = data == data.min().min()
+ return pd.DataFrame(np.where(extrema, attr, ''),
+ index=data.index, columns=data.columns)
+
+
+
diff --git a/pandas/tests/test_indexing.py b/pandas/tests/test_indexing.py
index 36e825924995a..0eb6a6a70f8b7 100644
--- a/pandas/tests/test_indexing.py
+++ b/pandas/tests/test_indexing.py
@@ -15,6 +15,7 @@
import pandas as pd
import pandas.core.common as com
from pandas import option_context
+from pandas.core.indexing import _non_reducing_slice, _maybe_numeric_slice
from pandas.core.api import (DataFrame, Index, Series, Panel, isnull,
MultiIndex, Float64Index, Timestamp, Timedelta)
from pandas.util.testing import (assert_almost_equal, assert_series_equal,
@@ -4728,6 +4729,49 @@ def test_large_mi_dataframe_indexing(self):
result = MultiIndex.from_arrays([range(10**6), range(10**6)])
assert(not (10**6, 0) in result)
+ def test_non_reducing_slice(self):
+ df = pd.DataFrame([[0, 1], [2, 3]])
+
+ slices = [
+ # pd.IndexSlice[:, :],
+ pd.IndexSlice[:, 1],
+ pd.IndexSlice[1, :],
+ pd.IndexSlice[[1], [1]],
+ pd.IndexSlice[1, [1]],
+ pd.IndexSlice[[1], 1],
+ pd.IndexSlice[1],
+ pd.IndexSlice[1, 1],
+ slice(None, None, None),
+ [0, 1],
+ np.array([0, 1]),
+ pd.Series([0, 1])
+ ]
+ for slice_ in slices:
+ tslice_ = _non_reducing_slice(slice_)
+ self.assertTrue(isinstance(df.loc[tslice_], DataFrame))
+
+ def test_list_slice(self):
+ # like dataframe getitem
+ slices = [['A'], pd.Series(['A']), np.array(['A'])]
+ df = pd.DataFrame({'A': [1, 2], 'B': [3, 4]}, index=['A', 'B'])
+ expected = pd.IndexSlice[:, ['A']]
+ for subset in slices:
+ result = _non_reducing_slice(subset)
+ tm.assert_frame_equal(df.loc[result], df.loc[expected])
+
+ def test_maybe_numeric_slice(self):
+ df = pd.DataFrame({'A': [1, 2], 'B': ['c', 'd'], 'C': [True, False]})
+ result = _maybe_numeric_slice(df, slice_=None)
+ expected = pd.IndexSlice[:, ['A']]
+ self.assertEqual(result, expected)
+
+ result = _maybe_numeric_slice(df, None, include_bool=True)
+ expected = pd.IndexSlice[:, ['A', 'C']]
+ result = _maybe_numeric_slice(df, [1])
+ expected = [1]
+ self.assertEqual(result, expected)
+
+
class TestCategoricalIndex(tm.TestCase):
def setUp(self):
diff --git a/pandas/tests/test_style.py b/pandas/tests/test_style.py
new file mode 100644
index 0000000000000..4c875cebe149a
--- /dev/null
+++ b/pandas/tests/test_style.py
@@ -0,0 +1,372 @@
+import os
+from nose import SkipTest
+
+# this is a mess. Getting failures on a python 2.7 build with
+# whenever we try to import jinja, whether it's installed or not.
+# so we're explicitly skipping that one *before* we try to import
+# jinja. We still need to export the imports as globals,
+# since importing Styler tries to import jinja2.
+job_name = os.environ.get('JOB_NAME', None)
+if job_name == '27_slow_nnet_LOCALE':
+ raise SkipTest("No jinja")
+try:
+ from pandas.core.style import Styler
+except ImportError:
+ raise SkipTest("No Jinja2")
+
+import copy
+
+import numpy as np
+import pandas as pd
+from pandas import DataFrame
+from pandas.util.testing import TestCase
+import pandas.util.testing as tm
+
+
+class TestStyler(TestCase):
+
+ def setUp(self):
+ np.random.seed(24)
+ self.s = DataFrame({'A': np.random.permutation(range(6))})
+ self.df = DataFrame({'A': [0, 1], 'B': np.random.randn(2)})
+ self.f = lambda x: x
+ self.g = lambda x: x
+
+ def h(x, foo='bar'):
+ return pd.Series(['color: %s' % foo], index=x.index, name=x.name)
+
+ self.h = h
+ self.styler = Styler(self.df)
+ self.attrs = pd.DataFrame({'A': ['color: red', 'color: blue']})
+ self.dataframes = [
+ self.df,
+ pd.DataFrame({'f': [1., 2.], 'o': ['a', 'b'],
+ 'c': pd.Categorical(['a', 'b'])})
+ ]
+
+ def test_update_ctx(self):
+ self.styler._update_ctx(self.attrs)
+ expected = {(0, 0): ['color: red'],
+ (1, 0): ['color: blue']}
+ self.assertEqual(self.styler.ctx, expected)
+
+ def test_update_ctx_flatten_multi(self):
+ attrs = DataFrame({"A": ['color: red; foo: bar',
+ 'color: blue; foo: baz']})
+ self.styler._update_ctx(attrs)
+ expected = {(0, 0): ['color: red', ' foo: bar'],
+ (1, 0): ['color: blue', ' foo: baz']}
+ self.assertEqual(self.styler.ctx, expected)
+
+ def test_update_ctx_flatten_multi_traliing_semi(self):
+ attrs = DataFrame({"A": ['color: red; foo: bar;',
+ 'color: blue; foo: baz;']})
+ self.styler._update_ctx(attrs)
+ expected = {(0, 0): ['color: red', ' foo: bar'],
+ (1, 0): ['color: blue', ' foo: baz']}
+ self.assertEqual(self.styler.ctx, expected)
+
+ def test_copy(self):
+ s2 = copy.copy(self.styler)
+ self.assertTrue(self.styler is not s2)
+ self.assertTrue(self.styler.ctx is s2.ctx) # shallow
+ self.assertTrue(self.styler._todo is s2._todo)
+
+ self.styler._update_ctx(self.attrs)
+ self.styler.highlight_max()
+ self.assertEqual(self.styler.ctx, s2.ctx)
+ self.assertEqual(self.styler._todo, s2._todo)
+
+ def test_deepcopy(self):
+ s2 = copy.deepcopy(self.styler)
+ self.assertTrue(self.styler is not s2)
+ self.assertTrue(self.styler.ctx is not s2.ctx)
+ self.assertTrue(self.styler._todo is not s2._todo)
+
+ self.styler._update_ctx(self.attrs)
+ self.styler.highlight_max()
+ self.assertNotEqual(self.styler.ctx, s2.ctx)
+ self.assertEqual(s2._todo, [])
+ self.assertNotEqual(self.styler._todo, s2._todo)
+
+ def test_clear(self):
+ s = self.df.style.highlight_max()._compute()
+ self.assertTrue(len(s.ctx) > 0)
+ self.assertTrue(len(s._todo) > 0)
+ s.clear()
+ self.assertTrue(len(s.ctx) == 0)
+ self.assertTrue(len(s._todo) == 0)
+
+ def test_render(self):
+ df = pd.DataFrame({"A": [0, 1]})
+ style = lambda x: pd.Series(["color: red", "color: blue"], name=x.name)
+ s = Styler(df, uuid='AB').apply(style).apply(style, axis=1)
+ s.render()
+ # it worked?
+
+ def test_render_double(self):
+ df = pd.DataFrame({"A": [0, 1]})
+ style = lambda x: pd.Series(["color: red; border: 1px",
+ "color: blue; border: 2px"], name=x.name)
+ s = Styler(df, uuid='AB').apply(style)
+ s.render()
+ # it worked?
+
+ def test_set_properties(self):
+ df = pd.DataFrame({"A": [0, 1]})
+ result = df.style.set_properties(color='white',
+ size='10px')._compute().ctx
+ # order is deterministic
+ v = ["color: white", "size: 10px"]
+ expected = {(0, 0): v, (1, 0): v}
+ self.assertEqual(result.keys(), expected.keys())
+ for v1, v2 in zip(result.values(), expected.values()):
+ self.assertEqual(sorted(v1), sorted(v2))
+
+ def test_set_properties_subset(self):
+ df = pd.DataFrame({'A': [0, 1]})
+ result = df.style.set_properties(subset=pd.IndexSlice[0, 'A'],
+ color='white')._compute().ctx
+ expected = {(0, 0): ['color: white']}
+ self.assertEqual(result, expected)
+
+ def test_apply_axis(self):
+ df = pd.DataFrame({'A': [0, 0], 'B': [1, 1]})
+ f = lambda x: ['val: %s' % x.max() for v in x]
+ result = df.style.apply(f, axis=1)
+ self.assertEqual(len(result._todo), 1)
+ self.assertEqual(len(result.ctx), 0)
+ result._compute()
+ expected = {(0, 0): ['val: 1'], (0, 1): ['val: 1'],
+ (1, 0): ['val: 1'], (1, 1): ['val: 1']}
+ self.assertEqual(result.ctx, expected)
+
+ result = df.style.apply(f, axis=0)
+ expected = {(0, 0): ['val: 0'], (0, 1): ['val: 1'],
+ (1, 0): ['val: 0'], (1, 1): ['val: 1']}
+ result._compute()
+ self.assertEqual(result.ctx, expected)
+ result = df.style.apply(f) # default
+ result._compute()
+ self.assertEqual(result.ctx, expected)
+
+ def test_apply_subset(self):
+ axes = [0, 1]
+ slices = [pd.IndexSlice[:], pd.IndexSlice[:, ['A']],
+ pd.IndexSlice[[1], :], pd.IndexSlice[[1], ['A']],
+ pd.IndexSlice[:2, ['A', 'B']]]
+ for ax in axes:
+ for slice_ in slices:
+ result = self.df.style.apply(self.h, axis=ax, subset=slice_,
+ foo='baz')._compute().ctx
+ expected = dict(((r, c), ['color: baz'])
+ for r, row in enumerate(self.df.index)
+ for c, col in enumerate(self.df.columns)
+ if row in self.df.loc[slice_].index
+ and col in self.df.loc[slice_].columns)
+ self.assertEqual(result, expected)
+
+ def test_applymap_subset(self):
+ def f(x):
+ return 'foo: bar'
+
+ slices = [pd.IndexSlice[:], pd.IndexSlice[:, ['A']],
+ pd.IndexSlice[[1], :], pd.IndexSlice[[1], ['A']],
+ pd.IndexSlice[:2, ['A', 'B']]]
+
+ for slice_ in slices:
+ result = self.df.style.applymap(f, subset=slice_)._compute().ctx
+ expected = dict(((r, c), ['foo: bar'])
+ for r, row in enumerate(self.df.index)
+ for c, col in enumerate(self.df.columns)
+ if row in self.df.loc[slice_].index
+ and col in self.df.loc[slice_].columns)
+ self.assertEqual(result, expected)
+
+ def test_empty(self):
+ df = pd.DataFrame({'A': [1, 0]})
+ s = df.style
+ s.ctx = {(0, 0): ['color: red'],
+ (1, 0): ['']}
+
+ result = s._translate()['cellstyle']
+ expected = [{'props': [['color', ' red']], 'selector': 'row0_col0'},
+ {'props': [['', '']], 'selector': 'row1_col0'}]
+ self.assertEqual(result, expected)
+
+ def test_bar(self):
+ df = pd.DataFrame({'A': [0, 1, 2]})
+ result = df.style.bar()._compute().ctx
+ expected = {
+ (0, 0): ['width: 10em', ' height: 80%',
+ 'background: linear-gradient('
+ '90deg,#d65f5f 0.0%, transparent 0%)'],
+ (1, 0): ['width: 10em', ' height: 80%',
+ 'background: linear-gradient('
+ '90deg,#d65f5f 50.0%, transparent 0%)'],
+ (2, 0): ['width: 10em', ' height: 80%',
+ 'background: linear-gradient('
+ '90deg,#d65f5f 100.0%, transparent 0%)']
+ }
+ self.assertEqual(result, expected)
+
+ result = df.style.bar(color='red', width=50)._compute().ctx
+ expected = {
+ (0, 0): ['width: 10em', ' height: 80%',
+ 'background: linear-gradient('
+ '90deg,red 0.0%, transparent 0%)'],
+ (1, 0): ['width: 10em', ' height: 80%',
+ 'background: linear-gradient('
+ '90deg,red 25.0%, transparent 0%)'],
+ (2, 0): ['width: 10em', ' height: 80%',
+ 'background: linear-gradient('
+ '90deg,red 50.0%, transparent 0%)']
+ }
+ self.assertEqual(result, expected)
+
+ df['C'] = ['a'] * len(df)
+ result = df.style.bar(color='red', width=50)._compute().ctx
+ self.assertEqual(result, expected)
+ df['C'] = df['C'].astype('category')
+ result = df.style.bar(color='red', width=50)._compute().ctx
+ self.assertEqual(result, expected)
+
+ def test_highlight_null(self, null_color='red'):
+ df = pd.DataFrame({'A': [0, np.nan]})
+ result = df.style.highlight_null()._compute().ctx
+ expected = {(0, 0): [''],
+ (1, 0): ['background-color: red']}
+ self.assertEqual(result, expected)
+
+ def test_nonunique_raises(self):
+ df = pd.DataFrame([[1, 2]], columns=['A', 'A'])
+ with tm.assertRaises(ValueError):
+ df.style
+
+ with tm.assertRaises(ValueError):
+ Styler(df)
+
+ def test_caption(self):
+ styler = Styler(self.df, caption='foo')
+ result = styler.render()
+ self.assertTrue(all(['caption' in result, 'foo' in result]))
+
+ styler = self.df.style
+ result = styler.set_caption('baz')
+ self.assertTrue(styler is result)
+ self.assertEqual(styler.caption, 'baz')
+
+ def test_uuid(self):
+ styler = Styler(self.df, uuid='abc123')
+ result = styler.render()
+ self.assertTrue('abc123' in result)
+
+ styler = self.df.style
+ result = styler.set_uuid('aaa')
+ self.assertTrue(result is styler)
+ self.assertEqual(result.uuid, 'aaa')
+
+ def test_table_styles(self):
+ style = [{'selector': 'th', 'props': [('foo', 'bar')]}]
+ styler = Styler(self.df, table_styles=style)
+ result = ' '.join(styler.render().split())
+ self.assertTrue('th { foo: bar; }' in result)
+
+ styler = self.df.style
+ result = styler.set_table_styles(style)
+ self.assertTrue(styler is result)
+ self.assertEqual(styler.table_styles, style)
+
+ def test_precision(self):
+ with pd.option_context('display.precision', 10):
+ s = Styler(self.df)
+ self.assertEqual(s.precision, 10)
+ s = Styler(self.df, precision=2)
+ self.assertEqual(s.precision, 2)
+
+ s2 = s.set_precision(4)
+ self.assertTrue(s is s2)
+ self.assertEqual(s.precision, 4)
+
+ def test_apply_none(self):
+ def f(x):
+ return pd.DataFrame(np.where(x == x.max(), 'color: red', ''),
+ index=x.index, columns=x.columns)
+ result = (pd.DataFrame([[1, 2], [3, 4]])
+ .style.apply(f, axis=None)._compute().ctx)
+ self.assertEqual(result[(1, 1)], ['color: red'])
+
+ def test_trim(self):
+ result = self.df.style.render() # trim=True
+ self.assertEqual(result.count('#'), 0)
+
+ result = self.df.style.highlight_max().render()
+ self.assertEqual(result.count('#'), len(self.df.columns))
+
+ def test_highlight_max(self):
+ df = pd.DataFrame([[1, 2], [3, 4]], columns=['A', 'B'])
+ # max(df) = min(-df)
+ for max_ in [True, False]:
+ if max_:
+ attr = 'highlight_max'
+ else:
+ df = -df
+ attr = 'highlight_min'
+ result = getattr(df.style, attr)()._compute().ctx
+ self.assertEqual(result[(1, 1)], ['background-color: yellow'])
+
+ result = getattr(df.style, attr)(color='green')._compute().ctx
+ self.assertEqual(result[(1, 1)], ['background-color: green'])
+
+ result = getattr(df.style, attr)(subset='A')._compute().ctx
+ self.assertEqual(result[(1, 0)], ['background-color: yellow'])
+
+ result = getattr(df.style, attr)(axis=0)._compute().ctx
+ expected = {(1, 0): ['background-color: yellow'],
+ (1, 1): ['background-color: yellow'],
+ (0, 1): [''], (0, 0): ['']}
+ self.assertEqual(result, expected)
+
+ result = getattr(df.style, attr)(axis=1)._compute().ctx
+ expected = {(0, 1): ['background-color: yellow'],
+ (1, 1): ['background-color: yellow'],
+ (0, 0): [''], (1, 0): ['']}
+ self.assertEqual(result, expected)
+
+ # separate since we cant negate the strs
+ df['C'] = ['a', 'b']
+ result = df.style.highlight_max()._compute().ctx
+ expected = {(1, 1): ['background-color: yellow']}
+
+ result = df.style.highlight_min()._compute().ctx
+ expected = {(0, 0): ['background-color: yellow']}
+
+ def test_export(self):
+ f = lambda x: 'color: red' if x > 0 else 'color: blue'
+ g = lambda x, y, z: 'color: %s' if x > 0 else 'color: %s' % z
+ style1 = self.styler
+ style1.applymap(f)\
+ .applymap(g, y='a', z='b')\
+ .highlight_max()
+ result = style1.export()
+ style2 = self.df.style
+ style2.use(result)
+ self.assertEqual(style1._todo, style2._todo)
+ style2.render()
+
+
+@tm.mplskip
+class TestStylerMatplotlibDep(TestCase):
+
+ def test_background_gradient(self):
+ df = pd.DataFrame([[1, 2], [2, 4]], columns=['A', 'B'])
+ for axis in [0, 1, 'index', 'columns']:
+ for cmap in [None, 'YlOrRd']:
+ result = df.style.background_gradient(cmap=cmap)._compute().ctx
+ self.assertTrue(all("#" in x[0] for x in result.values()))
+ self.assertEqual(result[(0, 0)], result[(0, 1)])
+ self.assertEqual(result[(1, 0)], result[(1, 1)])
+
+ result = (df.style.background_gradient(subset=pd.IndexSlice[1, 'A'])
+ ._compute().ctx)
+ self.assertEqual(result[(1, 0)], ['background-color: #fff7fb'])
diff --git a/pandas/tests/test_testing.py b/pandas/tests/test_testing.py
index 2b5443e6ff0d2..13c0b6a08f6e7 100644
--- a/pandas/tests/test_testing.py
+++ b/pandas/tests/test_testing.py
@@ -11,7 +11,8 @@
from pandas.util.testing import (
assert_almost_equal, assertRaisesRegexp, raise_with_traceback,
assert_index_equal, assert_series_equal, assert_frame_equal,
- assert_numpy_array_equal, assert_isinstance, RNGContext
+ assert_numpy_array_equal, assert_isinstance, RNGContext,
+ assertRaises, skip_if_no_package_deco
)
from pandas.compat import is_platform_windows
@@ -627,6 +628,23 @@ def test_locale(self):
self.assertTrue(len(locales) >= 1)
+def test_skiptest_deco():
+ from nose import SkipTest
+ @skip_if_no_package_deco("fakepackagename")
+ def f():
+ pass
+ with assertRaises(SkipTest):
+ f()
+
+ @skip_if_no_package_deco("numpy")
+ def f():
+ pass
+ # hack to ensure that SkipTest is *not* raised
+ with assertRaises(ValueError):
+ f()
+ raise ValueError
+
+
if __name__ == '__main__':
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
exit=False)
diff --git a/pandas/util/testing.py b/pandas/util/testing.py
index be8b0df73593f..ba32bc1f3e377 100644
--- a/pandas/util/testing.py
+++ b/pandas/util/testing.py
@@ -1578,7 +1578,18 @@ def skip_if_no_package(*args, **kwargs):
exc_failed_check=SkipTest,
*args, **kwargs)
-#
+def skip_if_no_package_deco(pkg_name, version=None, app='pandas'):
+ from nose import SkipTest
+
+ def deco(func):
+ @wraps(func)
+ def wrapper(*args, **kwargs):
+ package_check(pkg_name, version=version, app=app,
+ exc_failed_import=SkipTest, exc_failed_check=SkipTest)
+ return func(*args, **kwargs)
+ return wrapper
+ return deco
+ #
# Additional tags decorators for nose
#
| closes https://github.com/pydata/pandas/issues/3190
closes #4315
Not close to being done, but I wanted to put this here before the meeting. Maybe someone will have a chance to check it out.
~~http://nbviewer.ipython.org/github/TomAugspurger/pandas/blob/638bd3e361633a4c446ee02534e07b8a9332258a/style.ipynb~~
~~https://github.com/TomAugspurger/pandas/blob/stylely/style.ipynb~~
[latest example notebook](http://nbviewer.ipython.org/gist/TomAugspurger/82a53e11993469cb29a1)
| https://api.github.com/repos/pandas-dev/pandas/pulls/10250 | 2015-06-02T12:41:28Z | 2015-11-16T00:02:02Z | 2015-11-16T00:02:02Z | 2020-06-24T18:30:57Z |
Datetime resolution coercion | diff --git a/doc/source/whatsnew/v0.16.2.txt b/doc/source/whatsnew/v0.16.2.txt
index 9421ab0f841ac..2479e8aac8fd6 100644
--- a/doc/source/whatsnew/v0.16.2.txt
+++ b/doc/source/whatsnew/v0.16.2.txt
@@ -152,3 +152,4 @@ Bug Fixes
- Bug to handle masking empty ``DataFrame``(:issue:`10126`)
- Bug where MySQL interface could not handle numeric table/column names (:issue:`10255`)
+- Bug where ``read_csv`` and similar failed if making ``MultiIndex`` and ``date_parser`` returned ``datetime64`` array of other time resolution than ``[ns]``.
diff --git a/pandas/io/parsers.py b/pandas/io/parsers.py
index 59ecb29146315..d4c19ce5e339c 100755
--- a/pandas/io/parsers.py
+++ b/pandas/io/parsers.py
@@ -2057,18 +2057,20 @@ def converter(*date_cols):
infer_datetime_format=infer_datetime_format
)
except:
- return lib.try_parse_dates(strs, dayfirst=dayfirst)
+ return tools.to_datetime(
+ lib.try_parse_dates(strs, dayfirst=dayfirst))
else:
try:
- result = date_parser(*date_cols)
+ result = tools.to_datetime(date_parser(*date_cols))
if isinstance(result, datetime.datetime):
raise Exception('scalar parser')
return result
except Exception:
try:
- return lib.try_parse_dates(_concat_date_cols(date_cols),
- parser=date_parser,
- dayfirst=dayfirst)
+ return tools.to_datetime(
+ lib.try_parse_dates(_concat_date_cols(date_cols),
+ parser=date_parser,
+ dayfirst=dayfirst))
except Exception:
return generic_parser(date_parser, *date_cols)
diff --git a/pandas/io/tests/test_date_converters.py b/pandas/io/tests/test_date_converters.py
index ee537d94c4013..2b23556706f0c 100644
--- a/pandas/io/tests/test_date_converters.py
+++ b/pandas/io/tests/test_date_converters.py
@@ -11,7 +11,7 @@
import numpy as np
from numpy.testing.decorators import slow
-from pandas import DataFrame, Series, Index, isnull
+from pandas import DataFrame, Series, Index, MultiIndex, isnull
import pandas.io.parsers as parsers
from pandas.io.parsers import (read_csv, read_table, read_fwf,
TextParser)
@@ -119,6 +119,31 @@ def test_generic(self):
self.assertIn('ym', df)
self.assertEqual(df.ym.ix[0], date(2001, 1, 1))
+ def test_dateparser_resolution_if_not_ns(self):
+ # issue 10245
+ data = """\
+date,time,prn,rxstatus
+2013-11-03,19:00:00,126,00E80000
+2013-11-03,19:00:00,23,00E80000
+2013-11-03,19:00:00,13,00E80000
+"""
+
+ def date_parser(date, time):
+ datetime = np.array(date + 'T' + time + 'Z', dtype='datetime64[s]')
+ return datetime
+
+ df = read_csv(StringIO(data), date_parser=date_parser,
+ parse_dates={'datetime': ['date', 'time']},
+ index_col=['datetime', 'prn'])
+
+ datetimes = np.array(['2013-11-03T19:00:00Z']*3, dtype='datetime64[s]')
+ df_correct = DataFrame(data={'rxstatus': ['00E80000']*3},
+ index=MultiIndex.from_tuples(
+ [(datetimes[0], 126),
+ (datetimes[1], 23),
+ (datetimes[2], 13)],
+ names=['datetime', 'prn']))
+ assert_frame_equal(df, df_correct)
if __name__ == '__main__':
import nose
| Fixes #10245
Without this fix, if the `date_parse` function passed to e.g. `read_csv` outputs a `np.datetime64` array, then it must be of `ns` resolution. With this fix, all time resolutions may be used.
| https://api.github.com/repos/pandas-dev/pandas/pulls/10249 | 2015-06-02T12:00:16Z | 2015-06-08T13:28:39Z | 2015-06-08T13:28:39Z | 2015-06-08T13:50:57Z |
Added link to aggregation and plotting time series | diff --git a/doc/source/cookbook.rst b/doc/source/cookbook.rst
index f69f926296020..49ff987ca3549 100644
--- a/doc/source/cookbook.rst
+++ b/doc/source/cookbook.rst
@@ -745,6 +745,9 @@ Timeseries
`Vectorized Lookup
<http://stackoverflow.com/questions/13893227/vectorized-look-up-of-values-in-pandas-dataframe>`__
+`Aggregation and plotting time series
+<http://nipunbatra.github.io/2015/06/timeseries/>`__
+
Turn a matrix with hours in columns and days in rows into a continuous row sequence in the form of a time series.
`How to rearrange a python pandas DataFrame?
<http://stackoverflow.com/questions/15432659/how-to-rearrange-a-python-pandas-dataframe>`__
| https://api.github.com/repos/pandas-dev/pandas/pulls/10248 | 2015-06-02T09:52:26Z | 2015-07-28T21:59:19Z | 2015-07-28T21:59:19Z | 2015-07-28T21:59:23Z | |
BUG: GH10209 fix bug where date_format in to_csv is sometimes ignored | diff --git a/doc/source/whatsnew/v0.17.0.txt b/doc/source/whatsnew/v0.17.0.txt
index f96a2954f98a2..3d27e840232f7 100644
--- a/doc/source/whatsnew/v0.17.0.txt
+++ b/doc/source/whatsnew/v0.17.0.txt
@@ -95,3 +95,7 @@ Bug Fixes
- Bug where infer_freq infers timerule (WOM-5XXX) unsupported by to_offset (:issue:`9425`)
+
+- Bug in ``to_csv`` where ``data_format`` is ignored if the ``datetime`` is not
+an integral date value (i.e. it is fractional) (:issue:`10209`)
+
diff --git a/pandas/core/format.py b/pandas/core/format.py
index 3ab41ded1deea..429051b5815fa 100644
--- a/pandas/core/format.py
+++ b/pandas/core/format.py
@@ -2114,7 +2114,7 @@ def _get_format_datetime64_from_values(values, date_format):
is_dates_only = _is_dates_only(values)
if is_dates_only:
return date_format or "%Y-%m-%d"
- return None
+ return date_format
class Timedelta64Formatter(GenericArrayFormatter):
diff --git a/pandas/tests/test_format.py b/pandas/tests/test_format.py
index a7129bca59a7f..4d21190e7a50d 100644
--- a/pandas/tests/test_format.py
+++ b/pandas/tests/test_format.py
@@ -2449,6 +2449,27 @@ def test_to_csv_decimal(self):
expected_float_format = ';col1;col2;col3\n0;1;a;10,10\n'
self.assertEqual(df.to_csv(decimal=',',sep=';', float_format = '%.2f'), expected_float_format)
+ def test_to_csv_date_format(self):
+ # GH 10209
+ df_sec = DataFrame({'A': pd.date_range('20130101',periods=5,freq='s')})
+ df_day = DataFrame({'A': pd.date_range('20130101',periods=5,freq='d')})
+
+ expected_default_sec = ',A\n0,2013-01-01 00:00:00\n1,2013-01-01 00:00:01\n2,2013-01-01 00:00:02' + \
+ '\n3,2013-01-01 00:00:03\n4,2013-01-01 00:00:04\n'
+ self.assertEqual(df_sec.to_csv(), expected_default_sec)
+
+ expected_ymdhms_day = ',A\n0,2013-01-01 00:00:00\n1,2013-01-02 00:00:00\n2,2013-01-03 00:00:00' + \
+ '\n3,2013-01-04 00:00:00\n4,2013-01-05 00:00:00\n'
+ self.assertEqual(df_day.to_csv(date_format='%Y-%m-%d %H:%M:%S'), expected_ymdhms_day)
+
+ expected_ymd_sec = ',A\n0,2013-01-01\n1,2013-01-01\n2,2013-01-01\n3,2013-01-01\n4,2013-01-01\n'
+ self.assertEqual(df_sec.to_csv(date_format='%Y-%m-%d'), expected_ymd_sec)
+
+ expected_default_day = ',A\n0,2013-01-01\n1,2013-01-02\n2,2013-01-03\n3,2013-01-04\n4,2013-01-05\n'
+ self.assertEqual(df_day.to_csv(), expected_default_day)
+ self.assertEqual(df_day.to_csv(date_format='%Y-%m-%d'), expected_default_day)
+
+
class TestSeriesFormatting(tm.TestCase):
_multiprocess_can_split_ = True
| closes #10209
When datetimes are not dates only i.e. have fractional day values, date_format passed to to_csv is ignored.
| https://api.github.com/repos/pandas-dev/pandas/pulls/10247 | 2015-06-02T06:13:50Z | 2015-06-05T21:45:43Z | null | 2015-06-05T21:45:43Z |
ENH: GH9746 DataFrame.unstack and Series.unstack now take fill_value … | diff --git a/doc/source/reshaping.rst b/doc/source/reshaping.rst
index dbf3b838593a9..f3990faec9e1a 100644
--- a/doc/source/reshaping.rst
+++ b/doc/source/reshaping.rst
@@ -228,6 +228,27 @@ which level in the columns to stack:
df2.stack('exp')
df2.stack('animal')
+Unstacking can result in missing values if subgroups do not have the same
+set of labels. By default, missing values will be replaced with the default
+fill value for that data type, ``NaN`` for float, ``NaT`` for datetimelike,
+etc. For integer types, by default data will converted to float and missing
+values will be set to ``NaN``.
+
+.. ipython:: python
+
+ df3 = df.iloc[[0, 1, 4, 7], [1, 2]]
+ df3
+ df3.unstack()
+
+.. versionadded: 0.18.0
+
+Alternatively, unstack takes an optional ``fill_value`` argument, for specifying
+the value of missing data.
+
+.. ipython:: python
+
+ df3.unstack(fill_value=-1e9)
+
With a MultiIndex
~~~~~~~~~~~~~~~~~
diff --git a/doc/source/whatsnew/v0.18.0.txt b/doc/source/whatsnew/v0.18.0.txt
index 58b60fb08920a..a4f1f0ee2e67e 100644
--- a/doc/source/whatsnew/v0.18.0.txt
+++ b/doc/source/whatsnew/v0.18.0.txt
@@ -431,6 +431,10 @@ Other API Changes
- ``pandas.merge()`` and ``DataFrame.merge()`` will show a specific error message when trying to merge with an object that is not of type ``DataFrame`` or a subclass (:issue:`12081`)
+- ``DataFrame.unstack`` and ``Series.unstack`` now take ``fill_value`` keyword to allow direct replacement of
+ missing values when an unstack results in missing values in the resulting ``DataFrame``. As an added benefit,
+ specifying ``fill_value`` will preserve the data type of the original stacked data. (:issue:`9746`)
+
.. _whatsnew_0180.deprecations:
Deprecations
diff --git a/pandas/core/common.py b/pandas/core/common.py
index 439913a0f5b44..508765896e275 100644
--- a/pandas/core/common.py
+++ b/pandas/core/common.py
@@ -1127,6 +1127,12 @@ def _maybe_promote(dtype, fill_value=np.nan):
# the proper thing to do here would probably be to upcast
# to object (but numpy 1.6.1 doesn't do this properly)
fill_value = tslib.iNaT
+ elif issubclass(dtype.type, np.timedelta64):
+ try:
+ fill_value = lib.Timedelta(fill_value).value
+ except:
+ # as for datetimes, cannot upcast to object
+ fill_value = tslib.iNaT
else:
fill_value = tslib.iNaT
elif is_datetimetz(dtype):
@@ -1153,6 +1159,16 @@ def _maybe_promote(dtype, fill_value=np.nan):
dtype = np.object_
elif issubclass(dtype.type, (np.integer, np.floating)):
dtype = np.complex128
+ elif fill_value is None:
+ if is_float_dtype(dtype) or is_complex_dtype(dtype):
+ fill_value = np.nan
+ elif is_integer_dtype(dtype):
+ dtype = np.float64
+ fill_value = np.nan
+ elif is_datetime_or_timedelta_dtype(dtype):
+ fill_value = tslib.iNaT
+ else:
+ dtype = np.object_
else:
dtype = np.object_
diff --git a/pandas/core/frame.py b/pandas/core/frame.py
index 17092b7be9f62..41a4cd0d77508 100644
--- a/pandas/core/frame.py
+++ b/pandas/core/frame.py
@@ -3851,7 +3851,7 @@ def stack(self, level=-1, dropna=True):
else:
return stack(self, level, dropna=dropna)
- def unstack(self, level=-1):
+ def unstack(self, level=-1, fill_value=None):
"""
Pivot a level of the (necessarily hierarchical) index labels, returning
a DataFrame having a new level of column labels whose inner-most level
@@ -3864,6 +3864,10 @@ def unstack(self, level=-1):
----------
level : int, string, or list of these, default -1 (last level)
Level(s) of index to unstack, can pass level name
+ fill_value : replace NaN with this value if the unstack produces
+ missing values
+
+ .. versionadded: 0.18.0
See also
--------
@@ -3905,7 +3909,7 @@ def unstack(self, level=-1):
unstacked : DataFrame or Series
"""
from pandas.core.reshape import unstack
- return unstack(self, level)
+ return unstack(self, level, fill_value)
# ----------------------------------------------------------------------
# Time series-related
diff --git a/pandas/core/reshape.py b/pandas/core/reshape.py
index 4dffaa0b0c416..05257dd0ac625 100644
--- a/pandas/core/reshape.py
+++ b/pandas/core/reshape.py
@@ -60,7 +60,8 @@ class _Unstacker(object):
unstacked : DataFrame
"""
- def __init__(self, values, index, level=-1, value_columns=None):
+ def __init__(self, values, index, level=-1, value_columns=None,
+ fill_value=None):
self.is_categorical = None
if values.ndim == 1:
@@ -70,6 +71,7 @@ def __init__(self, values, index, level=-1, value_columns=None):
values = values[:, np.newaxis]
self.values = values
self.value_columns = value_columns
+ self.fill_value = fill_value
if value_columns is None and values.shape[1] != 1: # pragma: no cover
raise ValueError('must pass column labels for multi-column data')
@@ -178,7 +180,7 @@ def get_new_values(self):
dtype = values.dtype
new_values = np.empty(result_shape, dtype=dtype)
else:
- dtype, fill_value = _maybe_promote(values.dtype)
+ dtype, fill_value = _maybe_promote(values.dtype, self.fill_value)
new_values = np.empty(result_shape, dtype=dtype)
new_values.fill(fill_value)
@@ -389,21 +391,22 @@ def _slow_pivot(index, columns, values):
return DataFrame(tree)
-def unstack(obj, level):
+def unstack(obj, level, fill_value=None):
if isinstance(level, (tuple, list)):
return _unstack_multiple(obj, level)
if isinstance(obj, DataFrame):
if isinstance(obj.index, MultiIndex):
- return _unstack_frame(obj, level)
+ return _unstack_frame(obj, level, fill_value=fill_value)
else:
return obj.T.stack(dropna=False)
else:
- unstacker = _Unstacker(obj.values, obj.index, level=level)
+ unstacker = _Unstacker(obj.values, obj.index, level=level,
+ fill_value=fill_value)
return unstacker.get_result()
-def _unstack_frame(obj, level):
+def _unstack_frame(obj, level, fill_value=None):
from pandas.core.internals import BlockManager, make_block
if obj._is_mixed_type:
@@ -419,7 +422,8 @@ def _unstack_frame(obj, level):
for blk in obj._data.blocks:
blk_items = obj._data.items[blk.mgr_locs.indexer]
bunstacker = _Unstacker(blk.values.T, obj.index, level=level,
- value_columns=blk_items)
+ value_columns=blk_items,
+ fill_value=fill_value)
new_items = bunstacker.get_new_columns()
new_placement = new_columns.get_indexer(new_items)
new_values, mask = bunstacker.get_new_values()
@@ -435,7 +439,8 @@ def _unstack_frame(obj, level):
return result.ix[:, mask_frame.sum(0) > 0]
else:
unstacker = _Unstacker(obj.values, obj.index, level=level,
- value_columns=obj.columns)
+ value_columns=obj.columns,
+ fill_value=fill_value)
return unstacker.get_result()
diff --git a/pandas/core/series.py b/pandas/core/series.py
index 699a0ca66f5f9..49182951c0e9d 100644
--- a/pandas/core/series.py
+++ b/pandas/core/series.py
@@ -2003,7 +2003,7 @@ def reorder_levels(self, order):
result.index = result.index.reorder_levels(order)
return result
- def unstack(self, level=-1):
+ def unstack(self, level=-1, fill_value=None):
"""
Unstack, a.k.a. pivot, Series with MultiIndex to produce DataFrame.
The level involved will automatically get sorted.
@@ -2012,6 +2012,10 @@ def unstack(self, level=-1):
----------
level : int, string, or list of these, default last level
Level(s) to unstack, can pass level name
+ fill_value : replace NaN with this value if the unstack produces
+ missing values
+
+ .. versionadded: 0.18.0
Examples
--------
@@ -2036,7 +2040,7 @@ def unstack(self, level=-1):
unstacked : DataFrame
"""
from pandas.core.reshape import unstack
- return unstack(self, level)
+ return unstack(self, level, fill_value)
# ----------------------------------------------------------------------
# function application
diff --git a/pandas/tests/frame/test_reshape.py b/pandas/tests/frame/test_reshape.py
index c030a6a71c7b8..c0963d885a08d 100644
--- a/pandas/tests/frame/test_reshape.py
+++ b/pandas/tests/frame/test_reshape.py
@@ -10,7 +10,7 @@
import numpy as np
from pandas.compat import u
-from pandas import DataFrame, Index, Series, MultiIndex, date_range
+from pandas import DataFrame, Index, Series, MultiIndex, date_range, Timedelta, Period
import pandas as pd
from pandas.util.testing import (assert_series_equal,
@@ -136,6 +136,141 @@ def test_stack_unstack(self):
assert_frame_equal(unstacked_cols.T, self.frame)
assert_frame_equal(unstacked_cols_df['bar'].T, self.frame)
+ def test_unstack_fill(self):
+
+ # GH #9746: fill_value keyword argument for Series
+ # and DataFrame unstack
+
+ # From a series
+ data = Series([1, 2, 4, 5], dtype=np.int16)
+ data.index = MultiIndex.from_tuples(
+ [('x', 'a'), ('x', 'b'), ('y', 'b'), ('z', 'a')])
+
+ result = data.unstack(fill_value=-1)
+ expected = DataFrame({'a': [1, -1, 5], 'b': [2, 4, -1]},
+ index=['x', 'y', 'z'], dtype=np.int16)
+ assert_frame_equal(result, expected)
+
+ # From a series with incorrect data type for fill_value
+ result = data.unstack(fill_value=0.5)
+ expected = DataFrame({'a': [1, 0.5, 5], 'b': [2, 4, 0.5]},
+ index=['x', 'y', 'z'], dtype=np.float)
+ assert_frame_equal(result, expected)
+
+ # From a dataframe
+ rows = [[1, 2], [3, 4], [5, 6], [7, 8]]
+ df = DataFrame(rows, columns=list('AB'), dtype=np.int32)
+ df.index = MultiIndex.from_tuples(
+ [('x', 'a'), ('x', 'b'), ('y', 'b'), ('z', 'a')])
+
+ result = df.unstack(fill_value=-1)
+
+ rows = [[1, 3, 2, 4], [-1, 5, -1, 6], [7, -1, 8, -1]]
+ expected = DataFrame(rows, index=list('xyz'), dtype=np.int32)
+ expected.columns = MultiIndex.from_tuples(
+ [('A', 'a'), ('A', 'b'), ('B', 'a'), ('B', 'b')])
+ assert_frame_equal(result, expected)
+
+ # From a mixed type dataframe
+ df['A'] = df['A'].astype(np.int16)
+ df['B'] = df['B'].astype(np.float64)
+
+ result = df.unstack(fill_value=-1)
+ expected['A'] = expected['A'].astype(np.int16)
+ expected['B'] = expected['B'].astype(np.float64)
+ assert_frame_equal(result, expected)
+
+ # From a dataframe with incorrect data type for fill_value
+ result = df.unstack(fill_value=0.5)
+
+ rows = [[1, 3, 2, 4], [0.5, 5, 0.5, 6], [7, 0.5, 8, 0.5]]
+ expected = DataFrame(rows, index=list('xyz'), dtype=np.float)
+ expected.columns = MultiIndex.from_tuples(
+ [('A', 'a'), ('A', 'b'), ('B', 'a'), ('B', 'b')])
+ assert_frame_equal(result, expected)
+
+ # Test unstacking with date times
+ dv = pd.date_range('2012-01-01', periods=4).values
+ data = Series(dv)
+ data.index = MultiIndex.from_tuples(
+ [('x', 'a'), ('x', 'b'), ('y', 'b'), ('z', 'a')])
+
+ result = data.unstack()
+ expected = DataFrame({'a': [dv[0], pd.NaT, dv[3]],
+ 'b': [dv[1], dv[2], pd.NaT]},
+ index=['x', 'y', 'z'])
+ assert_frame_equal(result, expected)
+
+ result = data.unstack(fill_value=dv[0])
+ expected = DataFrame({'a': [dv[0], dv[0], dv[3]],
+ 'b': [dv[1], dv[2], dv[0]]},
+ index=['x', 'y', 'z'])
+ assert_frame_equal(result, expected)
+
+ # Test unstacking with time deltas
+ td = [Timedelta(days=i) for i in range(4)]
+ data = Series(td)
+ data.index = MultiIndex.from_tuples(
+ [('x', 'a'), ('x', 'b'), ('y', 'b'), ('z', 'a')])
+
+ result = data.unstack()
+ expected = DataFrame({'a': [td[0], pd.NaT, td[3]],
+ 'b': [td[1], td[2], pd.NaT]},
+ index=['x', 'y', 'z'])
+ assert_frame_equal(result, expected)
+
+ result = data.unstack(fill_value=td[1])
+ expected = DataFrame({'a': [td[0], td[1], td[3]],
+ 'b': [td[1], td[2], td[1]]},
+ index=['x', 'y', 'z'])
+ assert_frame_equal(result, expected)
+
+ # Test unstacking with period
+ periods = [Period('2012-01'), Period('2012-02'), Period('2012-03'),
+ Period('2012-04')]
+ data = Series(periods)
+ data.index = MultiIndex.from_tuples(
+ [('x', 'a'), ('x', 'b'), ('y', 'b'), ('z', 'a')])
+
+ result = data.unstack()
+ expected = DataFrame({'a': [periods[0], None, periods[3]],
+ 'b': [periods[1], periods[2], None]},
+ index=['x', 'y', 'z'])
+ assert_frame_equal(result, expected)
+
+ result = data.unstack(fill_value=periods[1])
+ expected = DataFrame({'a': [periods[0], periods[1], periods[3]],
+ 'b': [periods[1], periods[2], periods[1]]},
+ index=['x', 'y', 'z'])
+ assert_frame_equal(result, expected)
+
+ # Test unstacking with categorical
+ data = pd.Series(['a', 'b', 'c', 'a'], dtype='category')
+ data.index = pd.MultiIndex.from_tuples(
+ [('x', 'a'), ('x', 'b'), ('y', 'b'), ('z', 'a')])
+
+ # By default missing values will be NaN
+ result = data.unstack()
+ expected = DataFrame({'a': pd.Categorical(list('axa'),
+ categories=list('abc')),
+ 'b': pd.Categorical(list('bcx'),
+ categories=list('abc'))},
+ index=list('xyz'))
+ assert_frame_equal(result, expected)
+
+ # Fill with non-category results in NaN entries similar to above
+ result = data.unstack(fill_value='d')
+ assert_frame_equal(result, expected)
+
+ # Fill with category value replaces missing values as expected
+ result = data.unstack(fill_value='c')
+ expected = DataFrame({'a': pd.Categorical(list('aca'),
+ categories=list('abc')),
+ 'b': pd.Categorical(list('bcc'),
+ categories=list('abc'))},
+ index=list('xyz'))
+ assert_frame_equal(result, expected)
+
def test_stack_ints(self):
df = DataFrame(
np.random.randn(30, 27),
| …kw for filling NaN when unstack results in a sparse DataFrame
closes #9746
| https://api.github.com/repos/pandas-dev/pandas/pulls/10246 | 2015-06-01T19:36:24Z | 2016-01-30T19:27:56Z | null | 2016-01-30T19:29:48Z |
wide table support | diff --git a/pandas/io/pytables.py b/pandas/io/pytables.py
index 8ef6363f836ae..80037f0b891ef 100644
--- a/pandas/io/pytables.py
+++ b/pandas/io/pytables.py
@@ -11,7 +11,8 @@
import itertools
import warnings
import os
-
+from six import string_types
+from tables.exceptions import NoSuchNodeError
import numpy as np
from pandas import (Series, TimeSeries, DataFrame, Panel, Panel4D, Index,
MultiIndex, Int64Index, Timestamp)
@@ -1478,6 +1479,7 @@ def infer(self, handler):
"""infer this column from the table: create and return a new object"""
table = handler.table
new_self = self.copy()
+ new_self._handle = handler._handle
new_self.set_table(table)
new_self.get_attr()
new_self.read_metadata(handler)
@@ -1557,6 +1559,7 @@ def validate_names(self):
pass
def validate_and_set(self, handler, append, **kwargs):
+ self._handle = handler._handle
self.set_table(handler.table)
self.validate_col()
self.validate_attr(append)
@@ -2094,13 +2097,22 @@ def convert(self, values, nan_rep, encoding):
def get_attr(self):
""" get the data for this colummn """
self.values = getattr(self.attrs, self.kind_attr, None)
+ if self.values is None:
+ try:
+ self.values = self._handle.get_node(self.attrs._v_node._v_parent,
+ self.kind_attr)[:].tolist()
+ except NoSuchNodeError:
+ pass
self.dtype = getattr(self.attrs, self.dtype_attr, None)
self.meta = getattr(self.attrs, self.meta_attr, None)
self.set_kind()
def set_attr(self):
""" set the data for this colummn """
- setattr(self.attrs, self.kind_attr, self.values)
+ #setattr(self.attrs, self.kind_attr, self.values)
+ self._handle.create_carray(self.attrs._v_node._v_parent,
+ self.kind_attr,
+ obj=np.array(self.values))
setattr(self.attrs, self.meta_attr, self.meta)
if self.dtype is not None:
setattr(self.attrs, self.dtype_attr, self.dtype)
@@ -3061,12 +3073,31 @@ def set_info(self):
""" update our table index info """
self.attrs.info = self.info
+ def set_non_index_axes(self):
+ replacement = []
+ for dim, flds in self.non_index_axes:
+ name = "non_index_axes_%d" % dim
+ self._handle.create_carray(self.attrs._v_node, name, obj=np.array(flds))
+ replacement.append((dim, name))
+ self.attrs.non_index_axes = replacement
+
+ def get_non_index_axes(self):
+ non_index_axes = getattr(self.attrs, 'non_index_axes', [])
+ new = []
+ for dim, flds in non_index_axes:
+ if isinstance(flds, string_types):
+ flds = self._handle.get_node(self.attrs._v_node, flds)[:].tolist()
+ new.append((dim, flds))
+ return new
+
def set_attrs(self):
""" set our table type & indexables """
self.attrs.table_type = str(self.table_type)
self.attrs.index_cols = self.index_cols()
self.attrs.values_cols = self.values_cols()
- self.attrs.non_index_axes = self.non_index_axes
+
+ #self.attrs.non_index_axes = self.non_index_axes
+ self.set_non_index_axes()
self.attrs.data_columns = self.data_columns
self.attrs.nan_rep = self.nan_rep
self.attrs.encoding = self.encoding
@@ -3076,8 +3107,7 @@ def set_attrs(self):
def get_attrs(self):
""" retrieve our attributes """
- self.non_index_axes = getattr(
- self.attrs, 'non_index_axes', None) or []
+ self.non_index_axes = self.get_non_index_axes()
self.data_columns = getattr(
self.attrs, 'data_columns', None) or []
self.info = getattr(
| addresses #6245
@jreback this isn't quite working yet for older arrays - the reason is because I have to address values_block_kind_0 and things like that. Currently what I'm doing is creating a group under `self.group` of the Table class, named 'attr', which has all the attributes as CArrays. However the issue is that values_block_kind_0 is actually written as an attr of the table dataset, not the group. I can definitely setup the code to read that stuff for backwards compatability, but is it ok if I put all carray attrs as datasets under the attr group, or is there some namespace collisioning that I'm not aware of?
| https://api.github.com/repos/pandas-dev/pandas/pulls/10243 | 2015-05-31T14:55:02Z | 2015-11-25T15:44:00Z | null | 2015-12-07T17:40:51Z |
BUG: SparseSeries.abs() resets name | diff --git a/doc/source/whatsnew/v0.17.0.txt b/doc/source/whatsnew/v0.17.0.txt
index 9b87c6c1332ab..dd151682339e1 100644
--- a/doc/source/whatsnew/v0.17.0.txt
+++ b/doc/source/whatsnew/v0.17.0.txt
@@ -83,7 +83,7 @@ Bug Fixes
- Bug in `plot` not defaulting to matplotlib `axes.grid` setting (:issue:`9792`)
- Bug in ``Series.align`` resets ``name`` when ``fill_value`` is specified (:issue:`10067`)
-
+- Bug in ``SparseSeries.abs`` resets ``name`` (:issue:`10241`)
- Bug in GroupBy.get_group raises ValueError when group key contains NaT (:issue:`6992`)
diff --git a/pandas/sparse/series.py b/pandas/sparse/series.py
index 2c328e51b5090..f53cc66bee961 100644
--- a/pandas/sparse/series.py
+++ b/pandas/sparse/series.py
@@ -399,7 +399,7 @@ def abs(self):
res_sp_values = np.abs(self.sp_values)
return self._constructor(res_sp_values, index=self.index,
sparse_index=self.sp_index,
- fill_value=self.fill_value)
+ fill_value=self.fill_value).__finalize__(self)
def get(self, label, default=None):
"""
diff --git a/pandas/sparse/tests/test_sparse.py b/pandas/sparse/tests/test_sparse.py
index dd1d10f3d15ed..a7a78ba226a0b 100644
--- a/pandas/sparse/tests/test_sparse.py
+++ b/pandas/sparse/tests/test_sparse.py
@@ -509,6 +509,21 @@ def _check_inplace_op(iop, op):
_check_inplace_op(
getattr(operator, "i%s" % op), getattr(operator, op))
+ def test_abs(self):
+ s = SparseSeries([1, 2, -3], name='x')
+ expected = SparseSeries([1, 2, 3], name='x')
+ result = s.abs()
+ assert_sp_series_equal(result, expected)
+ self.assertEqual(result.name, 'x')
+
+ result = abs(s)
+ assert_sp_series_equal(result, expected)
+ self.assertEqual(result.name, 'x')
+
+ result = np.abs(s)
+ assert_sp_series_equal(result, expected)
+ self.assertEqual(result.name, 'x')
+
def test_reindex(self):
def _compare_with_series(sps, new_index):
spsre = sps.reindex(new_index)
diff --git a/pandas/tests/test_panel.py b/pandas/tests/test_panel.py
index d7d83887298b1..57fd465993e14 100644
--- a/pandas/tests/test_panel.py
+++ b/pandas/tests/test_panel.py
@@ -404,6 +404,8 @@ def test_abs(self):
expected = np.abs(s)
assert_series_equal(result, expected)
assert_series_equal(result2, expected)
+ self.assertEqual(result.name, 'A')
+ self.assertEqual(result2.name, 'A')
class CheckIndexing(object):
| ```
# OK: name is preserved
s = pd.Series([1, 2, -3], name='a')
s.abs()
#0 1
#1 2
#2 3
# Name: a, dtype: int64
# NG: name is reset
s = pd.SparseSeries([1, 0, -3], name='a')
s.name
# 'a'
s.abs()
#0 1
#1 0
#2 3
# dtype: int64
# BlockIndex
# Block locations: array([0], dtype=int32)
# Block lengths: array([3], dtype=int32)
```
| https://api.github.com/repos/pandas-dev/pandas/pulls/10241 | 2015-05-30T21:47:52Z | 2015-06-02T10:39:04Z | 2015-06-02T10:39:04Z | 2015-06-02T19:26:12Z |
BUG: Series arithmetic methods incorrectly hold name | diff --git a/doc/source/whatsnew/v0.17.0.txt b/doc/source/whatsnew/v0.17.0.txt
index 9b87c6c1332ab..842d7cf84e05a 100644
--- a/doc/source/whatsnew/v0.17.0.txt
+++ b/doc/source/whatsnew/v0.17.0.txt
@@ -73,7 +73,7 @@ Bug Fixes
- Bug in getting timezone data with ``dateutil`` on various platforms ( :issue:`9059`, :issue:`8639`, :issue:`9663`, :issue:`10121`)
- Bug in display datetimes with mixed frequencies uniformly; display 'ms' datetimes to the proper precision. (:issue:`10170`)
-
+- Bung in ``Series`` arithmetic methods may incorrectly hold names (:issue:`10068`)
- Bug in ``DatetimeIndex`` and ``TimedeltaIndex`` names are lost after timedelta arithmetics ( :issue:`9926`)
diff --git a/pandas/core/series.py b/pandas/core/series.py
index 6367fb4fe0396..c54bd96f64c73 100644
--- a/pandas/core/series.py
+++ b/pandas/core/series.py
@@ -1508,7 +1508,12 @@ def _binop(self, other, func, level=None, fill_value=None):
result = func(this_vals, other_vals)
name = _maybe_match_name(self, other)
- return self._constructor(result, index=new_index).__finalize__(self)
+ result = self._constructor(result, index=new_index, name=name)
+ result = result.__finalize__(self)
+ if name is None:
+ # When name is None, __finalize__ overwrites current name
+ result.name = None
+ return result
def combine(self, other, func, fill_value=nan):
"""
diff --git a/pandas/tests/test_series.py b/pandas/tests/test_series.py
index 5a5b5fa2b226b..bbe942e607faf 100644
--- a/pandas/tests/test_series.py
+++ b/pandas/tests/test_series.py
@@ -264,10 +264,11 @@ def test_tab_completion(self):
self.assertTrue('dt' not in dir(s))
def test_binop_maybe_preserve_name(self):
-
# names match, preserve
result = self.ts * self.ts
self.assertEqual(result.name, self.ts.name)
+ result = self.ts.mul(self.ts)
+ self.assertEqual(result.name, self.ts.name)
result = self.ts * self.ts[:-2]
self.assertEqual(result.name, self.ts.name)
@@ -277,6 +278,22 @@ def test_binop_maybe_preserve_name(self):
cp.name = 'something else'
result = self.ts + cp
self.assertIsNone(result.name)
+ result = self.ts.add(cp)
+ self.assertIsNone(result.name)
+
+ ops = ['add', 'sub', 'mul', 'div', 'truediv', 'floordiv', 'mod', 'pow']
+ ops = ops + ['r' + op for op in ops]
+ for op in ops:
+ # names match, preserve
+ s = self.ts.copy()
+ result = getattr(s, op)(s)
+ self.assertEqual(result.name, self.ts.name)
+
+ # names don't match, don't preserve
+ cp = self.ts.copy()
+ cp.name = 'changed'
+ result = getattr(s, op)(cp)
+ self.assertIsNone(result.name)
def test_combine_first_name(self):
result = self.ts.combine_first(self.ts[:5])
| Closes #10068.
Should handle the case `_maybe_match_name` is `None`, because of continuous `__finalize__`.
| https://api.github.com/repos/pandas-dev/pandas/pulls/10240 | 2015-05-30T21:14:49Z | 2015-06-02T10:38:48Z | 2015-06-02T10:38:48Z | 2015-06-02T19:26:12Z |
ENH: duplicated and drop_duplicates now accept keep kw | diff --git a/doc/source/indexing.rst b/doc/source/indexing.rst
index 9f58ee2f8b99b..251d94cbdd911 100644
--- a/doc/source/indexing.rst
+++ b/doc/source/indexing.rst
@@ -1178,8 +1178,7 @@ takes as an argument the columns to use to identify duplicated rows.
- ``drop_duplicates`` removes duplicate rows.
By default, the first observed row of a duplicate set is considered unique, but
-each method has a ``take_last`` parameter that indicates the last observed row
-should be taken instead.
+each method has a ``keep`` parameter to specify targets to be kept.
.. ipython:: python
@@ -1187,8 +1186,11 @@ should be taken instead.
'b' : ['x', 'y', 'y', 'x', 'y', 'x', 'x'],
'c' : np.random.randn(7)})
df2.duplicated(['a','b'])
+ df2.duplicated(['a','b'], keep='last')
+ df2.duplicated(['a','b'], keep=False)
df2.drop_duplicates(['a','b'])
- df2.drop_duplicates(['a','b'], take_last=True)
+ df2.drop_duplicates(['a','b'], keep='last')
+ df2.drop_duplicates(['a','b'], keep=False)
An alternative way to drop duplicates on the index is ``.groupby(level=0)`` combined with ``first()`` or ``last()``.
@@ -1199,7 +1201,7 @@ An alternative way to drop duplicates on the index is ``.groupby(level=0)`` comb
df3.groupby(level=0).first()
# a bit more verbose
- df3.reset_index().drop_duplicates(subset='b', take_last=False).set_index('b')
+ df3.reset_index().drop_duplicates(subset='b', keep='first').set_index('b')
.. _indexing.dictionarylike:
diff --git a/doc/source/whatsnew/v0.17.0.txt b/doc/source/whatsnew/v0.17.0.txt
index 770ad8a268f11..e43ed5745eea3 100644
--- a/doc/source/whatsnew/v0.17.0.txt
+++ b/doc/source/whatsnew/v0.17.0.txt
@@ -142,6 +142,15 @@ Other enhancements
- ``pd.merge`` will now allow duplicate column names if they are not merged upon (:issue:`10639`).
- ``pd.pivot`` will now allow passing index as ``None`` (:issue:`3962`).
+- ``drop_duplicates`` and ``duplicated`` now accept ``keep`` keyword to target first, last, and all duplicates. ``take_last`` keyword is deprecated, see :ref:`deprecations <whatsnew_0170.deprecations>` (:issue:`6511`, :issue:`8505`)
+
+.. ipython :: python
+
+ s = pd.Series(['A', 'B', 'C', 'A', 'B', 'D'])
+ s.drop_duplicates()
+ s.drop_duplicates(keep='last')
+ s.drop_duplicates(keep=False)
+
.. _whatsnew_0170.api:
@@ -520,6 +529,7 @@ Deprecations
===================== =================================
- ``Categorical.name`` was deprecated to make ``Categorical`` more ``numpy.ndarray`` like. Use ``Series(cat, name="whatever")`` instead (:issue:`10482`).
+- ``drop_duplicates`` and ``duplicated``'s ``take_last`` keyword was removed in favor of ``keep``. (:issue:`6511`, :issue:`8505`)
.. _whatsnew_0170.prior_deprecations:
diff --git a/pandas/core/base.py b/pandas/core/base.py
index c3004aec60cc5..6d1c89a7a2f89 100644
--- a/pandas/core/base.py
+++ b/pandas/core/base.py
@@ -6,7 +6,7 @@
from pandas.core import common as com
import pandas.core.nanops as nanops
import pandas.lib as lib
-from pandas.util.decorators import Appender, cache_readonly
+from pandas.util.decorators import Appender, cache_readonly, deprecate_kwarg
from pandas.core.strings import StringMethods
from pandas.core.common import AbstractMethodError
@@ -543,8 +543,12 @@ def _dir_deletions(self):
Parameters
----------
- take_last : boolean, default False
- Take the last observed index in a group. Default first
+
+ keep : {'first', 'last', False}, default 'first'
+ - ``first`` : Drop duplicates except for the first occurrence.
+ - ``last`` : Drop duplicates except for the last occurrence.
+ - False : Drop all duplicates.
+ take_last : deprecated
%(inplace)s
Returns
@@ -552,9 +556,10 @@ def _dir_deletions(self):
deduplicated : %(klass)s
""")
+ @deprecate_kwarg('take_last', 'keep', mapping={True: 'last', False: 'first'})
@Appender(_shared_docs['drop_duplicates'] % _indexops_doc_kwargs)
- def drop_duplicates(self, take_last=False, inplace=False):
- duplicated = self.duplicated(take_last=take_last)
+ def drop_duplicates(self, keep='first', inplace=False):
+ duplicated = self.duplicated(keep=keep)
result = self[np.logical_not(duplicated)]
if inplace:
return self._update_inplace(result)
@@ -566,18 +571,22 @@ def drop_duplicates(self, take_last=False, inplace=False):
Parameters
----------
- take_last : boolean, default False
- Take the last observed index in a group. Default first
+ keep : {'first', 'last', False}, default 'first'
+ - ``first`` : Mark duplicates as ``True`` except for the first occurrence.
+ - ``last`` : Mark duplicates as ``True`` except for the last occurrence.
+ - False : Mark all duplicates as ``True``.
+ take_last : deprecated
Returns
-------
duplicated : %(duplicated)s
""")
+ @deprecate_kwarg('take_last', 'keep', mapping={True: 'last', False: 'first'})
@Appender(_shared_docs['duplicated'] % _indexops_doc_kwargs)
- def duplicated(self, take_last=False):
+ def duplicated(self, keep='first'):
keys = com._ensure_object(self.values)
- duplicated = lib.duplicated(keys, take_last=take_last)
+ duplicated = lib.duplicated(keys, keep=keep)
try:
return self._constructor(duplicated,
index=self.index).__finalize__(self)
diff --git a/pandas/core/frame.py b/pandas/core/frame.py
index d8948bc82fe61..fe9c9bece1f79 100644
--- a/pandas/core/frame.py
+++ b/pandas/core/frame.py
@@ -2866,8 +2866,9 @@ def dropna(self, axis=0, how='any', thresh=None, subset=None,
else:
return result
+ @deprecate_kwarg('take_last', 'keep', mapping={True: 'last', False: 'first'})
@deprecate_kwarg(old_arg_name='cols', new_arg_name='subset')
- def drop_duplicates(self, subset=None, take_last=False, inplace=False):
+ def drop_duplicates(self, subset=None, keep='first', inplace=False):
"""
Return DataFrame with duplicate rows removed, optionally only
considering certain columns
@@ -2877,8 +2878,11 @@ def drop_duplicates(self, subset=None, take_last=False, inplace=False):
subset : column label or sequence of labels, optional
Only consider certain columns for identifying duplicates, by
default use all of the columns
- take_last : boolean, default False
- Take the last observed row in a row. Defaults to the first row
+ keep : {'first', 'last', False}, default 'first'
+ - ``first`` : Drop duplicates except for the first occurrence.
+ - ``last`` : Drop duplicates except for the last occurrence.
+ - False : Drop all duplicates.
+ take_last : deprecated
inplace : boolean, default False
Whether to drop duplicates in place or to return a copy
cols : kwargs only argument of subset [deprecated]
@@ -2887,7 +2891,7 @@ def drop_duplicates(self, subset=None, take_last=False, inplace=False):
-------
deduplicated : DataFrame
"""
- duplicated = self.duplicated(subset, take_last=take_last)
+ duplicated = self.duplicated(subset, keep=keep)
if inplace:
inds, = (-duplicated).nonzero()
@@ -2896,8 +2900,9 @@ def drop_duplicates(self, subset=None, take_last=False, inplace=False):
else:
return self[-duplicated]
+ @deprecate_kwarg('take_last', 'keep', mapping={True: 'last', False: 'first'})
@deprecate_kwarg(old_arg_name='cols', new_arg_name='subset')
- def duplicated(self, subset=None, take_last=False):
+ def duplicated(self, subset=None, keep='first'):
"""
Return boolean Series denoting duplicate rows, optionally only
considering certain columns
@@ -2907,9 +2912,13 @@ def duplicated(self, subset=None, take_last=False):
subset : column label or sequence of labels, optional
Only consider certain columns for identifying duplicates, by
default use all of the columns
- take_last : boolean, default False
- For a set of distinct duplicate rows, flag all but the last row as
- duplicated. Default is for all but the first row to be flagged
+ keep : {'first', 'last', False}, default 'first'
+ - ``first`` : Mark duplicates as ``True`` except for the
+ first occurrence.
+ - ``last`` : Mark duplicates as ``True`` except for the
+ last occurrence.
+ - False : Mark all duplicates as ``True``.
+ take_last : deprecated
cols : kwargs only argument of subset [deprecated]
Returns
@@ -2935,7 +2944,7 @@ def f(vals):
labels, shape = map(list, zip( * map(f, vals)))
ids = get_group_index(labels, shape, sort=False, xnull=False)
- return Series(duplicated_int64(ids, take_last), index=self.index)
+ return Series(duplicated_int64(ids, keep), index=self.index)
#----------------------------------------------------------------------
# Sorting
diff --git a/pandas/core/index.py b/pandas/core/index.py
index a9878f493251b..0af2f1f90b53f 100644
--- a/pandas/core/index.py
+++ b/pandas/core/index.py
@@ -16,7 +16,7 @@
from pandas.lib import Timestamp, Timedelta, is_datetime_array
from pandas.core.base import PandasObject, FrozenList, FrozenNDArray, IndexOpsMixin, _shared_docs, PandasDelegate
from pandas.util.decorators import (Appender, Substitution, cache_readonly,
- deprecate)
+ deprecate, deprecate_kwarg)
import pandas.core.common as com
from pandas.core.common import (isnull, array_equivalent, is_dtype_equal, is_object_dtype,
_values_from_object, is_float, is_integer, is_iterator, is_categorical_dtype,
@@ -2623,13 +2623,15 @@ def drop(self, labels, errors='raise'):
indexer = indexer[~mask]
return self.delete(indexer)
+ @deprecate_kwarg('take_last', 'keep', mapping={True: 'last', False: 'first'})
@Appender(_shared_docs['drop_duplicates'] % _index_doc_kwargs)
- def drop_duplicates(self, take_last=False):
- return super(Index, self).drop_duplicates(take_last=take_last)
+ def drop_duplicates(self, keep='first'):
+ return super(Index, self).drop_duplicates(keep=keep)
+ @deprecate_kwarg('take_last', 'keep', mapping={True: 'last', False: 'first'})
@Appender(_shared_docs['duplicated'] % _index_doc_kwargs)
- def duplicated(self, take_last=False):
- return super(Index, self).duplicated(take_last=take_last)
+ def duplicated(self, keep='first'):
+ return super(Index, self).duplicated(keep=keep)
def _evaluate_with_timedelta_like(self, other, op, opstr):
raise TypeError("can only perform ops with timedelta like values")
@@ -3056,10 +3058,11 @@ def _engine(self):
def is_unique(self):
return not self.duplicated().any()
+ @deprecate_kwarg('take_last', 'keep', mapping={True: 'last', False: 'first'})
@Appender(_shared_docs['duplicated'] % _index_doc_kwargs)
- def duplicated(self, take_last=False):
+ def duplicated(self, keep='first'):
from pandas.hashtable import duplicated_int64
- return duplicated_int64(self.codes.astype('i8'), take_last)
+ return duplicated_int64(self.codes.astype('i8'), keep)
def get_loc(self, key, method=None):
"""
@@ -4219,15 +4222,16 @@ def _has_complex_internals(self):
def is_unique(self):
return not self.duplicated().any()
+ @deprecate_kwarg('take_last', 'keep', mapping={True: 'last', False: 'first'})
@Appender(_shared_docs['duplicated'] % _index_doc_kwargs)
- def duplicated(self, take_last=False):
+ def duplicated(self, keep='first'):
from pandas.core.groupby import get_group_index
from pandas.hashtable import duplicated_int64
shape = map(len, self.levels)
ids = get_group_index(self.labels, shape, sort=False, xnull=False)
- return duplicated_int64(ids, take_last)
+ return duplicated_int64(ids, keep)
def get_value(self, series, key):
# somewhat broken encapsulation
diff --git a/pandas/core/series.py b/pandas/core/series.py
index 6586fa10935e6..87fde996aaa67 100644
--- a/pandas/core/series.py
+++ b/pandas/core/series.py
@@ -46,7 +46,7 @@
import pandas.core.datetools as datetools
import pandas.core.format as fmt
import pandas.core.nanops as nanops
-from pandas.util.decorators import Appender, cache_readonly
+from pandas.util.decorators import Appender, cache_readonly, deprecate_kwarg
import pandas.lib as lib
import pandas.tslib as tslib
@@ -1155,14 +1155,15 @@ def mode(self):
from pandas.core.algorithms import mode
return mode(self)
+ @deprecate_kwarg('take_last', 'keep', mapping={True: 'last', False: 'first'})
@Appender(base._shared_docs['drop_duplicates'] % _shared_doc_kwargs)
- def drop_duplicates(self, take_last=False, inplace=False):
- return super(Series, self).drop_duplicates(take_last=take_last,
- inplace=inplace)
+ def drop_duplicates(self, keep='first', inplace=False):
+ return super(Series, self).drop_duplicates(keep=keep, inplace=inplace)
+ @deprecate_kwarg('take_last', 'keep', mapping={True: 'last', False: 'first'})
@Appender(base._shared_docs['duplicated'] % _shared_doc_kwargs)
- def duplicated(self, take_last=False):
- return super(Series, self).duplicated(take_last=take_last)
+ def duplicated(self, keep='first'):
+ return super(Series, self).duplicated(keep=keep)
def idxmin(self, axis=None, out=None, skipna=True):
"""
diff --git a/pandas/hashtable.pyx b/pandas/hashtable.pyx
index 3b3ea9fa032f8..7dbd1b45c938f 100644
--- a/pandas/hashtable.pyx
+++ b/pandas/hashtable.pyx
@@ -1026,25 +1026,41 @@ def mode_int64(int64_t[:] values):
@cython.wraparound(False)
@cython.boundscheck(False)
-def duplicated_int64(ndarray[int64_t, ndim=1] values, int take_last):
+def duplicated_int64(ndarray[int64_t, ndim=1] values, object keep='first'):
cdef:
- int ret = 0
+ int ret = 0, value, k
Py_ssize_t i, n = len(values)
kh_int64_t * table = kh_init_int64()
ndarray[uint8_t, ndim=1, cast=True] out = np.empty(n, dtype='bool')
kh_resize_int64(table, min(n, _SIZE_HINT_LIMIT))
- with nogil:
- if take_last:
+ if keep not in ('last', 'first', False):
+ raise ValueError('keep must be either "first", "last" or False')
+
+ if keep == 'last':
+ with nogil:
for i from n > i >=0:
kh_put_int64(table, values[i], &ret)
out[i] = ret == 0
- else:
+ elif keep == 'first':
+ with nogil:
for i from 0 <= i < n:
kh_put_int64(table, values[i], &ret)
out[i] = ret == 0
-
+ else:
+ with nogil:
+ for i from 0 <= i < n:
+ value = values[i]
+ k = kh_get_int64(table, value)
+ if k != table.n_buckets:
+ out[table.vals[k]] = 1
+ out[i] = 1
+ else:
+ k = kh_put_int64(table, value, &ret)
+ table.keys[k] = value
+ table.vals[k] = i
+ out[i] = 0
kh_destroy_int64(table)
return out
diff --git a/pandas/lib.pyx b/pandas/lib.pyx
index e839210fbbada..07f0c89535a77 100644
--- a/pandas/lib.pyx
+++ b/pandas/lib.pyx
@@ -1348,35 +1348,47 @@ def fast_zip_fillna(list ndarrays, fill_value=pandas_null):
return result
-def duplicated(ndarray[object] values, take_last=False):
+
+def duplicated(ndarray[object] values, object keep='first'):
cdef:
Py_ssize_t i, n
- set seen = set()
+ dict seen = dict()
object row
n = len(values)
cdef ndarray[uint8_t] result = np.zeros(n, dtype=np.uint8)
- if take_last:
+ if keep == 'last':
for i from n > i >= 0:
row = values[i]
-
if row in seen:
result[i] = 1
else:
- seen.add(row)
+ seen[row] = i
result[i] = 0
- else:
+ elif keep == 'first':
for i from 0 <= i < n:
row = values[i]
if row in seen:
result[i] = 1
else:
- seen.add(row)
+ seen[row] = i
result[i] = 0
+ elif keep is False:
+ for i from 0 <= i < n:
+ row = values[i]
+ if row in seen:
+ result[i] = 1
+ result[seen[row]] = 1
+ else:
+ seen[row] = i
+ result[i] = 0
+ else:
+ raise ValueError('keep must be either "first", "last" or False')
return result.view(np.bool_)
+
def generate_slices(ndarray[int64_t] labels, Py_ssize_t ngroups):
cdef:
Py_ssize_t i, group_size, n, start
diff --git a/pandas/tests/test_base.py b/pandas/tests/test_base.py
index d47e7dbe751c7..066b359d72b5c 100644
--- a/pandas/tests/test_base.py
+++ b/pandas/tests/test_base.py
@@ -683,6 +683,10 @@ def test_factorize(self):
def test_duplicated_drop_duplicates(self):
# GH 4060
+
+ import warnings
+ warnings.simplefilter('always')
+
for original in self.objs:
if isinstance(original, Index):
@@ -714,15 +718,36 @@ def test_duplicated_drop_duplicates(self):
self.assertTrue(duplicated.dtype == bool)
tm.assert_index_equal(idx.drop_duplicates(), original)
- last_base = [False] * len(idx)
- last_base[3] = True
- last_base[5] = True
- expected = np.array(last_base)
- duplicated = idx.duplicated(take_last=True)
+ base = [False] * len(idx)
+ base[3] = True
+ base[5] = True
+ expected = np.array(base)
+
+ duplicated = idx.duplicated(keep='last')
+ tm.assert_numpy_array_equal(duplicated, expected)
+ self.assertTrue(duplicated.dtype == bool)
+ result = idx.drop_duplicates(keep='last')
+ tm.assert_index_equal(result, idx[~expected])
+
+ # deprecate take_last
+ with tm.assert_produces_warning(FutureWarning):
+ duplicated = idx.duplicated(take_last=True)
+ tm.assert_numpy_array_equal(duplicated, expected)
+ self.assertTrue(duplicated.dtype == bool)
+ with tm.assert_produces_warning(FutureWarning):
+ result = idx.drop_duplicates(take_last=True)
+ tm.assert_index_equal(result, idx[~expected])
+
+ base = [False] * len(original) + [True, True]
+ base[3] = True
+ base[5] = True
+ expected = np.array(base)
+
+ duplicated = idx.duplicated(keep=False)
tm.assert_numpy_array_equal(duplicated, expected)
self.assertTrue(duplicated.dtype == bool)
- tm.assert_index_equal(idx.drop_duplicates(take_last=True),
- idx[~np.array(last_base)])
+ result = idx.drop_duplicates(keep=False)
+ tm.assert_index_equal(result, idx[~expected])
with tm.assertRaisesRegexp(TypeError,
"drop_duplicates\(\) got an unexpected keyword argument"):
@@ -745,13 +770,29 @@ def test_duplicated_drop_duplicates(self):
tm.assert_series_equal(s.duplicated(), expected)
tm.assert_series_equal(s.drop_duplicates(), original)
- last_base = [False] * len(idx)
- last_base[3] = True
- last_base[5] = True
- expected = Series(last_base, index=idx, name='a')
- tm.assert_series_equal(s.duplicated(take_last=True), expected)
- tm.assert_series_equal(s.drop_duplicates(take_last=True),
- s[~np.array(last_base)])
+ base = [False] * len(idx)
+ base[3] = True
+ base[5] = True
+ expected = Series(base, index=idx, name='a')
+
+ tm.assert_series_equal(s.duplicated(keep='last'), expected)
+ tm.assert_series_equal(s.drop_duplicates(keep='last'),
+ s[~np.array(base)])
+
+ # deprecate take_last
+ with tm.assert_produces_warning(FutureWarning):
+ tm.assert_series_equal(s.duplicated(take_last=True), expected)
+ with tm.assert_produces_warning(FutureWarning):
+ tm.assert_series_equal(s.drop_duplicates(take_last=True),
+ s[~np.array(base)])
+ base = [False] * len(original) + [True, True]
+ base[3] = True
+ base[5] = True
+ expected = Series(base, index=idx, name='a')
+
+ tm.assert_series_equal(s.duplicated(keep=False), expected)
+ tm.assert_series_equal(s.drop_duplicates(keep=False),
+ s[~np.array(base)])
s.drop_duplicates(inplace=True)
tm.assert_series_equal(s, original)
diff --git a/pandas/tests/test_frame.py b/pandas/tests/test_frame.py
index 77ef5fecf22c9..72eea5162caa5 100644
--- a/pandas/tests/test_frame.py
+++ b/pandas/tests/test_frame.py
@@ -7848,7 +7848,7 @@ def test_dropna_multiple_axes(self):
inp.dropna(how='all', axis=(0, 1), inplace=True)
assert_frame_equal(inp, expected)
- def test_drop_duplicates(self):
+ def test_aaa_drop_duplicates(self):
df = DataFrame({'AAA': ['foo', 'bar', 'foo', 'bar',
'foo', 'bar', 'bar', 'foo'],
'B': ['one', 'one', 'two', 'two',
@@ -7861,10 +7861,21 @@ def test_drop_duplicates(self):
expected = df[:2]
assert_frame_equal(result, expected)
- result = df.drop_duplicates('AAA', take_last=True)
+ result = df.drop_duplicates('AAA', keep='last')
expected = df.ix[[6, 7]]
assert_frame_equal(result, expected)
+ result = df.drop_duplicates('AAA', keep=False)
+ expected = df.ix[[]]
+ assert_frame_equal(result, expected)
+ self.assertEqual(len(result), 0)
+
+ # deprecate take_last
+ with tm.assert_produces_warning(FutureWarning):
+ result = df.drop_duplicates('AAA', take_last=True)
+ expected = df.ix[[6, 7]]
+ assert_frame_equal(result, expected)
+
# multi column
expected = df.ix[[0, 1, 2, 3]]
result = df.drop_duplicates(np.array(['AAA', 'B']))
@@ -7872,6 +7883,15 @@ def test_drop_duplicates(self):
result = df.drop_duplicates(['AAA', 'B'])
assert_frame_equal(result, expected)
+ result = df.drop_duplicates(('AAA', 'B'), keep='last')
+ expected = df.ix[[0, 5, 6, 7]]
+ assert_frame_equal(result, expected)
+
+ result = df.drop_duplicates(('AAA', 'B'), keep=False)
+ expected = df.ix[[0]]
+ assert_frame_equal(result, expected)
+
+ # deprecate take_last
result = df.drop_duplicates(('AAA', 'B'), take_last=True)
expected = df.ix[[0, 5, 6, 7]]
assert_frame_equal(result, expected)
@@ -7884,10 +7904,53 @@ def test_drop_duplicates(self):
expected = df2.drop_duplicates(['AAA', 'B'])
assert_frame_equal(result, expected)
+ result = df2.drop_duplicates(keep='last')
+ expected = df2.drop_duplicates(['AAA', 'B'], keep='last')
+ assert_frame_equal(result, expected)
+
+ result = df2.drop_duplicates(keep=False)
+ expected = df2.drop_duplicates(['AAA', 'B'], keep=False)
+ assert_frame_equal(result, expected)
+
+ # deprecate take_last
result = df2.drop_duplicates(take_last=True)
expected = df2.drop_duplicates(['AAA', 'B'], take_last=True)
assert_frame_equal(result, expected)
+ def test_drop_duplicates_for_take_all(self):
+ df = DataFrame({'AAA': ['foo', 'bar', 'baz', 'bar',
+ 'foo', 'bar', 'qux', 'foo'],
+ 'B': ['one', 'one', 'two', 'two',
+ 'two', 'two', 'one', 'two'],
+ 'C': [1, 1, 2, 2, 2, 2, 1, 2],
+ 'D': lrange(8)})
+
+ # single column
+ result = df.drop_duplicates('AAA')
+ expected = df.iloc[[0, 1, 2, 6]]
+ assert_frame_equal(result, expected)
+
+ result = df.drop_duplicates('AAA', keep='last')
+ expected = df.iloc[[2, 5, 6, 7]]
+ assert_frame_equal(result, expected)
+
+ result = df.drop_duplicates('AAA', keep=False)
+ expected = df.iloc[[2, 6]]
+ assert_frame_equal(result, expected)
+
+ # multiple columns
+ result = df.drop_duplicates(['AAA', 'B'])
+ expected = df.iloc[[0, 1, 2, 3, 4, 6]]
+ assert_frame_equal(result, expected)
+
+ result = df.drop_duplicates(['AAA', 'B'], keep='last')
+ expected = df.iloc[[0, 1, 2, 5, 6, 7]]
+ assert_frame_equal(result, expected)
+
+ result = df.drop_duplicates(['AAA', 'B'], keep=False)
+ expected = df.iloc[[0, 1, 2, 6]]
+ assert_frame_equal(result, expected)
+
def test_drop_duplicates_deprecated_warning(self):
df = DataFrame({'AAA': ['foo', 'bar', 'foo', 'bar',
'foo', 'bar', 'bar', 'foo'],
@@ -7914,6 +7977,14 @@ def test_drop_duplicates_deprecated_warning(self):
self.assertRaises(TypeError, df.drop_duplicates,
kwargs={'subset': 'AAA', 'bad_arg': True})
+ # deprecate take_last
+ # Raises warning
+ with tm.assert_produces_warning(FutureWarning):
+ result = df.drop_duplicates(take_last=False, subset='AAA')
+ assert_frame_equal(result, expected)
+
+ self.assertRaises(ValueError, df.drop_duplicates, keep='invalid_name')
+
def test_drop_duplicates_tuple(self):
df = DataFrame({('AA', 'AB'): ['foo', 'bar', 'foo', 'bar',
'foo', 'bar', 'bar', 'foo'],
@@ -7927,6 +7998,16 @@ def test_drop_duplicates_tuple(self):
expected = df[:2]
assert_frame_equal(result, expected)
+ result = df.drop_duplicates(('AA', 'AB'), keep='last')
+ expected = df.ix[[6, 7]]
+ assert_frame_equal(result, expected)
+
+ result = df.drop_duplicates(('AA', 'AB'), keep=False)
+ expected = df.ix[[]] # empty df
+ self.assertEqual(len(result), 0)
+ assert_frame_equal(result, expected)
+
+ # deprecate take_last
result = df.drop_duplicates(('AA', 'AB'), take_last=True)
expected = df.ix[[6, 7]]
assert_frame_equal(result, expected)
@@ -7950,6 +8031,16 @@ def test_drop_duplicates_NA(self):
expected = df.ix[[0, 2, 3]]
assert_frame_equal(result, expected)
+ result = df.drop_duplicates('A', keep='last')
+ expected = df.ix[[1, 6, 7]]
+ assert_frame_equal(result, expected)
+
+ result = df.drop_duplicates('A', keep=False)
+ expected = df.ix[[]] # empty df
+ assert_frame_equal(result, expected)
+ self.assertEqual(len(result), 0)
+
+ # deprecate take_last
result = df.drop_duplicates('A', take_last=True)
expected = df.ix[[1, 6, 7]]
assert_frame_equal(result, expected)
@@ -7959,6 +8050,15 @@ def test_drop_duplicates_NA(self):
expected = df.ix[[0, 2, 3, 6]]
assert_frame_equal(result, expected)
+ result = df.drop_duplicates(['A', 'B'], keep='last')
+ expected = df.ix[[1, 5, 6, 7]]
+ assert_frame_equal(result, expected)
+
+ result = df.drop_duplicates(['A', 'B'], keep=False)
+ expected = df.ix[[6]]
+ assert_frame_equal(result, expected)
+
+ # deprecate take_last
result = df.drop_duplicates(['A', 'B'], take_last=True)
expected = df.ix[[1, 5, 6, 7]]
assert_frame_equal(result, expected)
@@ -7976,6 +8076,16 @@ def test_drop_duplicates_NA(self):
expected = df[:2]
assert_frame_equal(result, expected)
+ result = df.drop_duplicates('C', keep='last')
+ expected = df.ix[[3, 7]]
+ assert_frame_equal(result, expected)
+
+ result = df.drop_duplicates('C', keep=False)
+ expected = df.ix[[]] # empty df
+ assert_frame_equal(result, expected)
+ self.assertEqual(len(result), 0)
+
+ # deprecate take_last
result = df.drop_duplicates('C', take_last=True)
expected = df.ix[[3, 7]]
assert_frame_equal(result, expected)
@@ -7985,10 +8095,53 @@ def test_drop_duplicates_NA(self):
expected = df.ix[[0, 1, 2, 4]]
assert_frame_equal(result, expected)
+ result = df.drop_duplicates(['C', 'B'], keep='last')
+ expected = df.ix[[1, 3, 6, 7]]
+ assert_frame_equal(result, expected)
+
+ result = df.drop_duplicates(['C', 'B'], keep=False)
+ expected = df.ix[[1]]
+ assert_frame_equal(result, expected)
+
+ # deprecate take_last
result = df.drop_duplicates(['C', 'B'], take_last=True)
expected = df.ix[[1, 3, 6, 7]]
assert_frame_equal(result, expected)
+ def test_drop_duplicates_NA_for_take_all(self):
+ # none
+ df = DataFrame({'A': [None, None, 'foo', 'bar',
+ 'foo', 'baz', 'bar', 'qux'],
+ 'C': [1.0, np.nan, np.nan, np.nan, 1., 2., 3, 1.]})
+
+ # single column
+ result = df.drop_duplicates('A')
+ expected = df.iloc[[0, 2, 3, 5, 7]]
+ assert_frame_equal(result, expected)
+
+ result = df.drop_duplicates('A', keep='last')
+ expected = df.iloc[[1, 4, 5, 6, 7]]
+ assert_frame_equal(result, expected)
+
+ result = df.drop_duplicates('A', keep=False)
+ expected = df.iloc[[5, 7]]
+ assert_frame_equal(result, expected)
+
+ # nan
+
+ # single column
+ result = df.drop_duplicates('C')
+ expected = df.iloc[[0, 1, 5, 6]]
+ assert_frame_equal(result, expected)
+
+ result = df.drop_duplicates('C', keep='last')
+ expected = df.iloc[[3, 5, 6, 7]]
+ assert_frame_equal(result, expected)
+
+ result = df.drop_duplicates('C', keep=False)
+ expected = df.iloc[[5, 6]]
+ assert_frame_equal(result, expected)
+
def test_drop_duplicates_inplace(self):
orig = DataFrame({'A': ['foo', 'bar', 'foo', 'bar',
'foo', 'bar', 'bar', 'foo'],
@@ -8004,6 +8157,20 @@ def test_drop_duplicates_inplace(self):
result = df
assert_frame_equal(result, expected)
+ df = orig.copy()
+ df.drop_duplicates('A', keep='last', inplace=True)
+ expected = orig.ix[[6, 7]]
+ result = df
+ assert_frame_equal(result, expected)
+
+ df = orig.copy()
+ df.drop_duplicates('A', keep=False, inplace=True)
+ expected = orig.ix[[]]
+ result = df
+ assert_frame_equal(result, expected)
+ self.assertEqual(len(df), 0)
+
+ # deprecate take_last
df = orig.copy()
df.drop_duplicates('A', take_last=True, inplace=True)
expected = orig.ix[[6, 7]]
@@ -8017,6 +8184,19 @@ def test_drop_duplicates_inplace(self):
result = df
assert_frame_equal(result, expected)
+ df = orig.copy()
+ df.drop_duplicates(['A', 'B'], keep='last', inplace=True)
+ expected = orig.ix[[0, 5, 6, 7]]
+ result = df
+ assert_frame_equal(result, expected)
+
+ df = orig.copy()
+ df.drop_duplicates(['A', 'B'], keep=False, inplace=True)
+ expected = orig.ix[[0]]
+ result = df
+ assert_frame_equal(result, expected)
+
+ # deprecate take_last
df = orig.copy()
df.drop_duplicates(['A', 'B'], take_last=True, inplace=True)
expected = orig.ix[[0, 5, 6, 7]]
@@ -8033,6 +8213,19 @@ def test_drop_duplicates_inplace(self):
result = df2
assert_frame_equal(result, expected)
+ df2 = orig2.copy()
+ df2.drop_duplicates(keep='last', inplace=True)
+ expected = orig2.drop_duplicates(['A', 'B'], keep='last')
+ result = df2
+ assert_frame_equal(result, expected)
+
+ df2 = orig2.copy()
+ df2.drop_duplicates(keep=False, inplace=True)
+ expected = orig2.drop_duplicates(['A', 'B'], keep=False)
+ result = df2
+ assert_frame_equal(result, expected)
+
+ # deprecate take_last
df2 = orig2.copy()
df2.drop_duplicates(take_last=True, inplace=True)
expected = orig2.drop_duplicates(['A', 'B'], take_last=True)
diff --git a/pandas/tests/test_index.py b/pandas/tests/test_index.py
index 15023b77694e6..c0f67d76b7d0d 100644
--- a/pandas/tests/test_index.py
+++ b/pandas/tests/test_index.py
@@ -4711,9 +4711,9 @@ def check(nlevels, with_nulls):
labels = [np.random.choice(n, k * n) for lev in levels]
mi = MultiIndex(levels=levels, labels=labels)
- for take_last in [False, True]:
- left = mi.duplicated(take_last=take_last)
- right = pd.lib.duplicated(mi.values, take_last=take_last)
+ for keep in ['first', 'last', False]:
+ left = mi.duplicated(keep=keep)
+ right = pd.lib.duplicated(mi.values, keep=keep)
tm.assert_numpy_array_equal(left, right)
# GH5873
diff --git a/pandas/tests/test_multilevel.py b/pandas/tests/test_multilevel.py
index 65ba5fd036a35..fbe4eefabe02d 100644
--- a/pandas/tests/test_multilevel.py
+++ b/pandas/tests/test_multilevel.py
@@ -2135,6 +2135,21 @@ def test_duplicated_drop_duplicates(self):
expected = MultiIndex.from_arrays(([1, 2, 3, 2 ,3], [1, 1, 1, 2, 2]))
tm.assert_index_equal(idx.drop_duplicates(), expected)
+ expected = np.array([True, False, False, False, False, False])
+ duplicated = idx.duplicated(keep='last')
+ tm.assert_numpy_array_equal(duplicated, expected)
+ self.assertTrue(duplicated.dtype == bool)
+ expected = MultiIndex.from_arrays(([2, 3, 1, 2 ,3], [1, 1, 1, 2, 2]))
+ tm.assert_index_equal(idx.drop_duplicates(keep='last'), expected)
+
+ expected = np.array([True, False, False, True, False, False])
+ duplicated = idx.duplicated(keep=False)
+ tm.assert_numpy_array_equal(duplicated, expected)
+ self.assertTrue(duplicated.dtype == bool)
+ expected = MultiIndex.from_arrays(([2, 3, 2 ,3], [1, 1, 2, 2]))
+ tm.assert_index_equal(idx.drop_duplicates(keep=False), expected)
+
+ # deprecate take_last
expected = np.array([True, False, False, False, False, False])
duplicated = idx.duplicated(take_last=True)
tm.assert_numpy_array_equal(duplicated, expected)
diff --git a/pandas/tests/test_series.py b/pandas/tests/test_series.py
index 66a38cd858846..31843616956f6 100644
--- a/pandas/tests/test_series.py
+++ b/pandas/tests/test_series.py
@@ -4782,29 +4782,63 @@ def test_axis_alias(self):
self.assertEqual(s._get_axis_name('rows'), 'index')
def test_drop_duplicates(self):
- s = Series([1, 2, 3, 3])
+ # check both int and object
+ for s in [Series([1, 2, 3, 3]), Series(['1', '2', '3', '3'])]:
+ expected = Series([False, False, False, True])
+ assert_series_equal(s.duplicated(), expected)
+ assert_series_equal(s.drop_duplicates(), s[~expected])
+ sc = s.copy()
+ sc.drop_duplicates(inplace=True)
+ assert_series_equal(sc, s[~expected])
- result = s.duplicated()
- expected = Series([False, False, False, True])
- assert_series_equal(result, expected)
+ expected = Series([False, False, True, False])
+ assert_series_equal(s.duplicated(keep='last'), expected)
+ assert_series_equal(s.drop_duplicates(keep='last'), s[~expected])
+ sc = s.copy()
+ sc.drop_duplicates(keep='last', inplace=True)
+ assert_series_equal(sc, s[~expected])
+ # deprecate take_last
+ assert_series_equal(s.duplicated(take_last=True), expected)
+ assert_series_equal(s.drop_duplicates(take_last=True), s[~expected])
+ sc = s.copy()
+ sc.drop_duplicates(take_last=True, inplace=True)
+ assert_series_equal(sc, s[~expected])
- result = s.duplicated(take_last=True)
- expected = Series([False, False, True, False])
- assert_series_equal(result, expected)
+ expected = Series([False, False, True, True])
+ assert_series_equal(s.duplicated(keep=False), expected)
+ assert_series_equal(s.drop_duplicates(keep=False), s[~expected])
+ sc = s.copy()
+ sc.drop_duplicates(keep=False, inplace=True)
+ assert_series_equal(sc, s[~expected])
+
+ for s in [Series([1, 2, 3, 5, 3, 2, 4]),
+ Series(['1', '2', '3', '5', '3', '2', '4'])]:
+ expected = Series([False, False, False, False, True, True, False])
+ assert_series_equal(s.duplicated(), expected)
+ assert_series_equal(s.drop_duplicates(), s[~expected])
+ sc = s.copy()
+ sc.drop_duplicates(inplace=True)
+ assert_series_equal(sc, s[~expected])
- result = s.drop_duplicates()
- expected = s[[True, True, True, False]]
- assert_series_equal(result, expected)
- sc = s.copy()
- sc.drop_duplicates(inplace=True)
- assert_series_equal(sc, expected)
+ expected = Series([False, True, True, False, False, False, False])
+ assert_series_equal(s.duplicated(keep='last'), expected)
+ assert_series_equal(s.drop_duplicates(keep='last'), s[~expected])
+ sc = s.copy()
+ sc.drop_duplicates(keep='last', inplace=True)
+ assert_series_equal(sc, s[~expected])
+ # deprecate take_last
+ assert_series_equal(s.duplicated(take_last=True), expected)
+ assert_series_equal(s.drop_duplicates(take_last=True), s[~expected])
+ sc = s.copy()
+ sc.drop_duplicates(take_last=True, inplace=True)
+ assert_series_equal(sc, s[~expected])
- result = s.drop_duplicates(take_last=True)
- expected = s[[True, True, False, True]]
- assert_series_equal(result, expected)
- sc = s.copy()
- sc.drop_duplicates(take_last=True, inplace=True)
- assert_series_equal(sc, expected)
+ expected = Series([False, True, True, False, True, True, False])
+ assert_series_equal(s.duplicated(keep=False), expected)
+ assert_series_equal(s.drop_duplicates(keep=False), s[~expected])
+ sc = s.copy()
+ sc.drop_duplicates(keep=False, inplace=True)
+ assert_series_equal(sc, s[~expected])
def test_sort(self):
ts = self.ts.copy()
diff --git a/pandas/tests/test_tseries.py b/pandas/tests/test_tseries.py
index 035b3ac07342d..f10d541a7e23b 100644
--- a/pandas/tests/test_tseries.py
+++ b/pandas/tests/test_tseries.py
@@ -275,10 +275,18 @@ def test_duplicated_with_nas():
expected = [False, False, False, True, False, True]
assert(np.array_equal(result, expected))
- result = lib.duplicated(keys, take_last=True)
+ result = lib.duplicated(keys, keep='first')
+ expected = [False, False, False, True, False, True]
+ assert(np.array_equal(result, expected))
+
+ result = lib.duplicated(keys, keep='last')
expected = [True, False, True, False, False, False]
assert(np.array_equal(result, expected))
+ result = lib.duplicated(keys, keep=False)
+ expected = [True, False, True, True, False, True]
+ assert(np.array_equal(result, expected))
+
keys = np.empty(8, dtype=object)
for i, t in enumerate(zip([0, 0, nan, nan] * 2, [0, nan, 0, nan] * 2)):
keys[i] = t
@@ -289,10 +297,14 @@ def test_duplicated_with_nas():
expected = falses + trues
assert(np.array_equal(result, expected))
- result = lib.duplicated(keys, take_last=True)
+ result = lib.duplicated(keys, keep='last')
expected = trues + falses
assert(np.array_equal(result, expected))
+ result = lib.duplicated(keys, keep=False)
+ expected = trues + trues
+ assert(np.array_equal(result, expected))
+
def test_maybe_booleans_to_slice():
arr = np.array([0, 0, 1, 1, 1, 0, 1], dtype=np.uint8)
| Closes #6511, Closes #8505.
Introduce `keep` kw to handle first / last / all duplicates based on the discussion above. If there is better API/kw, please lmk.
### `duplicated`
- `keep='first'` (default): mark duplicates as `True` except for the first occurrence.
- `keep='last'`: mark duplicates as `True` except for the last occurrence.
- `keep=False`: mark all duplicates as `True`.
### `drop_duplicates`
- `keep='first'` (default): drop duplicates except for the first occurrence.
- `keep='last'`: drop duplicates except for the last occurrence.
- `keep=False`: drop all duplicates.
``` python
import pandas as pd
s = pd.Series(['A', 'B', 'C', 'A', 'B', 'D'])
# mark duplicates except for the first occurrence
s.duplicated()
#0 False
#1 False
#2 False
#3 True
#4 True
#5 False
# dtype: bool
# mark duplicates except for the last occurrence
s.duplicated(keep='last')
#0 True
#1 True
#2 False
#3 False
#4 False
#5 False
# dtype: bool
# mark all duplicates
s.duplicated(keep=False)
#0 True
#1 True
#2 False
#3 True
#4 True
#5 False
# dtype: bool
# drop duplicates except for the first occurrence
s.drop_duplicates()
#0 A
#1 B
#2 C
#5 D
# dtype: object
# drop duplicates except for the last occurrence
s.drop_duplicates(keep='last')
#2 C
#3 A
#4 B
#5 D
# dtype: object
# drop all duplicates
s.drop_duplicates(keep=False)
#2 C
#5 D
# dtype: object
```
CC @shoyer, @wikiped, @socheon
| https://api.github.com/repos/pandas-dev/pandas/pulls/10236 | 2015-05-30T13:00:05Z | 2015-08-08T19:46:01Z | 2015-08-08T19:46:01Z | 2024-03-23T16:32:22Z |
BUG: plotting grouped_hist with a single row frame #10214 | diff --git a/doc/source/whatsnew/v0.17.0.txt b/doc/source/whatsnew/v0.17.0.txt
index a7917e81f7057..bda9b57cb5cdf 100644
--- a/doc/source/whatsnew/v0.17.0.txt
+++ b/doc/source/whatsnew/v0.17.0.txt
@@ -59,7 +59,7 @@ Performance Improvements
Bug Fixes
~~~~~~~~~
-
+- Bug where ``hist`` raises an error when a one row Series was given (:issue:`10214`)
- Bug where read_hdf store.select modifies the passed columns list when
multi-indexed (:issue:`7212`)
- Bug in ``Categorical`` repr with ``display.width`` of ``None`` in Python 3 (:issue:`10087`)
diff --git a/pandas/io/excel.py b/pandas/io/excel.py
index cab342dc339f4..f9967ea99ffc8 100644
--- a/pandas/io/excel.py
+++ b/pandas/io/excel.py
@@ -13,7 +13,7 @@
from pandas.io.common import _is_url, _urlopen
from pandas.tseries.period import Period
from pandas import json
-from pandas.compat import map, zip, reduce, range, lrange, u, add_metaclass
+from pandas.compat import map, zip, reduce, range, lrange, u, add_metaclass, OrderedDict
from pandas.core import config
from pandas.core.common import pprint_thing
import pandas.compat as compat
@@ -393,7 +393,7 @@ def _parse_cell(cell_contents,cell_typ):
#handle same-type duplicates.
sheets = list(set(sheets))
- output = {}
+ output = {} #OrderedDict()
for asheetname in sheets:
if verbose:
diff --git a/pandas/io/tests/data/test.xls b/pandas/io/tests/data/test.xls
index db0f9dec7d5e4..ebae8280df73f 100644
Binary files a/pandas/io/tests/data/test.xls and b/pandas/io/tests/data/test.xls differ
diff --git a/pandas/io/tests/data/test2.xls b/pandas/io/tests/data/test2.xls
index dadeb7c2453af..e68b5018e44ed 100644
Binary files a/pandas/io/tests/data/test2.xls and b/pandas/io/tests/data/test2.xls differ
diff --git a/pandas/io/tests/data/test3.xls b/pandas/io/tests/data/test3.xls
index f73943d677951..c873109c3f1a2 100644
Binary files a/pandas/io/tests/data/test3.xls and b/pandas/io/tests/data/test3.xls differ
diff --git a/pandas/io/tests/data/test_multisheet.xlsx b/pandas/io/tests/data/test_multisheet.xlsx
index 5de07772b276a..936e0fc5a5ef9 100644
Binary files a/pandas/io/tests/data/test_multisheet.xlsx and b/pandas/io/tests/data/test_multisheet.xlsx differ
diff --git a/pandas/io/tests/test_excel.py b/pandas/io/tests/test_excel.py
index 768aa40696cbc..391556c6cb0fb 100644
--- a/pandas/io/tests/test_excel.py
+++ b/pandas/io/tests/test_excel.py
@@ -429,12 +429,17 @@ def test_reading_all_sheets(self):
# Test reading all sheetnames by setting sheetname to None,
# Ensure a dict is returned.
# See PR #9450
+ # Ensure sheet order is preserved.
+ # See issue #9930
_skip_if_no_xlrd()
dfs = read_excel(self.multisheet,sheetname=None)
- expected_keys = ['Alpha','Beta','Charlie']
+ expected_keys = ['Charlie','Beta','Alpha']
tm.assert_contains_all(expected_keys,dfs.keys())
+ for i, sheetname in enumerate(dfs):
+ expected_sheetname = expected_keys[i]
+ tm.assert_equal(sheetname, expected_sheetname)
def test_reading_multiple_specific_sheets(self):
# Test reading specific sheetnames by specifying a mixed list
diff --git a/pandas/tests/test_graphics.py b/pandas/tests/test_graphics.py
index 82f4b8c05ca06..0a300163381c0 100644
--- a/pandas/tests/test_graphics.py
+++ b/pandas/tests/test_graphics.py
@@ -3469,6 +3469,13 @@ def test_df_grid_settings(self):
# Make sure plot defaults to rcParams['axes.grid'] setting, GH 9792
self._check_grid_settings(DataFrame({'a':[1,2,3],'b':[2,3,4]}),
plotting._dataframe_kinds, kws={'x':'a','y':'b'})
+
+ def test_hist_single_row(self):
+ bins = np.arange(80, 100 + 2, 1)
+ df = DataFrame({"Name": ["AAA", "BBB"], "ByCol": [1, 2], "Mark": [85, 89]})
+ df["Mark"].hist(by=df["ByCol"], bins=bins)
+ df = DataFrame({"Name": ["AAA"], "ByCol": [1], "Mark": [85]})
+ df["Mark"].hist(by=df["ByCol"], bins=bins)
@tm.mplskip
diff --git a/pandas/tools/plotting.py b/pandas/tools/plotting.py
index 76685e2589012..e9e34b6623dff 100644
--- a/pandas/tools/plotting.py
+++ b/pandas/tools/plotting.py
@@ -2845,9 +2845,9 @@ def hist_series(self, by=None, ax=None, grid=True, xlabelsize=None,
axes = grouped_hist(self, by=by, ax=ax, grid=grid, figsize=figsize, bins=bins,
xlabelsize=xlabelsize, xrot=xrot, ylabelsize=ylabelsize, yrot=yrot,
**kwds)
-
- if axes.ndim == 1 and len(axes) == 1:
- return axes[0]
+ if isinstance(axes, np.ndarray):
+ if axes.ndim == 1 and len(axes) == 1:
+ return axes[0]
return axes
| Should closes https://github.com/pydata/pandas/issues/10214
| https://api.github.com/repos/pandas-dev/pandas/pulls/10233 | 2015-05-29T17:09:10Z | 2015-06-07T06:12:25Z | null | 2015-06-07T06:12:25Z |
Fix undesired UX behavior of DataFrame output in IPython Notebook | diff --git a/doc/source/whatsnew/v0.16.2.txt b/doc/source/whatsnew/v0.16.2.txt
index b571aab0b19a5..800a5c71ebabb 100644
--- a/doc/source/whatsnew/v0.16.2.txt
+++ b/doc/source/whatsnew/v0.16.2.txt
@@ -25,6 +25,8 @@ New features
Other enhancements
^^^^^^^^^^^^^^^^^^
+- Removed duplicate scroll bars in DataFrame HTML representation. In pandas internal, large DataFrame's output will be wrapped with vertical and horizontal scroll bars. It is unnecessary because IPython has "toggle output scrolling" feature. In IPython below v3.0 the output is still wrapped with horizontal scroll bar because the horizontal scroll bar is not included (yet) in "toogle output scrolling" feature. In IPython v3.0 or later it is included so the output's scrollability all handled by IPython. (:issue:`10231`)
+
.. _whatsnew_0162.api:
Backwards incompatible API changes
diff --git a/pandas/core/format.py b/pandas/core/format.py
index 3ab41ded1deea..4e64ea02f93c8 100644
--- a/pandas/core/format.py
+++ b/pandas/core/format.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import print_function
+from distutils.version import LooseVersion
# pylint: disable=W0141
import sys
@@ -692,13 +693,20 @@ def _format_col(self, i):
space=self.col_space
)
- def to_html(self, classes=None):
+ def to_html(self, classes=None, notebook=False):
"""
Render a DataFrame to a html table.
+
+ Parameters
+ ----------
+ notebook : {True, False}, optional, default False
+ Whether the generated HTML is for IPython Notebook.
+
"""
html_renderer = HTMLFormatter(self, classes=classes,
max_rows=self.max_rows,
- max_cols=self.max_cols)
+ max_cols=self.max_cols,
+ notebook=notebook)
if hasattr(self.buf, 'write'):
html_renderer.write_result(self.buf)
elif isinstance(self.buf, compat.string_types):
@@ -808,7 +816,8 @@ class HTMLFormatter(TableFormatter):
indent_delta = 2
- def __init__(self, formatter, classes=None, max_rows=None, max_cols=None):
+ def __init__(self, formatter, classes=None, max_rows=None, max_cols=None,
+ notebook=False):
self.fmt = formatter
self.classes = classes
@@ -823,6 +832,7 @@ def __init__(self, formatter, classes=None, max_rows=None, max_cols=None):
self.show_dimensions = self.fmt.show_dimensions
self.is_truncated = (self.max_rows < len(self.fmt.frame) or
self.max_cols < len(self.fmt.columns))
+ self.notebook = notebook
def write(self, s, indent=0):
rs = com.pprint_thing(s)
@@ -890,6 +900,17 @@ def write_result(self, buf):
'not %s') % type(self.classes))
_classes.extend(self.classes)
+ if self.notebook:
+ div_style = ''
+ try:
+ import IPython
+ if IPython.__version__ < LooseVersion('3.0.0'):
+ div_style = ' style="max-width:1500px;overflow:auto;"'
+ except ImportError:
+ pass
+
+ self.write('<div{0}>'.format(div_style))
+
self.write('<table border="1" class="%s">' % ' '.join(_classes),
indent)
@@ -902,6 +923,10 @@ def write_result(self, buf):
by = chr(215) if compat.PY3 else unichr(215) # ×
self.write(u('<p>%d rows %s %d columns</p>') %
(len(frame), by, len(frame.columns)))
+
+ if self.notebook:
+ self.write('</div>')
+
_put_lines(buf, self.elements)
def _write_header(self, indent):
diff --git a/pandas/core/frame.py b/pandas/core/frame.py
index f36108262432d..1455da4ac19db 100644
--- a/pandas/core/frame.py
+++ b/pandas/core/frame.py
@@ -538,10 +538,9 @@ def _repr_html_(self):
max_cols = get_option("display.max_columns")
show_dimensions = get_option("display.show_dimensions")
- return ('<div style="max-height:1000px;'
- 'max-width:1500px;overflow:auto;">\n' +
- self.to_html(max_rows=max_rows, max_cols=max_cols,
- show_dimensions=show_dimensions) + '\n</div>')
+ return self.to_html(max_rows=max_rows, max_cols=max_cols,
+ show_dimensions=show_dimensions,
+ notebook=True)
else:
return None
@@ -1349,7 +1348,8 @@ def to_html(self, buf=None, columns=None, col_space=None, colSpace=None,
header=True, index=True, na_rep='NaN', formatters=None,
float_format=None, sparsify=None, index_names=True,
justify=None, bold_rows=True, classes=None, escape=True,
- max_rows=None, max_cols=None, show_dimensions=False):
+ max_rows=None, max_cols=None, show_dimensions=False,
+ notebook=False):
"""
Render a DataFrame as an HTML table.
@@ -1388,7 +1388,7 @@ def to_html(self, buf=None, columns=None, col_space=None, colSpace=None,
max_rows=max_rows,
max_cols=max_cols,
show_dimensions=show_dimensions)
- formatter.to_html(classes=classes)
+ formatter.to_html(classes=classes, notebook=notebook)
if buf is None:
return formatter.buf.getvalue()
diff --git a/pandas/tests/test_format.py b/pandas/tests/test_format.py
index a7129bca59a7f..535fde34d7684 100644
--- a/pandas/tests/test_format.py
+++ b/pandas/tests/test_format.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import print_function
+from distutils.version import LooseVersion
import re
from pandas.compat import range, zip, lrange, StringIO, PY3, lzip, u
@@ -14,6 +15,14 @@
from numpy.random import randn
import numpy as np
+div_style = ''
+try:
+ import IPython
+ if IPython.__version__ < LooseVersion('3.0.0'):
+ div_style = ' style="max-width:1500px;overflow:auto;"'
+except ImportError:
+ pass
+
from pandas import DataFrame, Series, Index, Timestamp, MultiIndex, date_range, NaT
import pandas.core.format as fmt
@@ -892,7 +901,7 @@ def test_to_html_truncate(self):
fmt.set_option('display.max_columns',4)
result = df._repr_html_()
expected = '''\
-<div style="max-height:1000px;max-width:1500px;overflow:auto;">
+<div{0}>
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
@@ -980,7 +989,7 @@ def test_to_html_truncate(self):
</tbody>
</table>
<p>20 rows × 20 columns</p>
-</div>'''
+</div>'''.format(div_style)
if sys.version_info[0] < 3:
expected = expected.decode('utf-8')
self.assertEqual(result, expected)
@@ -993,7 +1002,7 @@ def test_to_html_truncate_multi_index(self):
fmt.set_option('display.max_columns',7)
result = df._repr_html_()
expected = '''\
-<div style="max-height:1000px;max-width:1500px;overflow:auto;">
+<div{0}>
<table border="1" class="dataframe">
<thead>
<tr>
@@ -1096,7 +1105,7 @@ def test_to_html_truncate_multi_index(self):
</tbody>
</table>
<p>8 rows × 8 columns</p>
-</div>'''
+</div>'''.format(div_style)
if sys.version_info[0] < 3:
expected = expected.decode('utf-8')
self.assertEqual(result, expected)
@@ -1110,7 +1119,7 @@ def test_to_html_truncate_multi_index_sparse_off(self):
fmt.set_option('display.multi_sparse',False)
result = df._repr_html_()
expected = '''\
-<div style="max-height:1000px;max-width:1500px;overflow:auto;">
+<div{0}>
<table border="1" class="dataframe">
<thead>
<tr>
@@ -1206,7 +1215,7 @@ def test_to_html_truncate_multi_index_sparse_off(self):
</tbody>
</table>
<p>8 rows × 8 columns</p>
-</div>'''
+</div>'''.format(div_style)
if sys.version_info[0] < 3:
expected = expected.decode('utf-8')
self.assertEqual(result, expected)
| Closes #10231
| https://api.github.com/repos/pandas-dev/pandas/pulls/10232 | 2015-05-29T17:09:03Z | 2015-06-11T15:39:21Z | null | 2015-08-03T12:33:05Z |
Close mysql connection in TestXMySQL to prevent tests freezing | diff --git a/pandas/io/tests/test_sql.py b/pandas/io/tests/test_sql.py
index fa7debeb228ce..9576f80696350 100644
--- a/pandas/io/tests/test_sql.py
+++ b/pandas/io/tests/test_sql.py
@@ -2195,6 +2195,13 @@ def setUp(self):
"[pandas] in your system's mysql default file, "
"typically located at ~/.my.cnf or /etc/.my.cnf. ")
+ def tearDown(self):
+ from pymysql.err import Error
+ try:
+ self.db.close()
+ except Error:
+ pass
+
def test_basic(self):
_skip_if_no_pymysql()
frame = tm.makeTimeDataFrame()
| The unit tests freeze on my machine without this change because you can't drop a table until other connections that are using that table disconnect.
| https://api.github.com/repos/pandas-dev/pandas/pulls/10230 | 2015-05-29T09:14:01Z | 2015-05-29T12:21:07Z | 2015-05-29T12:21:07Z | 2015-06-02T19:26:12Z |
CLN: Remove redundant self.unique_check and self._do_unique_check | diff --git a/pandas/index.pyx b/pandas/index.pyx
index 9be7e7404f3fe..fea549eeece76 100644
--- a/pandas/index.pyx
+++ b/pandas/index.pyx
@@ -78,7 +78,7 @@ cdef class IndexEngine:
cdef:
bint unique, monotonic_inc, monotonic_dec
- bint initialized, monotonic_check, unique_check
+ bint initialized, monotonic_check
def __init__(self, vgetter, n):
self.vgetter = vgetter
@@ -206,8 +206,7 @@ cdef class IndexEngine:
property is_unique:
def __get__(self):
- if not self.unique_check:
- self._do_unique_check()
+ self._ensure_mapping_populated()
return self.unique == 1
@@ -235,7 +234,6 @@ cdef class IndexEngine:
if unique is not None:
self.unique = unique
- self.unique_check = 1
except TypeError:
self.monotonic_inc = 0
@@ -245,9 +243,6 @@ cdef class IndexEngine:
cdef _get_index_values(self):
return self.vgetter()
- cdef inline _do_unique_check(self):
- self._ensure_mapping_populated()
-
def _call_monotonic(self, values):
raise NotImplementedError
@@ -269,7 +264,6 @@ cdef class IndexEngine:
if len(self.mapping) == len(values):
self.unique = 1
- self.unique_check = 1
self.initialized = 1
| New version of https://github.com/pydata/pandas/pull/10139 , which now completely removes unused attribute and method, avoiding a couple of useless checks.
| https://api.github.com/repos/pandas-dev/pandas/pulls/10229 | 2015-05-29T08:39:44Z | 2015-08-15T23:56:31Z | null | 2017-11-23T16:23:55Z |
BUG: Holiday(..) with both offset and observance raises | diff --git a/doc/source/whatsnew/v0.17.0.txt b/doc/source/whatsnew/v0.17.0.txt
index a7917e81f7057..c539c907f0a26 100644
--- a/doc/source/whatsnew/v0.17.0.txt
+++ b/doc/source/whatsnew/v0.17.0.txt
@@ -38,6 +38,8 @@ Backwards incompatible API changes
Other API Changes
^^^^^^^^^^^^^^^^^
+- ``Holiday`` now raises NotImplementedError if both offset and observance are used in constructor. (:issue:`102171`)
+
.. _whatsnew_0170.deprecations:
Deprecations
diff --git a/pandas/tests/test_tseries.py b/pandas/tests/test_tseries.py
index 1b796ed2d83d1..035b3ac07342d 100644
--- a/pandas/tests/test_tseries.py
+++ b/pandas/tests/test_tseries.py
@@ -9,6 +9,8 @@
import pandas.lib as lib
import pandas._period as period
import pandas.algos as algos
+from pandas.tseries.holiday import Holiday, SA, next_monday
+from pandas import DateOffset
class TestTseriesUtil(tm.TestCase):
@@ -737,6 +739,17 @@ def test_get_period_field_raises_on_out_of_range(self):
def test_get_period_field_array_raises_on_out_of_range(self):
self.assertRaises(ValueError, period.get_period_field_arr, -1, np.empty(1), 0)
+
+class TestHolidayConflictingArguments(tm.TestCase):
+
+ # GH 10217
+
+ def test_both_offset_observance_raises(self):
+
+ with self.assertRaises(NotImplementedError) as cm:
+ h = Holiday("Cyber Monday", month=11, day=1,
+ offset=[DateOffset(weekday=SA(4))], observance=next_monday)
+
if __name__ == '__main__':
import nose
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
diff --git a/pandas/tseries/holiday.py b/pandas/tseries/holiday.py
index 799be98a329fa..f55569302ca05 100644
--- a/pandas/tseries/holiday.py
+++ b/pandas/tseries/holiday.py
@@ -148,6 +148,9 @@ class from pandas.tseries.offsets
>>> July3rd = Holiday('July 3rd', month=7, day=3,
days_of_week=(0, 1, 2, 3))
"""
+ if offset is not None and observance is not None:
+ raise NotImplementedError("Cannot use both offset and observance.")
+
self.name = name
self.year = year
self.month = month
| Resolves #10217
Doesn't fix the underlying issue yet, but at least raises on the unsupported behavior.
| https://api.github.com/repos/pandas-dev/pandas/pulls/10226 | 2015-05-29T01:16:42Z | 2015-06-01T11:04:48Z | null | 2015-06-02T19:26:12Z |
Fix float formatting edge case | diff --git a/pandas/core/index.py b/pandas/core/index.py
index 2bd96fcec2e42..c3e8bb79d5607 100644
--- a/pandas/core/index.py
+++ b/pandas/core/index.py
@@ -1222,11 +1222,7 @@ def to_native_types(self, slicer=None, **kwargs):
def _format_native_types(self, na_rep='', quoting=None, **kwargs):
""" actually format my specific types """
mask = isnull(self)
- if not self.is_object() and not quoting:
- values = np.asarray(self).astype(str)
- else:
- values = np.array(self, dtype=object, copy=True)
-
+ values = np.array(self, dtype=object, copy=True)
values[mask] = na_rep
return values
diff --git a/pandas/core/internals.py b/pandas/core/internals.py
index 3395ea360165e..2ad48f025258f 100644
--- a/pandas/core/internals.py
+++ b/pandas/core/internals.py
@@ -491,12 +491,7 @@ def to_native_types(self, slicer=None, na_rep='', quoting=None, **kwargs):
if slicer is not None:
values = values[:, slicer]
mask = isnull(values)
-
- if not self.is_object and not quoting:
- values = values.astype(str)
- else:
- values = np.array(values, dtype='object')
-
+ values = np.array(values, dtype=object)
values[mask] = na_rep
return values
@@ -1232,20 +1227,18 @@ def to_native_types(self, slicer=None, na_rep='', float_format=None, decimal='.'
values = self.values
if slicer is not None:
values = values[:, slicer]
+ values = np.array(values, object)
mask = isnull(values)
+ values[mask] = na_rep
- formatter = None
if float_format and decimal != '.':
- formatter = lambda v : (float_format % v).replace('.',decimal,1)
+ formatter = lambda v: (float_format % v).replace('.', decimal, 1)
elif decimal != '.':
- formatter = lambda v : ('%g' % v).replace('.',decimal,1)
+ formatter = lambda v: ('%g' % v).replace('.', decimal, 1)
elif float_format:
- formatter = lambda v : float_format % v
-
- if formatter is None and not quoting:
- values = values.astype(str)
+ formatter = lambda v: float_format % v
else:
- values = np.array(values, dtype='object')
+ formatter = None
values[mask] = na_rep
if formatter:
diff --git a/pandas/lib.pyx b/pandas/lib.pyx
index cc4c43494176e..7c935990b5223 100644
--- a/pandas/lib.pyx
+++ b/pandas/lib.pyx
@@ -948,51 +948,53 @@ def string_array_replace_from_nan_rep(ndarray[object, ndim=1] arr, object nan_re
return arr
+
@cython.boundscheck(False)
@cython.wraparound(False)
-def write_csv_rows(list data, ndarray data_index, int nlevels, ndarray cols, object writer):
+def write_csv_rows(list data, ndarray[object] data_index, int nlevels,
+ ndarray[object] cols, object writer):
- cdef int N, j, i, ncols
- cdef list rows
- cdef object val
+ cdef:
+ Py_ssize_t i, j
+ Py_ssize_t N = 100, ncols = cols.shape[0], nindex = data_index.shape[0]
+ list rows, row
- # In crude testing, N>100 yields little marginal improvement
- N=100
+ # In crude testing, N > 100 yields little marginal improvement
+ N = 100
- # pre-allocate rows
- ncols = len(cols)
- rows = [[None]*(nlevels+ncols) for x in range(N)]
+ # pre-allocate rows
+ rows = [[None] * (nlevels + ncols) for x in range(N)]
j = -1
if nlevels == 1:
- for j in range(len(data_index)):
+ for j in range(nindex):
row = rows[j % N]
row[0] = data_index[j]
for i in range(ncols):
- row[1+i] = data[i][j]
+ row[i + 1] = data[i][j]
- if j >= N-1 and j % N == N-1:
+ if j >= N - 1 and j % N == N - 1:
writer.writerows(rows)
elif nlevels > 1:
- for j in range(len(data_index)):
+ for j in range(nindex):
row = rows[j % N]
row[:nlevels] = list(data_index[j])
for i in range(ncols):
- row[nlevels+i] = data[i][j]
+ row[nlevels + i] = data[i][j]
- if j >= N-1 and j % N == N-1:
+ if j >= N - 1 and j % N == N - 1:
writer.writerows(rows)
else:
- for j in range(len(data_index)):
+ for j in range(nindex):
row = rows[j % N]
for i in range(ncols):
row[i] = data[i][j]
- if j >= N-1 and j % N == N-1:
+ if j >= N - 1 and j % N == N - 1:
writer.writerows(rows)
- if j >= 0 and (j < N-1 or (j % N) != N-1 ):
- writer.writerows(rows[:((j+1) % N)])
+ if j >= 0 and (j < N - 1 or j % N != N - 1):
+ writer.writerows(rows[:(j + 1) % N])
#-------------------------------------------------------------------------------
# Groupby-related functions
diff --git a/pandas/tests/test_format.py b/pandas/tests/test_format.py
index a7129bca59a7f..755f7cadd5aa1 100644
--- a/pandas/tests/test_format.py
+++ b/pandas/tests/test_format.py
@@ -3305,6 +3305,19 @@ def test_tz_dateutil(self):
dt_datetime_us = datetime(2013, 1, 2, 12, 1, 3, 45, tzinfo=utc)
self.assertEqual(str(dt_datetime_us), str(Timestamp(dt_datetime_us)))
+
+def test_float_formatting():
+ np.random.seed(0)
+ df = pd.DataFrame(dict(a=np.random.randn(10)))
+ sio = StringIO()
+ df.to_csv(sio, index=False, header=False)
+ raw = np.array([float(x) for x in sio.getvalue().splitlines()])
+ if sys.version_info[:2] == (2, 6):
+ np.testing.assert_array_almost_equal(df.a.values, raw)
+ else:
+ np.testing.assert_array_equal(df.a.values, raw)
+
+
if __name__ == '__main__':
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
exit=False)
| null | https://api.github.com/repos/pandas-dev/pandas/pulls/10225 | 2015-05-28T21:00:20Z | 2015-10-11T16:05:47Z | null | 2023-05-11T01:12:59Z |
Update plotting.py | diff --git a/pandas/tools/plotting.py b/pandas/tools/plotting.py
index 76685e2589012..dfd6191e5ef1e 100644
--- a/pandas/tools/plotting.py
+++ b/pandas/tools/plotting.py
@@ -2846,8 +2846,9 @@ def hist_series(self, by=None, ax=None, grid=True, xlabelsize=None,
xlabelsize=xlabelsize, xrot=xrot, ylabelsize=ylabelsize, yrot=yrot,
**kwds)
- if axes.ndim == 1 and len(axes) == 1:
- return axes[0]
+ if isinstance(axes, np.ndarray):
+ if axes.ndim == 1 and len(axes) == 1:
+ return axes[0]
return axes
| Should fix https://github.com/pydata/pandas/issues/10214#issuecomment-106091734
| https://api.github.com/repos/pandas-dev/pandas/pulls/10220 | 2015-05-28T16:39:33Z | 2015-05-29T17:10:25Z | null | 2023-05-11T01:12:59Z |
add try / except to address issue #10154 to_datetime, Inconsistent be… | diff --git a/ci/requirements-2.7.txt b/ci/requirements-2.7.txt
index 0d515f300f5a7..951c8798bef15 100644
--- a/ci/requirements-2.7.txt
+++ b/ci/requirements-2.7.txt
@@ -17,7 +17,7 @@ boto=2.36.0
bottleneck=0.8.0
psycopg2=2.5.2
patsy
-pymysql=0.6.1
+pymysql=0.6.3
html5lib=1.0b2
beautiful-soup=4.2.1
httplib2=0.8
diff --git a/doc/source/io.rst b/doc/source/io.rst
index 185deb4b9cae8..7a4318fb02cfc 100644
--- a/doc/source/io.rst
+++ b/doc/source/io.rst
@@ -3555,9 +3555,16 @@ below and the SQLAlchemy `documentation <http://docs.sqlalchemy.org/en/rel_0_9/c
.. ipython:: python
from sqlalchemy import create_engine
- # Create your connection.
+ # Create your engine.
engine = create_engine('sqlite:///:memory:')
+If you want to manage your own connections you can pass one of those instead:
+
+.. ipython:: python
+
+ with engine.connect() as conn, conn.begin():
+ data = pd.read_sql_table('data', conn)
+
Writing DataFrames
~~~~~~~~~~~~~~~~~~
diff --git a/doc/source/whatsnew/v0.17.0.txt b/doc/source/whatsnew/v0.17.0.txt
index cd41c4fc82146..da16734dc873b 100644
--- a/doc/source/whatsnew/v0.17.0.txt
+++ b/doc/source/whatsnew/v0.17.0.txt
@@ -26,6 +26,7 @@ Check the :ref:`API Changes <whatsnew_0170.api>` and :ref:`deprecations <whatsne
New features
~~~~~~~~~~~~
+- SQL io functions now accept a SQLAlchemy connectable. (:issue:`7877`)
.. _whatsnew_0170.enhancements.other:
diff --git a/pandas/core/generic.py b/pandas/core/generic.py
index 3bf998c1fa5a7..aba38ed4f63af 100644
--- a/pandas/core/generic.py
+++ b/pandas/core/generic.py
@@ -879,7 +879,7 @@ def to_hdf(self, path_or_buf, key, **kwargs):
Parameters
----------
- path_or_buf : the path (string) or buffer to put the store
+ path_or_buf : the path (string) or HDFStore object
key : string
indentifier for the group in the store
mode : optional, {'a', 'w', 'r', 'r+'}, default 'a'
diff --git a/pandas/io/sql.py b/pandas/io/sql.py
index 8d8768c08fe02..ef8360f0ff459 100644
--- a/pandas/io/sql.py
+++ b/pandas/io/sql.py
@@ -38,7 +38,7 @@ class DatabaseError(IOError):
_SQLALCHEMY_INSTALLED = None
-def _is_sqlalchemy_engine(con):
+def _is_sqlalchemy_connectable(con):
global _SQLALCHEMY_INSTALLED
if _SQLALCHEMY_INSTALLED is None:
try:
@@ -62,7 +62,7 @@ def compile_big_int_sqlite(type_, compiler, **kw):
if _SQLALCHEMY_INSTALLED:
import sqlalchemy
- return isinstance(con, sqlalchemy.engine.Engine)
+ return isinstance(con, sqlalchemy.engine.Connectable)
else:
return False
@@ -139,7 +139,7 @@ def execute(sql, con, cur=None, params=None):
----------
sql : string
Query to be executed
- con : SQLAlchemy engine or sqlite3 DBAPI2 connection
+ con : SQLAlchemy connectable(engine/connection) or sqlite3 DBAPI2 connection
Using SQLAlchemy makes it possible to use any DB supported by that
library.
If a DBAPI2 object, only sqlite3 is supported.
@@ -282,14 +282,14 @@ def read_sql_table(table_name, con, schema=None, index_col=None,
chunksize=None):
"""Read SQL database table into a DataFrame.
- Given a table name and an SQLAlchemy engine, returns a DataFrame.
+ Given a table name and an SQLAlchemy connectable, returns a DataFrame.
This function does not support DBAPI connections.
Parameters
----------
table_name : string
Name of SQL table in database
- con : SQLAlchemy engine
+ con : SQLAlchemy connectable
Sqlite DBAPI connection mode not supported
schema : string, default None
Name of SQL schema in database to query (if database flavor
@@ -328,9 +328,9 @@ def read_sql_table(table_name, con, schema=None, index_col=None,
read_sql
"""
- if not _is_sqlalchemy_engine(con):
+ if not _is_sqlalchemy_connectable(con):
raise NotImplementedError("read_sql_table only supported for "
- "SQLAlchemy engines.")
+ "SQLAlchemy connectable.")
import sqlalchemy
from sqlalchemy.schema import MetaData
meta = MetaData(con, schema=schema)
@@ -362,7 +362,7 @@ def read_sql_query(sql, con, index_col=None, coerce_float=True, params=None,
----------
sql : string
SQL query to be executed
- con : SQLAlchemy engine or sqlite3 DBAPI2 connection
+ con : SQLAlchemy connectable(engine/connection) or sqlite3 DBAPI2 connection
Using SQLAlchemy makes it possible to use any DB supported by that
library.
If a DBAPI2 object, only sqlite3 is supported.
@@ -420,7 +420,7 @@ def read_sql(sql, con, index_col=None, coerce_float=True, params=None,
----------
sql : string
SQL query to be executed or database table name.
- con : SQLAlchemy engine or DBAPI2 connection (fallback mode)
+ con : SQLAlchemy connectable(engine/connection) or DBAPI2 connection (fallback mode)
Using SQLAlchemy makes it possible to use any DB supported by that
library.
If a DBAPI2 object, only sqlite3 is supported.
@@ -504,14 +504,14 @@ def to_sql(frame, name, con, flavor='sqlite', schema=None, if_exists='fail',
frame : DataFrame
name : string
Name of SQL table
- con : SQLAlchemy engine or sqlite3 DBAPI2 connection
+ con : SQLAlchemy connectable(engine/connection) or sqlite3 DBAPI2 connection
Using SQLAlchemy makes it possible to use any DB supported by that
library.
If a DBAPI2 object, only sqlite3 is supported.
flavor : {'sqlite', 'mysql'}, default 'sqlite'
- The flavor of SQL to use. Ignored when using SQLAlchemy engine.
+ The flavor of SQL to use. Ignored when using SQLAlchemy connectable.
'mysql' is deprecated and will be removed in future versions, but it
- will be further supported through SQLAlchemy engines.
+ will be further supported through SQLAlchemy connectables.
schema : string, default None
Name of SQL schema in database to write to (if database flavor
supports this). If None, use default schema (default).
@@ -557,14 +557,14 @@ def has_table(table_name, con, flavor='sqlite', schema=None):
----------
table_name: string
Name of SQL table
- con: SQLAlchemy engine or sqlite3 DBAPI2 connection
+ con: SQLAlchemy connectable(engine/connection) or sqlite3 DBAPI2 connection
Using SQLAlchemy makes it possible to use any DB supported by that
library.
If a DBAPI2 object, only sqlite3 is supported.
flavor: {'sqlite', 'mysql'}, default 'sqlite'
- The flavor of SQL to use. Ignored when using SQLAlchemy engine.
+ The flavor of SQL to use. Ignored when using SQLAlchemy connectable.
'mysql' is deprecated and will be removed in future versions, but it
- will be further supported through SQLAlchemy engines.
+ will be further supported through SQLAlchemy connectables.
schema : string, default None
Name of SQL schema in database to write to (if database flavor supports
this). If None, use default schema (default).
@@ -581,7 +581,7 @@ def has_table(table_name, con, flavor='sqlite', schema=None):
_MYSQL_WARNING = ("The 'mysql' flavor with DBAPI connection is deprecated "
"and will be removed in future versions. "
- "MySQL will be further supported with SQLAlchemy engines.")
+ "MySQL will be further supported with SQLAlchemy connectables.")
def pandasSQL_builder(con, flavor=None, schema=None, meta=None,
@@ -592,7 +592,7 @@ def pandasSQL_builder(con, flavor=None, schema=None, meta=None,
"""
# When support for DBAPI connections is removed,
# is_cursor should not be necessary.
- if _is_sqlalchemy_engine(con):
+ if _is_sqlalchemy_connectable(con):
return SQLDatabase(con, schema=schema, meta=meta)
else:
if flavor == 'mysql':
@@ -637,7 +637,7 @@ def exists(self):
def sql_schema(self):
from sqlalchemy.schema import CreateTable
- return str(CreateTable(self.table).compile(self.pd_sql.engine))
+ return str(CreateTable(self.table).compile(self.pd_sql.connectable))
def _execute_create(self):
# Inserting table into database, add to MetaData object
@@ -982,11 +982,11 @@ class PandasSQL(PandasObject):
"""
def read_sql(self, *args, **kwargs):
- raise ValueError("PandasSQL must be created with an SQLAlchemy engine"
+ raise ValueError("PandasSQL must be created with an SQLAlchemy connectable"
" or connection+sql flavor")
def to_sql(self, *args, **kwargs):
- raise ValueError("PandasSQL must be created with an SQLAlchemy engine"
+ raise ValueError("PandasSQL must be created with an SQLAlchemy connectable"
" or connection+sql flavor")
@@ -997,8 +997,8 @@ class SQLDatabase(PandasSQL):
Parameters
----------
- engine : SQLAlchemy engine
- Engine to connect with the database. Using SQLAlchemy makes it
+ engine : SQLAlchemy connectable
+ Connectable to connect with the database. Using SQLAlchemy makes it
possible to use any DB supported by that library.
schema : string, default None
Name of SQL schema in database to write to (if database flavor
@@ -1011,19 +1011,24 @@ class SQLDatabase(PandasSQL):
"""
def __init__(self, engine, schema=None, meta=None):
- self.engine = engine
+ self.connectable = engine
if not meta:
from sqlalchemy.schema import MetaData
- meta = MetaData(self.engine, schema=schema)
+ meta = MetaData(self.connectable, schema=schema)
self.meta = meta
+ @contextmanager
def run_transaction(self):
- return self.engine.begin()
+ with self.connectable.begin() as tx:
+ if hasattr(tx, 'execute'):
+ yield tx
+ else:
+ yield self.connectable
def execute(self, *args, **kwargs):
- """Simple passthrough to SQLAlchemy engine"""
- return self.engine.execute(*args, **kwargs)
+ """Simple passthrough to SQLAlchemy connectable"""
+ return self.connectable.execute(*args, **kwargs)
def read_table(self, table_name, index_col=None, coerce_float=True,
parse_dates=None, columns=None, schema=None,
@@ -1191,7 +1196,13 @@ def to_sql(self, frame, name, if_exists='fail', index=True,
table.create()
table.insert(chunksize)
# check for potentially case sensitivity issues (GH7815)
- if name not in self.engine.table_names(schema=schema or self.meta.schema):
+ engine = self.connectable.engine
+ with self.connectable.connect() as conn:
+ table_names = engine.table_names(
+ schema=schema or self.meta.schema,
+ connection=conn,
+ )
+ if name not in table_names:
warnings.warn("The provided table name '{0}' is not found exactly "
"as such in the database after writing the table, "
"possibly due to case sensitivity issues. Consider "
@@ -1202,7 +1213,11 @@ def tables(self):
return self.meta.tables
def has_table(self, name, schema=None):
- return self.engine.has_table(name, schema or self.meta.schema)
+ return self.connectable.run_callable(
+ self.connectable.dialect.has_table,
+ name,
+ schema or self.meta.schema,
+ )
def get_table(self, table_name, schema=None):
schema = schema or self.meta.schema
@@ -1221,7 +1236,7 @@ def get_table(self, table_name, schema=None):
def drop_table(self, table_name, schema=None):
schema = schema or self.meta.schema
- if self.engine.has_table(table_name, schema):
+ if self.has_table(table_name, schema):
self.meta.reflect(only=[table_name], schema=schema)
self.get_table(table_name, schema).drop()
self.meta.clear()
@@ -1610,12 +1625,12 @@ def get_schema(frame, name, flavor='sqlite', keys=None, con=None, dtype=None):
name : string
name of SQL table
flavor : {'sqlite', 'mysql'}, default 'sqlite'
- The flavor of SQL to use. Ignored when using SQLAlchemy engine.
+ The flavor of SQL to use. Ignored when using SQLAlchemy connectable.
'mysql' is deprecated and will be removed in future versions, but it
will be further supported through SQLAlchemy engines.
keys : string or sequence
columns to use a primary key
- con: an open SQL database connection object or an SQLAlchemy engine
+ con: an open SQL database connection object or a SQLAlchemy connectable
Using SQLAlchemy makes it possible to use any DB supported by that
library.
If a DBAPI2 object, only sqlite3 is supported.
@@ -1673,8 +1688,8 @@ def write_frame(frame, name, con, flavor='sqlite', if_exists='fail', **kwargs):
- With ``to_sql`` the index is written to the sql database by default. To
keep the behaviour this function you need to specify ``index=False``.
- - The new ``to_sql`` function supports sqlalchemy engines to work with
- different sql flavors.
+ - The new ``to_sql`` function supports sqlalchemy connectables to work
+ with different sql flavors.
See also
--------
diff --git a/pandas/io/tests/test_sql.py b/pandas/io/tests/test_sql.py
index d8bc3c61f68f0..ba951c7cb513d 100644
--- a/pandas/io/tests/test_sql.py
+++ b/pandas/io/tests/test_sql.py
@@ -9,7 +9,8 @@
- `TestSQLiteFallbackApi`: test the public API with a sqlite DBAPI connection
- Tests for the different SQL flavors (flavor specific type conversions)
- Tests for the sqlalchemy mode: `_TestSQLAlchemy` is the base class with
- common methods, the different tested flavors (sqlite3, MySQL, PostgreSQL)
+ common methods, `_TestSQLAlchemyConn` tests the API with a SQLAlchemy
+ Connection object. The different tested flavors (sqlite3, MySQL, PostgreSQL)
derive from the base class
- Tests for the fallback mode (`TestSQLiteFallback` and `TestMySQLLegacy`)
@@ -43,6 +44,8 @@
import sqlalchemy
import sqlalchemy.schema
import sqlalchemy.sql.sqltypes as sqltypes
+ from sqlalchemy.ext import declarative
+ from sqlalchemy.orm import session as sa_session
SQLALCHEMY_INSTALLED = True
except ImportError:
SQLALCHEMY_INSTALLED = False
@@ -867,6 +870,31 @@ def test_sqlalchemy_type_mapping(self):
self.assertTrue(isinstance(table.table.c['time'].type, sqltypes.DateTime))
+class _EngineToConnMixin(object):
+ """
+ A mixin that causes setup_connect to create a conn rather than an engine.
+ """
+
+ def setUp(self):
+ super(_EngineToConnMixin, self).setUp()
+ engine = self.conn
+ conn = engine.connect()
+ self.__tx = conn.begin()
+ self.pandasSQL = sql.SQLDatabase(conn)
+ self.__engine = engine
+ self.conn = conn
+
+ def tearDown(self):
+ self.__tx.rollback()
+ self.conn.close()
+ self.conn = self.__engine
+ self.pandasSQL = sql.SQLDatabase(self.__engine)
+
+
+class TestSQLApiConn(_EngineToConnMixin, TestSQLApi):
+ pass
+
+
class TestSQLiteFallbackApi(_TestSQLApi):
"""
Test the public sqlite connection fallback API
@@ -1003,9 +1031,6 @@ def setup_connect(self):
except sqlalchemy.exc.OperationalError:
raise nose.SkipTest("Can't connect to {0} server".format(self.flavor))
- def tearDown(self):
- raise NotImplementedError()
-
def test_aread_sql(self):
self._read_sql_iris()
@@ -1359,9 +1384,58 @@ def test_double_precision(self):
self.assertTrue(isinstance(col_dict['i32'].type, sqltypes.Integer))
self.assertTrue(isinstance(col_dict['i64'].type, sqltypes.BigInteger))
+ def test_connectable_issue_example(self):
+ # This tests the example raised in issue
+ # https://github.com/pydata/pandas/issues/10104
+
+ def foo(connection):
+ query = 'SELECT test_foo_data FROM test_foo_data'
+ return sql.read_sql_query(query, con=connection)
+
+ def bar(connection, data):
+ data.to_sql(name='test_foo_data', con=connection, if_exists='append')
+
+ def main(connectable):
+ with connectable.connect() as conn:
+ with conn.begin():
+ foo_data = conn.run_callable(foo)
+ conn.run_callable(bar, foo_data)
+
+ DataFrame({'test_foo_data': [0, 1, 2]}).to_sql('test_foo_data', self.conn)
+ main(self.conn)
+
+ def test_temporary_table(self):
+ test_data = u'Hello, World!'
+ expected = DataFrame({'spam': [test_data]})
+ Base = declarative.declarative_base()
+
+ class Temporary(Base):
+ __tablename__ = 'temp_test'
+ __table_args__ = {'prefixes': ['TEMPORARY']}
+ id = sqlalchemy.Column(sqlalchemy.Integer, primary_key=True)
+ spam = sqlalchemy.Column(sqlalchemy.Unicode(30), nullable=False)
+
+ Session = sa_session.sessionmaker(bind=self.conn)
+ session = Session()
+ with session.transaction:
+ conn = session.connection()
+ Temporary.__table__.create(conn)
+ session.add(Temporary(spam=test_data))
+ session.flush()
+ df = sql.read_sql_query(
+ sql=sqlalchemy.select([Temporary.spam]),
+ con=conn,
+ )
+
+ tm.assert_frame_equal(df, expected)
+
+
+class _TestSQLAlchemyConn(_EngineToConnMixin, _TestSQLAlchemy):
+ def test_transactions(self):
+ raise nose.SkipTest("Nested transactions rollbacks don't work with Pandas")
-class TestSQLiteAlchemy(_TestSQLAlchemy):
+class _TestSQLiteAlchemy(object):
"""
Test the sqlalchemy backend against an in-memory sqlite database.
@@ -1378,8 +1452,8 @@ def setup_driver(cls):
cls.driver = None
def tearDown(self):
+ super(_TestSQLiteAlchemy, self).tearDown()
# in memory so tables should not be removed explicitly
- pass
def test_default_type_conversion(self):
df = sql.read_sql_table("types_test_data", self.conn)
@@ -1417,7 +1491,7 @@ def test_bigint_warning(self):
self.assertEqual(len(w), 0, "Warning triggered for other table")
-class TestMySQLAlchemy(_TestSQLAlchemy):
+class _TestMySQLAlchemy(object):
"""
Test the sqlalchemy backend against an MySQL database.
@@ -1438,6 +1512,7 @@ def setup_driver(cls):
raise nose.SkipTest('pymysql not installed')
def tearDown(self):
+ super(_TestMySQLAlchemy, self).tearDown()
c = self.conn.execute('SHOW TABLES')
for table in c.fetchall():
self.conn.execute('DROP TABLE %s' % table[0])
@@ -1491,7 +1566,7 @@ def test_read_procedure(self):
tm.assert_frame_equal(df, res2)
-class TestPostgreSQLAlchemy(_TestSQLAlchemy):
+class _TestPostgreSQLAlchemy(object):
"""
Test the sqlalchemy backend against an PostgreSQL database.
@@ -1512,6 +1587,7 @@ def setup_driver(cls):
raise nose.SkipTest('psycopg2 not installed')
def tearDown(self):
+ super(_TestPostgreSQLAlchemy, self).tearDown()
c = self.conn.execute(
"SELECT table_name FROM information_schema.tables"
" WHERE table_schema = 'public'")
@@ -1563,15 +1639,18 @@ def test_schema_support(self):
## specifying schema in user-provided meta
- engine2 = self.connect()
- meta = sqlalchemy.MetaData(engine2, schema='other')
- pdsql = sql.SQLDatabase(engine2, meta=meta)
- pdsql.to_sql(df, 'test_schema_other2', index=False)
- pdsql.to_sql(df, 'test_schema_other2', index=False, if_exists='replace')
- pdsql.to_sql(df, 'test_schema_other2', index=False, if_exists='append')
- res1 = sql.read_sql_table('test_schema_other2', self.conn, schema='other')
- res2 = pdsql.read_table('test_schema_other2')
- tm.assert_frame_equal(res1, res2)
+ # The schema won't be applied on another Connection
+ # because of transactional schemas
+ if isinstance(self.conn, sqlalchemy.engine.Engine):
+ engine2 = self.connect()
+ meta = sqlalchemy.MetaData(engine2, schema='other')
+ pdsql = sql.SQLDatabase(engine2, meta=meta)
+ pdsql.to_sql(df, 'test_schema_other2', index=False)
+ pdsql.to_sql(df, 'test_schema_other2', index=False, if_exists='replace')
+ pdsql.to_sql(df, 'test_schema_other2', index=False, if_exists='append')
+ res1 = sql.read_sql_table('test_schema_other2', self.conn, schema='other')
+ res2 = pdsql.read_table('test_schema_other2')
+ tm.assert_frame_equal(res1, res2)
def test_datetime_with_time_zone(self):
# Test to see if we read the date column with timezones that
@@ -1587,6 +1666,31 @@ def test_datetime_with_time_zone(self):
# "2000-06-01 00:00:00-07:00" should convert to "2000-06-01 07:00:00"
self.assertEqual(df.DateColWithTz[1], Timestamp('2000-06-01 07:00:00'))
+
+class TestMySQLAlchemy(_TestMySQLAlchemy, _TestSQLAlchemy):
+ pass
+
+
+class TestMySQLAlchemyConn(_TestMySQLAlchemy, _TestSQLAlchemyConn):
+ pass
+
+
+class TestPostgreSQLAlchemy(_TestPostgreSQLAlchemy, _TestSQLAlchemy):
+ pass
+
+
+class TestPostgreSQLAlchemyConn(_TestPostgreSQLAlchemy, _TestSQLAlchemyConn):
+ pass
+
+
+class TestSQLiteAlchemy(_TestSQLiteAlchemy, _TestSQLAlchemy):
+ pass
+
+
+class TestSQLiteAlchemyConn(_TestSQLiteAlchemy, _TestSQLAlchemyConn):
+ pass
+
+
#------------------------------------------------------------------------------
#--- Test Sqlite / MySQL fallback
diff --git a/pandas/tests/test_tseries.py b/pandas/tests/test_tseries.py
index 035b3ac07342d..56ac0cdc65c3e 100644
--- a/pandas/tests/test_tseries.py
+++ b/pandas/tests/test_tseries.py
@@ -2,7 +2,7 @@
import nose
from numpy import nan
import numpy as np
-from pandas import Index, isnull, Timestamp
+from pandas import Index, isnull, Timestamp, to_datetime, NaT
from pandas.util.testing import assert_almost_equal
import pandas.util.testing as tm
from pandas.compat import range, lrange, zip
@@ -750,6 +750,24 @@ def test_both_offset_observance_raises(self):
h = Holiday("Cyber Monday", month=11, day=1,
offset=[DateOffset(weekday=SA(4))], observance=next_monday)
+class TestDaysInMonth(tm.TestCase):
+ def test_day_not_in_month_coerce_true_NaT(self):
+ self.assertTrue(isnull(to_datetime('2015-02-29', coerce=True)))
+ self.assertTrue(isnull(to_datetime('2015-02-29', format="%Y-%m-%d", coerce=True)))
+ self.assertTrue(isnull(to_datetime('2015-02-32', format="%Y-%m-%d", coerce=True)))
+ self.assertTrue(isnull(to_datetime('2015-04-31', format="%Y-%m-%d", coerce=True)))
+ def test_day_not_in_month_coerce_false_raise(self):
+ self.assertRaises(ValueError, to_datetime, '2015-02-29', errors='raise', coerce=False)
+ self.assertRaises(ValueError, to_datetime, '2015-02-29', errors='raise', format="%Y-%m-%d", coerce=False)
+ self.assertRaises(ValueError, to_datetime, '2015-02-32', errors='raise', format="%Y-%m-%d", coerce=False)
+ self.assertRaises(ValueError, to_datetime, '2015-04-31', errors='raise', format="%Y-%m-%d", coerce=False)
+ def test_day_not_in_month_coerce_false_ignore(self):
+ self.assertRaises(ValueError, to_datetime, '2015-02-29', errors='ignore', coerce=False)
+ self.assertRaises(ValueError, to_datetime, '2015-02-29', errors='ignore', format="%Y-%m-%d", coerce=False)
+ self.assertRaises(ValueError, to_datetime, '2015-02-32', errors='ignore', format="%Y-%m-%d", coerce=False)
+ self.assertRaises(ValueError, to_datetime, '2015-04-31', errors='ignore', format="%Y-%m-%d", coerce=False)
+
+
if __name__ == '__main__':
import nose
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
diff --git a/pandas/tslib.pyx b/pandas/tslib.pyx
index b3a6059db384f..0772509987a9c 100644
--- a/pandas/tslib.pyx
+++ b/pandas/tslib.pyx
@@ -2760,17 +2760,24 @@ def array_strptime(ndarray[object] values, object fmt, bint exact=True, bint coe
# Cannot pre-calculate datetime_date() since can change in Julian
# calculation and thus could have different value for the day of the wk
# calculation.
- if julian == -1:
- # Need to add 1 to result since first day of the year is 1, not 0.
- julian = datetime_date(year, month, day).toordinal() - \
- datetime_date(year, 1, 1).toordinal() + 1
- else: # Assume that if they bothered to include Julian day it will
- # be accurate.
- datetime_result = datetime_date.fromordinal(
- (julian - 1) + datetime_date(year, 1, 1).toordinal())
- year = datetime_result.year
- month = datetime_result.month
- day = datetime_result.day
+ try:
+ if julian == -1:
+ # Need to add 1 to result since first day of the year is 1, not 0.
+ julian = datetime_date(year, month, day).toordinal() - \
+ datetime_date(year, 1, 1).toordinal() + 1
+
+ else: # Assume that if they bothered to include Julian day it will
+ # be accurate.
+ datetime_result = datetime_date.fromordinal(
+ (julian - 1) + datetime_date(year, 1, 1).toordinal())
+ year = datetime_result.year
+ month = datetime_result.month
+ day = datetime_result.day
+ except ValueError:
+ if coerce:
+ iresult[i] = iNaT
+ continue
+ raise
if weekday == -1:
weekday = datetime_date(year, month, day).weekday()
| closes #10154 to_datetime, Inconsistent behavior with invalid dates.
results are now
```
In [2]: pd.to_datetime('2015-02-29', format="%Y-%m-%d", coerce=True)
Out[2]: NaT
In [3]: pd.to_datetime('2015-03-32', format="%Y-%m-%d", coerce=True)
Out[3]: NaT
In [4]: pd.to_datetime('2015-02-32', format="%Y-%m-%d", coerce=True)
Out[4]: NaT
In [5]: pd.to_datetime('2015-04-31', format="%Y-%m-%d", coerce=True)
Out[5]: NaT
```
| https://api.github.com/repos/pandas-dev/pandas/pulls/10216 | 2015-05-27T13:04:55Z | 2015-07-06T17:41:14Z | null | 2015-07-06T17:41:14Z |
BUG: plot doesnt default to matplotlib axes.grid setting (#9792) | diff --git a/doc/source/whatsnew/v0.17.0.txt b/doc/source/whatsnew/v0.17.0.txt
index d7955d7210ade..a7917e81f7057 100644
--- a/doc/source/whatsnew/v0.17.0.txt
+++ b/doc/source/whatsnew/v0.17.0.txt
@@ -76,5 +76,6 @@ Bug Fixes
- Bug in ``DatetimeIndex`` and ``TimedeltaIndex`` names are lost after timedelta arithmetics ( :issue:`9926`)
- Bug in `Series.plot(label="LABEL")` not correctly setting the label (:issue:`10119`)
+- Bug in `plot` not defaulting to matplotlib `axes.grid` setting (:issue:`9792`)
diff --git a/pandas/tests/test_graphics.py b/pandas/tests/test_graphics.py
index 4c9d5a9207dd7..82f4b8c05ca06 100644
--- a/pandas/tests/test_graphics.py
+++ b/pandas/tests/test_graphics.py
@@ -439,6 +439,38 @@ def _check_box_return_type(self, returned, return_type, expected_keys=None,
else:
raise AssertionError
+ def _check_grid_settings(self, obj, kinds, kws={}):
+ # Make sure plot defaults to rcParams['axes.grid'] setting, GH 9792
+
+ import matplotlib as mpl
+
+ def is_grid_on():
+ xoff = all(not g.gridOn for g in self.plt.gca().xaxis.get_major_ticks())
+ yoff = all(not g.gridOn for g in self.plt.gca().yaxis.get_major_ticks())
+ return not(xoff and yoff)
+
+ spndx=1
+ for kind in kinds:
+ self.plt.subplot(1,4*len(kinds),spndx); spndx+=1
+ mpl.rc('axes',grid=False)
+ obj.plot(kind=kind, **kws)
+ self.assertFalse(is_grid_on())
+
+ self.plt.subplot(1,4*len(kinds),spndx); spndx+=1
+ mpl.rc('axes',grid=True)
+ obj.plot(kind=kind, grid=False, **kws)
+ self.assertFalse(is_grid_on())
+
+ if kind != 'pie':
+ self.plt.subplot(1,4*len(kinds),spndx); spndx+=1
+ mpl.rc('axes',grid=True)
+ obj.plot(kind=kind, **kws)
+ self.assertTrue(is_grid_on())
+
+ self.plt.subplot(1,4*len(kinds),spndx); spndx+=1
+ mpl.rc('axes',grid=False)
+ obj.plot(kind=kind, grid=True, **kws)
+ self.assertTrue(is_grid_on())
@tm.mplskip
class TestSeriesPlots(TestPlotBase):
@@ -1108,6 +1140,12 @@ def test_table(self):
_check_plot_works(self.series.plot, table=True)
_check_plot_works(self.series.plot, table=self.series)
+ @slow
+ def test_series_grid_settings(self):
+ # Make sure plot defaults to rcParams['axes.grid'] setting, GH 9792
+ self._check_grid_settings(Series([1,2,3]),
+ plotting._series_kinds + plotting._common_kinds)
+
@tm.mplskip
class TestDataFramePlots(TestPlotBase):
@@ -3426,6 +3464,12 @@ def test_sharey_and_ax(self):
"y label is invisible but shouldn't")
+ @slow
+ def test_df_grid_settings(self):
+ # Make sure plot defaults to rcParams['axes.grid'] setting, GH 9792
+ self._check_grid_settings(DataFrame({'a':[1,2,3],'b':[2,3,4]}),
+ plotting._dataframe_kinds, kws={'x':'a','y':'b'})
+
@tm.mplskip
class TestDataFrameGroupByPlots(TestPlotBase):
diff --git a/pandas/tools/plotting.py b/pandas/tools/plotting.py
index 04dd4d3395684..76685e2589012 100644
--- a/pandas/tools/plotting.py
+++ b/pandas/tools/plotting.py
@@ -810,7 +810,7 @@ def __init__(self, data, kind=None, by=None, subplots=False, sharex=None,
self.rot = self._default_rot
if grid is None:
- grid = False if secondary_y else True
+ grid = False if secondary_y else self.plt.rcParams['axes.grid']
self.grid = grid
self.legend = legend
| Closes #9792 .
| https://api.github.com/repos/pandas-dev/pandas/pulls/10212 | 2015-05-26T23:08:37Z | 2015-05-27T02:48:47Z | 2015-05-27T02:48:47Z | 2015-06-02T19:26:12Z |
ENH: less verbose merging on index | diff --git a/pandas/tools/merge.py b/pandas/tools/merge.py
index c7c578232cd0f..15e7f1f2e8e0e 100644
--- a/pandas/tools/merge.py
+++ b/pandas/tools/merge.py
@@ -166,6 +166,11 @@ def __init__(self, left, right, how='inner', on=None,
self.how = how
self.axis = axis
+ if on is Index:
+ on = None
+ left_index = True
+ right_index = True
+
self.on = com._maybe_make_list(on)
self.left_on = com._maybe_make_list(left_on)
self.right_on = com._maybe_make_list(right_on)
| This is a proposal for a simple API enhancement that would make merging on indices much more convenient. I've put in an initial commit to show the change needed in the library. Here's the old way of merging on indices:
``` python
In [1]: from pandas import Index, DataFrame, merge
In [2]: df1 = DataFrame({'data1':[0, 1, 2]})
In [3]: df2 = DataFrame({'data2':[3, 4, 5]})
In [4]: merge(df1, df2, left_index=True, right_index=True)
Out[4]:
data1 data2
0 0 3
1 1 4
2 2 5
```
Here is the new behavior enabled by this PR:
``` python
In [5]: merge(df1, df2, on=Index)
Out[5]:
data1 data2
0 0 3
1 1 4
2 2 5
```
This is a bit hackish, I admit, but I find myself wanting to do this often and the alternatives (using `left_index` and `right_index`, or using `concat([df1, df2], axis='cols')`) are inconvenient and less clear to the reader of the code. That said, I completely understand if folks think this is not a good fit for the pandas API.
Any thoughts on this idea?
| https://api.github.com/repos/pandas-dev/pandas/pulls/10211 | 2015-05-26T20:04:53Z | 2015-07-28T22:04:14Z | null | 2015-07-28T22:04:14Z |
Update bq link | diff --git a/README.md b/README.md
index c76fbe7df9e6b..8623ee170d154 100644
--- a/README.md
+++ b/README.md
@@ -123,7 +123,7 @@ conda install pandas
- xlrd >= 0.9.0
- [XlsxWriter](https://pypi.python.org/pypi/XlsxWriter)
- Alternative Excel writer.
-- [Google bq Command Line Tool](https://developers.google.com/bigquery/bq-command-line-tool/)
+- [Google bq Command Line Tool](https://cloud.google.com/bigquery/bq-command-line-tool)
- Needed for `pandas.io.gbq`
- [boto](https://pypi.python.org/pypi/boto): necessary for Amazon S3 access.
- One of the following combinations of libraries is needed to use the
| https://api.github.com/repos/pandas-dev/pandas/pulls/10210 | 2015-05-26T16:32:54Z | 2015-05-26T17:28:24Z | 2015-05-26T17:28:24Z | 2015-05-26T17:28:26Z | |
DOC: Added nlargest/nsmallest to API docs | diff --git a/doc/source/api.rst b/doc/source/api.rst
index 3b2e8b65768bb..f5ba03afc9f19 100644
--- a/doc/source/api.rst
+++ b/doc/source/api.rst
@@ -358,6 +358,8 @@ Computations / Descriptive Stats
Series.median
Series.min
Series.mode
+ Series.nlargest
+ Series.nsmallest
Series.pct_change
Series.prod
Series.quantile
| Fixes #10145
| https://api.github.com/repos/pandas-dev/pandas/pulls/10206 | 2015-05-25T18:00:24Z | 2015-05-26T10:32:56Z | 2015-05-26T10:32:56Z | 2015-06-02T19:26:12Z |
Issue #10174. Add 'interpolation' keyword in DataFrame.quantile and Series.quantile | diff --git a/doc/source/whatsnew/v0.18.0.txt b/doc/source/whatsnew/v0.18.0.txt
index d78065765b90b..498cfaf838320 100644
--- a/doc/source/whatsnew/v0.18.0.txt
+++ b/doc/source/whatsnew/v0.18.0.txt
@@ -111,6 +111,7 @@ Other enhancements
- ``sys.getsizeof(obj)`` returns the memory usage of a pandas object, including the
values it contains (:issue:`11597`)
- ``Series`` gained an ``is_unique`` attribute (:issue:`11946`)
+- ``DataFrame.quantile`` and ``Series.quantile`` now accept ``interpolation`` keyword (:issue:`10174`).
.. _whatsnew_0180.enhancements.rounding:
diff --git a/pandas/core/frame.py b/pandas/core/frame.py
index 6207ac5dc5c12..29aaf8c5aa5c2 100644
--- a/pandas/core/frame.py
+++ b/pandas/core/frame.py
@@ -64,6 +64,7 @@
import pandas.algos as _algos
from pandas.core.config import get_option
+from pandas import _np_version_under1p9
#----------------------------------------------------------------------
# Docstring templates
@@ -4874,7 +4875,7 @@ def mode(self, axis=0, numeric_only=False):
f = lambda s: s.mode()
return data.apply(f, axis=axis)
- def quantile(self, q=0.5, axis=0, numeric_only=True):
+ def quantile(self, q=0.5, axis=0, numeric_only=True, interpolation='linear'):
"""
Return values at the given quantile over requested axis, a la
numpy.percentile.
@@ -4885,7 +4886,16 @@ def quantile(self, q=0.5, axis=0, numeric_only=True):
0 <= q <= 1, the quantile(s) to compute
axis : {0, 1, 'index', 'columns'} (default 0)
0 or 'index' for row-wise, 1 or 'columns' for column-wise
-
+ interpolation : {'linear', 'lower', 'higher', 'midpoint', 'nearest'}
+ .. versionadded:: 0.18.0
+ This optional parameter specifies the interpolation method to use,
+ when the desired quantile lies between two data points `i` and `j`:
+ * linear: `i + (j - i) * fraction`, where `fraction` is the
+ fractional part of the index surrounded by `i` and `j`.
+ * lower: `i`.
+ * higher: `j`.
+ * nearest: `i` or `j` whichever is nearest.
+ * midpoint: (`i` + `j`) / 2.
Returns
-------
@@ -4920,7 +4930,12 @@ def quantile(self, q=0.5, axis=0, numeric_only=True):
else:
squeeze = False
- def f(arr, per):
+ if _np_version_under1p9:
+ if interpolation != 'linear':
+ raise ValueError("Interpolation methods"
+ " other than linear not supported in numpy < 1.9")
+
+ def f(arr, per,interpolation):
if arr._is_datelike_mixed_type:
values = _values_from_object(arr).view('i8')
else:
@@ -4929,7 +4944,10 @@ def f(arr, per):
if len(values) == 0:
return NA
else:
- return _quantile(values, per)
+ if _np_version_under1p9:
+ return _quantile(values, per)
+ else:
+ return _quantile(values, per, interpolation=interpolation)
data = self._get_numeric_data() if numeric_only else self
@@ -4943,7 +4961,7 @@ def f(arr, per):
is_dt_col = data.dtypes.map(com.is_datetime64_dtype)
is_dt_col = is_dt_col[is_dt_col].index
- quantiles = [[f(vals, x) for x in per]
+ quantiles = [[f(vals, x, interpolation) for x in per]
for (_, vals) in data.iteritems()]
result = self._constructor(quantiles, index=data._info_axis,
diff --git a/pandas/core/series.py b/pandas/core/series.py
index 9910966bd4d2c..4cf16804408d3 100644
--- a/pandas/core/series.py
+++ b/pandas/core/series.py
@@ -58,6 +58,8 @@
from numpy import percentile as _quantile
from pandas.core.config import get_option
+from pandas import _np_version_under1p9
+
__all__ = ['Series']
@@ -1261,7 +1263,7 @@ def round(self, decimals=0):
return result
- def quantile(self, q=0.5):
+ def quantile(self, q=0.5, interpolation='linear'):
"""
Return value at the given quantile, a la numpy.percentile.
@@ -1269,6 +1271,16 @@ def quantile(self, q=0.5):
----------
q : float or array-like, default 0.5 (50% quantile)
0 <= q <= 1, the quantile(s) to compute
+ interpolation : {'linear', 'lower', 'higher', 'midpoint', 'nearest'}
+ .. versionadded:: 0.18.0
+ This optional parameter specifies the interpolation method to use,
+ when the desired quantile lies between two data points `i` and `j`:
+ * linear: `i + (j - i) * fraction`, where `fraction` is the
+ fractional part of the index surrounded by `i` and `j`.
+ * lower: `i`.
+ * higher: `j`.
+ * nearest: `i` or `j` whichever is nearest.
+ * midpoint: (`i` + `j`) / 2.
Returns
-------
@@ -1291,17 +1303,26 @@ def quantile(self, q=0.5):
valid = self.dropna()
self._check_percentile(q)
- def multi(values, qs):
+ if _np_version_under1p9:
+ if interpolation != 'linear':
+ raise ValueError("Interpolation methods"
+ " other than linear not supported in numpy < 1.9.")
+
+ def multi(values,qs,**kwargs):
if com.is_list_like(qs):
- values = [_quantile(values, x*100) for x in qs]
+ values = [_quantile(values, x*100, **kwargs) for x in qs]
# let empty result to be Float64Index
qs = Float64Index(qs)
return self._constructor(values, index=qs, name=self.name)
else:
- return _quantile(values, qs*100)
-
- return self._maybe_box(lambda values: multi(values, q), dropna=True)
+ return _quantile(values, qs*100, **kwargs)
+
+ kwargs = dict()
+ if not _np_version_under1p9:
+ kwargs.update({'interpolation':interpolation})
+ return self._maybe_box(lambda values: multi(values,q,**kwargs), dropna=True)
+
def corr(self, other, method='pearson',
min_periods=None):
"""
diff --git a/pandas/tests/test_frame.py b/pandas/tests/test_frame.py
index b6b81caccf9d5..c20c704b957a7 100644
--- a/pandas/tests/test_frame.py
+++ b/pandas/tests/test_frame.py
@@ -55,6 +55,7 @@
import pandas.lib as lib
from numpy.testing.decorators import slow
+from pandas import _np_version_under1p9
#---------------------------------------------------------------------
# DataFrame test cases
@@ -13642,6 +13643,93 @@ def test_quantile_axis_parameter(self):
self.assertRaises(ValueError, df.quantile, 0.1, axis=-1)
self.assertRaises(ValueError, df.quantile, 0.1, axis="column")
+ def test_quantile_interpolation(self):
+ # GH #10174
+ if _np_version_under1p9:
+ raise nose.SkipTest("Numpy version under 1.9")
+
+ from numpy import percentile
+
+ #interpolation = linear (default case)
+ q = self.tsframe.quantile(0.1, axis=0,interpolation='linear')
+ self.assertEqual(q['A'], percentile(self.tsframe['A'], 10))
+ q = self.intframe.quantile(0.1)
+ self.assertEqual(q['A'], percentile(self.intframe['A'], 10))
+
+ q1 = self.intframe.quantile(0.1)
+ self.assertEqual(q1['A'], np.percentile(self.intframe['A'], 10))
+ #test with and without interpolation keyword
+ assert_series_equal(q,q1)
+
+ #interpolation method other than default linear
+
+ df = DataFrame({"A": [1, 2, 3], "B": [2, 3, 4]}, index=[1, 2, 3])
+ result = df.quantile(.5, axis=1,interpolation='nearest')
+ expected = Series([1., 2., 3.], index=[1, 2, 3])
+ assert_series_equal(result, expected)
+
+ #axis
+ result = df.quantile([.5, .75], axis=1,interpolation='lower')
+ expected = DataFrame({1: [1., 1.], 2: [2., 2.],
+ 3: [3., 3.]}, index=[0.5, 0.75])
+ assert_frame_equal(result, expected)
+
+ #test degenerate case
+ df = DataFrame({'x': [], 'y': []})
+ q = df.quantile(0.1, axis=0,interpolation='higher')
+ assert(np.isnan(q['x']) and np.isnan(q['y']))
+
+ #multi
+ df = DataFrame([[1, 1, 1], [2, 2, 2], [3, 3, 3]],
+ columns=['a', 'b', 'c'])
+ result = df.quantile([.25, .5],interpolation='midpoint')
+ expected = DataFrame([[1.5, 1.5, 1.5], [2.5, 2.5, 2.5]],
+ index=[.25, .5], columns=['a', 'b', 'c'])
+ assert_frame_equal(result, expected)
+
+
+ def test_quantile_interpolation_np_lt_1p9(self):
+ # GH #10174
+ if not _np_version_under1p9:
+ raise nose.SkipTest("Numpy version is greater than 1.9")
+
+ from numpy import percentile
+
+ #interpolation = linear (default case)
+ q = self.tsframe.quantile(0.1, axis=0,interpolation='linear')
+ self.assertEqual(q['A'], percentile(self.tsframe['A'], 10))
+ q = self.intframe.quantile(0.1)
+ self.assertEqual(q['A'], percentile(self.intframe['A'], 10))
+
+ q1 = self.intframe.quantile(0.1)
+ self.assertEqual(q1['A'], np.percentile(self.intframe['A'], 10))
+ #test with and without interpolation keyword
+ assert_series_equal(q,q1)
+
+ #interpolation method other than default linear
+
+ expErrMsg = ("Interpolation methods other than linear"
+ " not supported in numpy < 1.9")
+ df = DataFrame({"A": [1, 2, 3], "B": [2, 3, 4]}, index=[1, 2, 3])
+ with assertRaisesRegexp(ValueError,expErrMsg):
+ df.quantile(.5, axis=1,interpolation='nearest')
+
+ with assertRaisesRegexp(ValueError,expErrMsg):
+ df.quantile([.5, .75], axis=1,interpolation='lower')
+
+ # test degenerate case
+ df = DataFrame({'x': [], 'y': []})
+ with assertRaisesRegexp(ValueError,expErrMsg):
+ q = df.quantile(0.1, axis=0,interpolation='higher')
+
+ #multi
+ df = DataFrame([[1, 1, 1], [2, 2, 2], [3, 3, 3]],
+ columns=['a', 'b', 'c'])
+ with assertRaisesRegexp(ValueError,expErrMsg):
+ result = df.quantile([.25, .5],interpolation='midpoint')
+
+
+
def test_quantile_multi(self):
df = DataFrame([[1, 1, 1], [2, 2, 2], [3, 3, 3]],
columns=['a', 'b', 'c'])
diff --git a/pandas/tests/test_series.py b/pandas/tests/test_series.py
index 4a350e7e38091..a4e4e0632a171 100644
--- a/pandas/tests/test_series.py
+++ b/pandas/tests/test_series.py
@@ -20,7 +20,8 @@
import pandas as pd
from pandas import (Index, Series, DataFrame, isnull, notnull, bdate_range, NaT,
- date_range, period_range, timedelta_range, _np_version_under1p8)
+ date_range, period_range, timedelta_range, _np_version_under1p8,
+ _np_version_under1p9)
from pandas.core.index import MultiIndex
from pandas.core.indexing import IndexingError
from pandas.tseries.period import PeriodIndex
@@ -3083,6 +3084,44 @@ def test_quantile_multi(self):
expected = pd.Series([], name=self.ts.name, index=Index([], dtype=float))
assert_series_equal(result, expected)
+ def test_quantile_interpolation(self):
+ # GH #10174
+ if _np_version_under1p9:
+ raise nose.SkipTest("Numpy version is under 1.9")
+
+ from numpy import percentile
+
+ #interpolation = linear (default case)
+ q = self.ts.quantile(0.1,interpolation='linear')
+ self.assertEqual(q, percentile(self.ts.valid(), 10))
+ q1 = self.ts.quantile(0.1)
+ self.assertEqual(q1, percentile(self.ts.valid(), 10))
+
+ #test with and without interpolation keyword
+ self.assertEqual(q,q1)
+
+ def test_quantile_interpolation_np_lt_1p9(self):
+ # GH #10174
+ if not _np_version_under1p9:
+ raise nose.SkipTest("Numpy version is greater than 1.9")
+
+ from numpy import percentile
+
+ #interpolation = linear (default case)
+ q = self.ts.quantile(0.1,interpolation='linear')
+ self.assertEqual(q, percentile(self.ts.valid(), 10))
+ q1 = self.ts.quantile(0.1)
+ self.assertEqual(q1, percentile(self.ts.valid(), 10))
+
+ #interpolation other than linear
+ expErrMsg = "Interpolation methods other than linear not supported in numpy < 1.9"
+ with tm.assertRaisesRegexp(ValueError,expErrMsg):
+ self.ts.quantile(0.9,interpolation='nearest')
+
+ # object dtype
+ with tm.assertRaisesRegexp(ValueError,expErrMsg):
+ q = Series(self.ts,dtype=object).quantile(0.7,interpolation='higher')
+
def test_append(self):
appendedSeries = self.series.append(self.objSeries)
for idx, value in compat.iteritems(appendedSeries):
| Closes #10174.
I have added the new argument to the doc too.
| https://api.github.com/repos/pandas-dev/pandas/pulls/10204 | 2015-05-24T23:06:36Z | 2016-01-07T00:20:49Z | null | 2016-09-18T20:42:20Z |
DOC: Updated to mention axis='index' and axis='columns | diff --git a/pandas/core/frame.py b/pandas/core/frame.py
index ed01323eb9a27..f36108262432d 100644
--- a/pandas/core/frame.py
+++ b/pandas/core/frame.py
@@ -2745,7 +2745,7 @@ def dropna(self, axis=0, how='any', thresh=None, subset=None,
Parameters
----------
- axis : {0, 1}, or tuple/list thereof
+ axis : {0 or 'index', 1 or 'columns'}, or tuple/list thereof
Pass tuple or list to drop on multiple axes
how : {'any', 'all'}
* any : if any NA values are present, drop that label
@@ -2890,7 +2890,7 @@ def sort(self, columns=None, axis=0, ascending=True,
ascending : boolean or list, default True
Sort ascending vs. descending. Specify list for multiple sort
orders
- axis : {0, 1}
+ axis : {0 or 'index', 1 or 'columns'}, default 0
Sort index/rows versus columns
inplace : boolean, default False
Sort the DataFrame without creating a new instance
@@ -2919,7 +2919,7 @@ def sort_index(self, axis=0, by=None, ascending=True, inplace=False,
Parameters
----------
- axis : {0, 1}
+ axis : {0 or 'index', 1 or 'columns'}, default 0
Sort index/rows versus columns
by : object
Column name(s) in frame. Accepts a column name or a list
@@ -3027,7 +3027,7 @@ def sortlevel(self, level=0, axis=0, ascending=True,
Parameters
----------
level : int
- axis : {0, 1}
+ axis : {0 or 'index', 1 or 'columns'}, default 0
ascending : boolean, default True
inplace : boolean, default False
Sort the DataFrame without creating a new instance
@@ -3639,9 +3639,9 @@ def apply(self, func, axis=0, broadcast=False, raw=False, reduce=None,
----------
func : function
Function to apply to each column/row
- axis : {0, 1}
- * 0 : apply function to each column
- * 1 : apply function to each row
+ axis : {0 or 'index', 1 or 'columns'}, default 0
+ * 0 or 'index': apply function to each column
+ * 1 or 'columns': apply function to each row
broadcast : boolean, default False
For aggregation functions, return object of same size with values
propagated
@@ -4162,8 +4162,8 @@ def corrwith(self, other, axis=0, drop=False):
Parameters
----------
other : DataFrame
- axis : {0, 1}
- 0 to compute column-wise, 1 for row-wise
+ axis : {0 or 'index', 1 or 'columns'}, default 0
+ 0 or 'index' to compute column-wise, 1 or 'columns' for row-wise
drop : boolean, default False
Drop missing indices from result, default returns union of all
@@ -4214,8 +4214,8 @@ def count(self, axis=0, level=None, numeric_only=False):
Parameters
----------
- axis : {0, 1}
- 0 for row-wise, 1 for column-wise
+ axis : {0 or 'index', 1 or 'columns'}, default 0
+ 0 or 'index' for row-wise, 1 or 'columns' for column-wise
level : int or level name, default None
If the axis is a MultiIndex (hierarchical), count along a
particular level, collapsing into a DataFrame
@@ -4368,8 +4368,8 @@ def idxmin(self, axis=0, skipna=True):
Parameters
----------
- axis : {0, 1}
- 0 for row-wise, 1 for column-wise
+ axis : {0 or 'index', 1 or 'columns'}, default 0
+ 0 or 'index' for row-wise, 1 or 'columns' for column-wise
skipna : boolean, default True
Exclude NA/null values. If an entire row/column is NA, the result
will be NA
@@ -4399,8 +4399,8 @@ def idxmax(self, axis=0, skipna=True):
Parameters
----------
- axis : {0, 1}
- 0 for row-wise, 1 for column-wise
+ axis : {0 or 'index', 1 or 'columns'}, default 0
+ 0 or 'index' for row-wise, 1 or 'columns' for column-wise
skipna : boolean, default True
Exclude NA/null values. If an entire row/column is NA, the result
will be first index.
@@ -4446,9 +4446,9 @@ def mode(self, axis=0, numeric_only=False):
Parameters
----------
- axis : {0, 1, 'index', 'columns'} (default 0)
- * 0/'index' : get mode of each column
- * 1/'columns' : get mode of each row
+ axis : {0 or 'index', 1 or 'columns'}, default 0
+ * 0 or 'index' : get mode of each column
+ * 1 or 'columns' : get mode of each row
numeric_only : boolean, default False
if True, only apply to numeric columns
@@ -4553,7 +4553,7 @@ def rank(self, axis=0, numeric_only=None, method='average',
Parameters
----------
- axis : {0, 1}, default 0
+ axis : {0 or 'index', 1 or 'columns'}, default 0
Ranks over columns (0) or rows (1)
numeric_only : boolean, default None
Include only float, int, boolean data
@@ -4605,7 +4605,7 @@ def to_timestamp(self, freq=None, how='start', axis=0, copy=True):
how : {'s', 'e', 'start', 'end'}
Convention for converting period to timestamp; start of period
vs. end
- axis : {0, 1} default 0
+ axis : {0 or 'index', 1 or 'columns'}, default 0
The axis to convert (the index by default)
copy : boolean, default True
If false then underlying input data is not copied
@@ -4636,7 +4636,7 @@ def to_period(self, freq=None, axis=0, copy=True):
Parameters
----------
freq : string, default
- axis : {0, 1}, default 0
+ axis : {0 or 'index', 1 or 'columns'}, default 0
The axis to convert (the index by default)
copy : boolean, default True
If False then underlying input data is not copied
| Updated docs throughout DataFrame methods to mention
that axis can be set to 'index' or 'column' instead of 0 or 1
which improves readability significantly.
Fixes #9658
| https://api.github.com/repos/pandas-dev/pandas/pulls/10202 | 2015-05-23T13:20:21Z | 2015-05-25T14:17:18Z | 2015-05-25T14:17:18Z | 2015-06-02T19:26:12Z |
DOC: minor doc fix for Series.append; indices can overlap | diff --git a/pandas/core/series.py b/pandas/core/series.py
index 8ef9adb1d24a4..6367fb4fe0396 100644
--- a/pandas/core/series.py
+++ b/pandas/core/series.py
@@ -1442,7 +1442,7 @@ def searchsorted(self, v, side='left', sorter=None):
def append(self, to_append, verify_integrity=False):
"""
- Concatenate two or more Series. The indexes must not overlap
+ Concatenate two or more Series.
Parameters
----------
| Old docstring seemed to be incorrect; overlapping indices are supported e.g.
``` python
>>> import pandas as pd
>>> x = pd.Series(['A', 'B', 'C'])
>>> y = pd.Series(['D', 'E', 'F'])
>>> x.append(y)
0 A
1 B
2 C
0 D
1 E
2 F
dtype: object
```
| https://api.github.com/repos/pandas-dev/pandas/pulls/10200 | 2015-05-22T20:57:41Z | 2015-05-25T11:29:35Z | 2015-05-25T11:29:35Z | 2015-06-02T19:26:12Z |
PERF: releasing the GIL, #8882 | diff --git a/doc/source/whatsnew/v0.17.0.txt b/doc/source/whatsnew/v0.17.0.txt
index 2b02c4ed93a0d..9f7779c6fee8c 100644
--- a/doc/source/whatsnew/v0.17.0.txt
+++ b/doc/source/whatsnew/v0.17.0.txt
@@ -13,6 +13,7 @@ users upgrade to this version.
Highlights include:
+ - Release the Global Interpreter Lock (GIL) on some cython operations, see :ref:`here <whatsnew_0170.gil>`
Check the :ref:`API Changes <whatsnew_0170.api>` and :ref:`deprecations <whatsnew_0170.deprecations>` before updating.
@@ -56,8 +57,32 @@ Deprecations
Removal of prior version deprecations/changes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+.. _dask: https://dask.readthedocs.org/en/latest/
+
+.. _whatsnew_0170.gil:
+
+Releasing the GIL
+~~~~~~~~~~~~~~~~~
+
+We are releasing the global-interpreter-lock (GIL) on some cython operations.
+This will allow other threads to run simultaneously during computation, potentially allowing performance improvements
+from multi-threading. Notably ``groupby`` and some indexing operations are a benefit from this. (:issue:`8882`)
+
+For example the groupby expression in the following code will have the GIL released during the factorization step, e.g. ``df.groupby('key')``
+as well as the ``.sum()`` operation.
+
+.. code-block:: python
+
+ N = 1e6
+ df = DataFrame({'key' : np.random.randint(0,ngroups,size=N),
+ 'data' : np.random.randn(N) })
+ df.groupby('key')['data'].sum()
+
+Releasing of the GIL could benefit an application that uses threads for user interactions (e.g. ``QT``), or performaning multi-threaded computations. A nice example of a library that can handle these types of computation-in-parallel is the dask_ library.
+
.. _whatsnew_0170.performance:
+
Performance Improvements
~~~~~~~~~~~~~~~~~~~~~~~~
- Added vbench benchmarks for alternative ExcelWriter engines and reading Excel files (:issue:`7171`)
diff --git a/pandas/core/common.py b/pandas/core/common.py
index b9866a414f058..62721587e0828 100644
--- a/pandas/core/common.py
+++ b/pandas/core/common.py
@@ -839,7 +839,6 @@ def take_nd(arr, indexer, axis=0, out=None, fill_value=np.nan,
func = _get_take_nd_function(arr.ndim, arr.dtype, out.dtype,
axis=axis, mask_info=mask_info)
-
indexer = _ensure_int64(indexer)
func(arr, indexer, out, fill_value)
diff --git a/pandas/hashtable.pyx b/pandas/hashtable.pyx
index c4cd788216018..3b3ea9fa032f8 100644
--- a/pandas/hashtable.pyx
+++ b/pandas/hashtable.pyx
@@ -1,14 +1,19 @@
+# cython: profile=False
+
from cpython cimport PyObject, Py_INCREF, PyList_Check, PyTuple_Check
from khash cimport *
from numpy cimport *
+from cpython cimport PyMem_Malloc, PyMem_Realloc, PyMem_Free
from util cimport _checknan
cimport util
import numpy as np
+nan = np.nan
-ONAN = np.nan
+cdef extern from "numpy/npy_math.h":
+ double NAN "NPY_NAN"
cimport cython
cimport numpy as cnp
@@ -28,33 +33,14 @@ PyDateTime_IMPORT
cdef extern from "Python.h":
int PySlice_Check(object)
-
-def list_to_object_array(list obj):
- '''
- Convert list to object ndarray. Seriously can't believe I had to write this
- function
- '''
- cdef:
- Py_ssize_t i, n
- ndarray[object] arr
-
- n = len(obj)
- arr = np.empty(n, dtype=object)
-
- for i from 0 <= i < n:
- arr[i] = obj[i]
-
- return arr
-
-
cdef size_t _INIT_VEC_CAP = 32
cdef class ObjectVector:
cdef:
+ PyObject **data
size_t n, m
ndarray ao
- PyObject **data
def __cinit__(self):
self.n = 0
@@ -65,11 +51,6 @@ cdef class ObjectVector:
def __len__(self):
return self.n
- def to_array(self):
- self.ao.resize(self.n)
- self.m = self.n
- return self.ao
-
cdef inline append(self, object o):
if self.n == self.m:
self.m = max(self.m * 2, _INIT_VEC_CAP)
@@ -80,72 +61,120 @@ cdef class ObjectVector:
self.data[self.n] = <PyObject*> o
self.n += 1
+ def to_array(self):
+ self.ao.resize(self.n)
+ self.m = self.n
+ return self.ao
+
+ctypedef struct Int64VectorData:
+ int64_t *data
+ size_t n, m
+
+ctypedef struct Float64VectorData:
+ float64_t *data
+ size_t n, m
+
+ctypedef fused vector_data:
+ Int64VectorData
+ Float64VectorData
+
+ctypedef fused sixty_four_bit_scalar:
+ int64_t
+ float64_t
+
+cdef bint needs_resize(vector_data *data) nogil:
+ return data.n == data.m
+
+cdef void append_data(vector_data *data, sixty_four_bit_scalar x) nogil:
+
+ # compile time specilization of the fused types
+ # as the cross-product is generated, but we cannot assign float->int
+ # the types that don't pass are pruned
+ if (vector_data is Int64VectorData and sixty_four_bit_scalar is int64_t) or (
+ vector_data is Float64VectorData and sixty_four_bit_scalar is float64_t):
+
+ data.data[data.n] = x
+ data.n += 1
cdef class Int64Vector:
cdef:
- size_t n, m
+ Int64VectorData *data
ndarray ao
- int64_t *data
def __cinit__(self):
- self.n = 0
- self.m = _INIT_VEC_CAP
- self.ao = np.empty(_INIT_VEC_CAP, dtype=np.int64)
- self.data = <int64_t*> self.ao.data
+ self.data = <Int64VectorData *>PyMem_Malloc(sizeof(Int64VectorData))
+ if not self.data:
+ raise MemoryError()
+ self.data.n = 0
+ self.data.m = _INIT_VEC_CAP
+ self.ao = np.empty(self.data.m, dtype=np.int64)
+ self.data.data = <int64_t*> self.ao.data
+
+ cdef resize(self):
+ self.data.m = max(self.data.m * 4, _INIT_VEC_CAP)
+ self.ao.resize(self.data.m)
+ self.data.data = <int64_t*> self.ao.data
+
+ def __dealloc__(self):
+ PyMem_Free(self.data)
def __len__(self):
- return self.n
+ return self.data.n
def to_array(self):
- self.ao.resize(self.n)
- self.m = self.n
+ self.ao.resize(self.data.n)
+ self.data.m = self.data.n
return self.ao
- cdef inline append(self, int64_t x):
- if self.n == self.m:
- self.m = max(self.m * 2, _INIT_VEC_CAP)
- self.ao.resize(self.m)
- self.data = <int64_t*> self.ao.data
+ cdef inline void append(self, int64_t x):
- self.data[self.n] = x
- self.n += 1
+ if needs_resize(self.data):
+ self.resize()
+
+ append_data(self.data, x)
cdef class Float64Vector:
cdef:
- size_t n, m
+ Float64VectorData *data
ndarray ao
- float64_t *data
def __cinit__(self):
- self.n = 0
- self.m = _INIT_VEC_CAP
- self.ao = np.empty(_INIT_VEC_CAP, dtype=np.float64)
- self.data = <float64_t*> self.ao.data
+ self.data = <Float64VectorData *>PyMem_Malloc(sizeof(Float64VectorData))
+ if not self.data:
+ raise MemoryError()
+ self.data.n = 0
+ self.data.m = _INIT_VEC_CAP
+ self.ao = np.empty(self.data.m, dtype=np.float64)
+ self.data.data = <float64_t*> self.ao.data
+
+ cdef resize(self):
+ self.data.m = max(self.data.m * 4, _INIT_VEC_CAP)
+ self.ao.resize(self.data.m)
+ self.data.data = <float64_t*> self.ao.data
+
+ def __dealloc__(self):
+ PyMem_Free(self.data)
def __len__(self):
- return self.n
+ return self.data.n
def to_array(self):
- self.ao.resize(self.n)
- self.m = self.n
+ self.ao.resize(self.data.n)
+ self.data.m = self.data.n
return self.ao
- cdef inline append(self, float64_t x):
- if self.n == self.m:
- self.m = max(self.m * 2, _INIT_VEC_CAP)
- self.ao.resize(self.m)
- self.data = <float64_t*> self.ao.data
+ cdef inline void append(self, float64_t x):
- self.data[self.n] = x
- self.n += 1
+ if needs_resize(self.data):
+ self.resize()
+ append_data(self.data, x)
cdef class HashTable:
pass
-
cdef class StringHashTable(HashTable):
cdef kh_str_t *table
@@ -157,9 +186,6 @@ cdef class StringHashTable(HashTable):
def __dealloc__(self):
kh_destroy_str(self.table)
- cdef inline int check_type(self, object val):
- return util.is_string_object(val)
-
cpdef get_item(self, object val):
cdef khiter_t k
k = kh_get_str(self.table, util.get_c_string(val))
@@ -256,111 +282,16 @@ cdef class StringHashTable(HashTable):
return reverse, labels
-cdef class Int32HashTable(HashTable):
- cdef kh_int32_t *table
-
- def __init__(self, size_hint=1):
- if size_hint is not None:
- kh_resize_int32(self.table, size_hint)
-
- def __cinit__(self):
- self.table = kh_init_int32()
-
- def __dealloc__(self):
- kh_destroy_int32(self.table)
-
- cdef inline int check_type(self, object val):
- return util.is_string_object(val)
-
- cpdef get_item(self, int32_t val):
- cdef khiter_t k
- k = kh_get_int32(self.table, val)
- if k != self.table.n_buckets:
- return self.table.vals[k]
- else:
- raise KeyError(val)
-
- def get_iter_test(self, int32_t key, Py_ssize_t iterations):
- cdef Py_ssize_t i, val=0
- for i in range(iterations):
- k = kh_get_int32(self.table, val)
- if k != self.table.n_buckets:
- val = self.table.vals[k]
-
- cpdef set_item(self, int32_t key, Py_ssize_t val):
- cdef:
- khiter_t k
- int ret = 0
-
- k = kh_put_int32(self.table, key, &ret)
- self.table.keys[k] = key
- if kh_exist_int32(self.table, k):
- self.table.vals[k] = val
- else:
- raise KeyError(key)
-
- def map_locations(self, ndarray[int32_t] values):
- cdef:
- Py_ssize_t i, n = len(values)
- int ret = 0
- int32_t val
- khiter_t k
-
- for i in range(n):
- val = values[i]
- k = kh_put_int32(self.table, val, &ret)
- self.table.vals[k] = i
-
- def lookup(self, ndarray[int32_t] values):
- cdef:
- Py_ssize_t i, n = len(values)
- int32_t val
- khiter_t k
- ndarray[int32_t] locs = np.empty(n, dtype=np.int64)
-
- for i in range(n):
- val = values[i]
- k = kh_get_int32(self.table, val)
- if k != self.table.n_buckets:
- locs[i] = self.table.vals[k]
- else:
- locs[i] = -1
-
- return locs
-
- def factorize(self, ndarray[int32_t] values):
- cdef:
- Py_ssize_t i, n = len(values)
- ndarray[int64_t] labels = np.empty(n, dtype=np.int64)
- dict reverse = {}
- Py_ssize_t idx, count = 0
- int ret = 0
- int32_t val
- khiter_t k
-
- for i in range(n):
- val = values[i]
- k = kh_get_int32(self.table, val)
- if k != self.table.n_buckets:
- idx = self.table.vals[k]
- labels[i] = idx
- else:
- k = kh_put_int32(self.table, val, &ret)
- self.table.vals[k] = count
- reverse[count] = val
- labels[i] = count
- count += 1
-
- return reverse, labels
-
-cdef class Int64HashTable: #(HashTable):
- # cdef kh_int64_t *table
+cdef class Int64HashTable(HashTable):
def __cinit__(self, size_hint=1):
self.table = kh_init_int64()
if size_hint is not None:
kh_resize_int64(self.table, size_hint)
+ def __len__(self):
+ return self.table.size
+
def __dealloc__(self):
kh_destroy_int64(self.table)
@@ -369,9 +300,6 @@ cdef class Int64HashTable: #(HashTable):
k = kh_get_int64(self.table, key)
return k != self.table.n_buckets
- def __len__(self):
- return self.table.size
-
cpdef get_item(self, int64_t val):
cdef khiter_t k
k = kh_get_int64(self.table, val)
@@ -399,137 +327,166 @@ cdef class Int64HashTable: #(HashTable):
else:
raise KeyError(key)
- def map(self, ndarray[int64_t] keys, ndarray[int64_t] values):
+ @cython.boundscheck(False)
+ def map(self, int64_t[:] keys, int64_t[:] values):
cdef:
Py_ssize_t i, n = len(values)
int ret = 0
int64_t key
khiter_t k
- for i in range(n):
- key = keys[i]
- k = kh_put_int64(self.table, key, &ret)
- self.table.vals[k] = <Py_ssize_t> values[i]
+ with nogil:
+ for i in range(n):
+ key = keys[i]
+ k = kh_put_int64(self.table, key, &ret)
+ self.table.vals[k] = <Py_ssize_t> values[i]
- def map_locations(self, ndarray[int64_t] values):
+ @cython.boundscheck(False)
+ def map_locations(self, int64_t[:] values):
cdef:
Py_ssize_t i, n = len(values)
int ret = 0
int64_t val
khiter_t k
- for i in range(n):
- val = values[i]
- k = kh_put_int64(self.table, val, &ret)
- self.table.vals[k] = i
+ with nogil:
+ for i in range(n):
+ val = values[i]
+ k = kh_put_int64(self.table, val, &ret)
+ self.table.vals[k] = i
- def lookup(self, ndarray[int64_t] values):
+ @cython.boundscheck(False)
+ def lookup(self, int64_t[:] values):
cdef:
Py_ssize_t i, n = len(values)
int ret = 0
int64_t val
khiter_t k
- ndarray[int64_t] locs = np.empty(n, dtype=np.int64)
+ int64_t[:] locs = np.empty(n, dtype=np.int64)
- for i in range(n):
- val = values[i]
- k = kh_get_int64(self.table, val)
- if k != self.table.n_buckets:
- locs[i] = self.table.vals[k]
- else:
- locs[i] = -1
+ with nogil:
+ for i in range(n):
+ val = values[i]
+ k = kh_get_int64(self.table, val)
+ if k != self.table.n_buckets:
+ locs[i] = self.table.vals[k]
+ else:
+ locs[i] = -1
- return locs
+ return np.asarray(locs)
def factorize(self, ndarray[object] values):
reverse = {}
labels = self.get_labels(values, reverse, 0)
return reverse, labels
- def get_labels(self, ndarray[int64_t] values, Int64Vector uniques,
+ @cython.boundscheck(False)
+ def get_labels(self, int64_t[:] values, Int64Vector uniques,
Py_ssize_t count_prior, Py_ssize_t na_sentinel):
cdef:
Py_ssize_t i, n = len(values)
- ndarray[int64_t] labels
+ int64_t[:] labels
Py_ssize_t idx, count = count_prior
int ret = 0
int64_t val
khiter_t k
+ Int64VectorData *ud
labels = np.empty(n, dtype=np.int64)
-
- for i in range(n):
- val = values[i]
- k = kh_get_int64(self.table, val)
- if k != self.table.n_buckets:
- idx = self.table.vals[k]
- labels[i] = idx
- else:
- k = kh_put_int64(self.table, val, &ret)
- self.table.vals[k] = count
- uniques.append(val)
- labels[i] = count
- count += 1
-
- return labels
-
- def get_labels_groupby(self, ndarray[int64_t] values):
+ ud = uniques.data
+
+ with nogil:
+ for i in range(n):
+ val = values[i]
+ k = kh_get_int64(self.table, val)
+ if k != self.table.n_buckets:
+ idx = self.table.vals[k]
+ labels[i] = idx
+ else:
+ k = kh_put_int64(self.table, val, &ret)
+ self.table.vals[k] = count
+
+ if needs_resize(ud):
+ with gil:
+ uniques.resize()
+ append_data(ud, val)
+ labels[i] = count
+ count += 1
+
+ return np.asarray(labels)
+
+ @cython.boundscheck(False)
+ def get_labels_groupby(self, int64_t[:] values):
cdef:
Py_ssize_t i, n = len(values)
- ndarray[int64_t] labels
+ int64_t[:] labels
Py_ssize_t idx, count = 0
int ret = 0
int64_t val
khiter_t k
Int64Vector uniques = Int64Vector()
+ Int64VectorData *ud
labels = np.empty(n, dtype=np.int64)
-
- for i in range(n):
- val = values[i]
-
- # specific for groupby
- if val < 0:
- labels[i] = -1
- continue
-
- k = kh_get_int64(self.table, val)
- if k != self.table.n_buckets:
- idx = self.table.vals[k]
- labels[i] = idx
- else:
- k = kh_put_int64(self.table, val, &ret)
- self.table.vals[k] = count
- uniques.append(val)
- labels[i] = count
- count += 1
+ ud = uniques.data
+
+ with nogil:
+ for i in range(n):
+ val = values[i]
+
+ # specific for groupby
+ if val < 0:
+ labels[i] = -1
+ continue
+
+ k = kh_get_int64(self.table, val)
+ if k != self.table.n_buckets:
+ idx = self.table.vals[k]
+ labels[i] = idx
+ else:
+ k = kh_put_int64(self.table, val, &ret)
+ self.table.vals[k] = count
+
+ if needs_resize(ud):
+ with gil:
+ uniques.resize()
+ append_data(ud, val)
+ labels[i] = count
+ count += 1
arr_uniques = uniques.to_array()
- return labels, arr_uniques
+ return np.asarray(labels), arr_uniques
- def unique(self, ndarray[int64_t] values):
+ @cython.boundscheck(False)
+ def unique(self, int64_t[:] values):
cdef:
Py_ssize_t i, n = len(values)
int ret = 0
- ndarray result
int64_t val
khiter_t k
Int64Vector uniques = Int64Vector()
+ Int64VectorData *ud
- for i in range(n):
- val = values[i]
- k = kh_get_int64(self.table, val)
- if k == self.table.n_buckets:
- kh_put_int64(self.table, val, &ret)
- uniques.append(val)
+ ud = uniques.data
- result = uniques.to_array()
+ with nogil:
+ for i in range(n):
+ val = values[i]
+ k = kh_get_int64(self.table, val)
+ if k == self.table.n_buckets:
+ kh_put_int64(self.table, val, &ret)
+
+ if needs_resize(ud):
+ with gil:
+ uniques.resize()
+ append_data(ud, val)
- return result
+ return uniques.to_array()
cdef class Float64HashTable(HashTable):
+
def __cinit__(self, size_hint=1):
self.table = kh_init_float64()
if size_hint is not None:
@@ -566,99 +523,124 @@ cdef class Float64HashTable(HashTable):
k = kh_get_float64(self.table, key)
return k != self.table.n_buckets
- def factorize(self, ndarray[float64_t] values):
+ def factorize(self, float64_t[:] values):
uniques = Float64Vector()
labels = self.get_labels(values, uniques, 0, -1)
return uniques.to_array(), labels
- def get_labels(self, ndarray[float64_t] values,
+ @cython.boundscheck(False)
+ def get_labels(self, float64_t[:] values,
Float64Vector uniques,
Py_ssize_t count_prior, int64_t na_sentinel):
cdef:
Py_ssize_t i, n = len(values)
- ndarray[int64_t] labels
+ int64_t[:] labels
Py_ssize_t idx, count = count_prior
int ret = 0
float64_t val
khiter_t k
+ Float64VectorData *ud
labels = np.empty(n, dtype=np.int64)
+ ud = uniques.data
- for i in range(n):
- val = values[i]
-
- if val != val:
- labels[i] = na_sentinel
- continue
-
- k = kh_get_float64(self.table, val)
- if k != self.table.n_buckets:
- idx = self.table.vals[k]
- labels[i] = idx
- else:
- k = kh_put_float64(self.table, val, &ret)
- self.table.vals[k] = count
- uniques.append(val)
- labels[i] = count
- count += 1
+ with nogil:
+ for i in range(n):
+ val = values[i]
- return labels
+ if val != val:
+ labels[i] = na_sentinel
+ continue
- def map_locations(self, ndarray[float64_t] values):
+ k = kh_get_float64(self.table, val)
+ if k != self.table.n_buckets:
+ idx = self.table.vals[k]
+ labels[i] = idx
+ else:
+ k = kh_put_float64(self.table, val, &ret)
+ self.table.vals[k] = count
+
+ if needs_resize(ud):
+ with gil:
+ uniques.resize()
+ append_data(ud, val)
+ labels[i] = count
+ count += 1
+
+ return np.asarray(labels)
+
+ @cython.boundscheck(False)
+ def map_locations(self, float64_t[:] values):
cdef:
Py_ssize_t i, n = len(values)
int ret = 0
khiter_t k
- for i in range(n):
- k = kh_put_float64(self.table, values[i], &ret)
- self.table.vals[k] = i
+ with nogil:
+ for i in range(n):
+ k = kh_put_float64(self.table, values[i], &ret)
+ self.table.vals[k] = i
- def lookup(self, ndarray[float64_t] values):
+ @cython.boundscheck(False)
+ def lookup(self, float64_t[:] values):
cdef:
Py_ssize_t i, n = len(values)
int ret = 0
float64_t val
khiter_t k
- ndarray[int64_t] locs = np.empty(n, dtype=np.int64)
+ int64_t[:] locs = np.empty(n, dtype=np.int64)
- for i in range(n):
- val = values[i]
- k = kh_get_float64(self.table, val)
- if k != self.table.n_buckets:
- locs[i] = self.table.vals[k]
- else:
- locs[i] = -1
+ with nogil:
+ for i in range(n):
+ val = values[i]
+ k = kh_get_float64(self.table, val)
+ if k != self.table.n_buckets:
+ locs[i] = self.table.vals[k]
+ else:
+ locs[i] = -1
- return locs
+ return np.asarray(locs)
- def unique(self, ndarray[float64_t] values):
+ @cython.boundscheck(False)
+ def unique(self, float64_t[:] values):
cdef:
Py_ssize_t i, n = len(values)
int ret = 0
float64_t val
khiter_t k
- Float64Vector uniques = Float64Vector()
bint seen_na = 0
+ Float64Vector uniques = Float64Vector()
+ Float64VectorData *ud
- for i in range(n):
- val = values[i]
+ ud = uniques.data
- if val == val:
- k = kh_get_float64(self.table, val)
- if k == self.table.n_buckets:
- kh_put_float64(self.table, val, &ret)
- uniques.append(val)
- elif not seen_na:
- seen_na = 1
- uniques.append(ONAN)
+ with nogil:
+ for i in range(n):
+ val = values[i]
+
+ if val == val:
+ k = kh_get_float64(self.table, val)
+ if k == self.table.n_buckets:
+ kh_put_float64(self.table, val, &ret)
+
+ if needs_resize(ud):
+ with gil:
+ uniques.resize()
+ append_data(ud, val)
+
+ elif not seen_na:
+ seen_na = 1
+
+ if needs_resize(ud):
+ with gil:
+ uniques.resize()
+ append_data(ud, NAN)
return uniques.to_array()
na_sentinel = object
cdef class PyObjectHashTable(HashTable):
- # cdef kh_pymap_t *table
def __init__(self, size_hint=1):
self.table = kh_init_pymap()
@@ -740,7 +722,7 @@ cdef class PyObjectHashTable(HashTable):
int ret = 0
object val
khiter_t k
- ndarray[int64_t] locs = np.empty(n, dtype=np.int64)
+ int64_t[:] locs = np.empty(n, dtype=np.int64)
for i in range(n):
val = values[i]
@@ -754,30 +736,13 @@ cdef class PyObjectHashTable(HashTable):
else:
locs[i] = -1
- return locs
-
- def lookup2(self, ndarray[object] values):
- cdef:
- Py_ssize_t i, n = len(values)
- int ret = 0
- object val
- khiter_t k
- long hval
- ndarray[int64_t] locs = np.empty(n, dtype=np.int64)
-
- # for i in range(n):
- # val = values[i]
- # hval = PyObject_Hash(val)
- # k = kh_get_pymap(self.table, <PyObject*>val)
-
- return locs
+ return np.asarray(locs)
def unique(self, ndarray[object] values):
cdef:
Py_ssize_t i, n = len(values)
int ret = 0
object val
- ndarray result
khiter_t k
ObjectVector uniques = ObjectVector()
bint seen_na = 0
@@ -792,17 +757,15 @@ cdef class PyObjectHashTable(HashTable):
uniques.append(val)
elif not seen_na:
seen_na = 1
- uniques.append(ONAN)
-
- result = uniques.to_array()
+ uniques.append(nan)
- return result
+ return uniques.to_array()
def get_labels(self, ndarray[object] values, ObjectVector uniques,
Py_ssize_t count_prior, int64_t na_sentinel):
cdef:
Py_ssize_t i, n = len(values)
- ndarray[int64_t] labels
+ int64_t[:] labels
Py_ssize_t idx, count = count_prior
int ret = 0
object val
@@ -829,7 +792,7 @@ cdef class PyObjectHashTable(HashTable):
labels[i] = count
count += 1
- return labels
+ return np.asarray(labels)
cdef class Factorizer:
@@ -884,7 +847,7 @@ cdef class Int64Factorizer:
def get_count(self):
return self.count
- def factorize(self, ndarray[int64_t] values, sort=False,
+ def factorize(self, int64_t[:] values, sort=False,
na_sentinel=-1):
labels = self.table.get_labels(values, self.uniques,
self.count, na_sentinel)
@@ -904,28 +867,34 @@ cdef class Int64Factorizer:
return labels
-cdef build_count_table_int64(ndarray[int64_t] values, kh_int64_t *table):
+
+@cython.boundscheck(False)
+cdef build_count_table_int64(int64_t[:] values, kh_int64_t *table):
cdef:
khiter_t k
Py_ssize_t i, n = len(values)
+ int64_t val
int ret = 0
- kh_resize_int64(table, n)
+ with nogil:
+ kh_resize_int64(table, n)
- for i in range(n):
- val = values[i]
- k = kh_get_int64(table, val)
- if k != table.n_buckets:
- table.vals[k] += 1
- else:
- k = kh_put_int64(table, val, &ret)
- table.vals[k] = 1
+ for i in range(n):
+ val = values[i]
+ k = kh_get_int64(table, val)
+ if k != table.n_buckets:
+ table.vals[k] += 1
+ else:
+ k = kh_put_int64(table, val, &ret)
+ table.vals[k] = 1
-cpdef value_count_int64(ndarray[int64_t] values):
+@cython.boundscheck(False)
+cpdef value_count_int64(int64_t[:] values):
cdef:
Py_ssize_t i
kh_int64_t *table
+ int64_t[:] result_keys, result_counts
int k
table = kh_init_int64()
@@ -934,14 +903,16 @@ cpdef value_count_int64(ndarray[int64_t] values):
i = 0
result_keys = np.empty(table.n_occupied, dtype=np.int64)
result_counts = np.zeros(table.n_occupied, dtype=np.int64)
- for k in range(table.n_buckets):
- if kh_exist_int64(table, k):
- result_keys[i] = table.keys[k]
- result_counts[i] = table.vals[k]
- i += 1
+
+ with nogil:
+ for k in range(table.n_buckets):
+ if kh_exist_int64(table, k):
+ result_keys[i] = table.keys[k]
+ result_counts[i] = table.vals[k]
+ i += 1
kh_destroy_int64(table)
- return result_keys, result_counts
+ return np.asarray(result_keys), np.asarray(result_counts)
cdef build_count_table_object(ndarray[object] values,
@@ -968,7 +939,7 @@ cdef build_count_table_object(ndarray[object] values,
cpdef value_count_object(ndarray[object] values,
- ndarray[uint8_t, cast=True] mask):
+ ndarray[uint8_t, cast=True] mask):
cdef:
Py_ssize_t i
kh_pymap_t *table
@@ -995,6 +966,7 @@ def mode_object(ndarray[object] values, ndarray[uint8_t, cast=True] mask):
int count, max_count = 2
int j = -1 # so you can do +=
int k
+ ndarray[object] modes
kh_pymap_t *table
table = kh_init_pymap()
@@ -1019,36 +991,39 @@ def mode_object(ndarray[object] values, ndarray[uint8_t, cast=True] mask):
return modes[:j+1]
-def mode_int64(ndarray[int64_t] values):
+@cython.boundscheck(False)
+def mode_int64(int64_t[:] values):
cdef:
int count, max_count = 2
int j = -1 # so you can do +=
int k
kh_int64_t *table
+ ndarray[int64_t] modes
table = kh_init_int64()
build_count_table_int64(values, table)
modes = np.empty(table.n_buckets, dtype=np.int64)
- for k in range(table.n_buckets):
- if kh_exist_int64(table, k):
- count = table.vals[k]
- if count == max_count:
- j += 1
- elif count > max_count:
- max_count = count
- j = 0
- else:
- continue
- modes[j] = table.keys[k]
+ with nogil:
+ for k in range(table.n_buckets):
+ if kh_exist_int64(table, k):
+ count = table.vals[k]
+
+ if count == max_count:
+ j += 1
+ elif count > max_count:
+ max_count = count
+ j = 0
+ else:
+ continue
+ modes[j] = table.keys[k]
kh_destroy_int64(table)
return modes[:j+1]
-
@cython.wraparound(False)
@cython.boundscheck(False)
def duplicated_int64(ndarray[int64_t, ndim=1] values, int take_last):
@@ -1060,14 +1035,15 @@ def duplicated_int64(ndarray[int64_t, ndim=1] values, int take_last):
kh_resize_int64(table, min(n, _SIZE_HINT_LIMIT))
- if take_last:
- for i from n > i >=0:
- kh_put_int64(table, values[i], &ret)
- out[i] = ret == 0
- else:
- for i from 0 <= i < n:
- kh_put_int64(table, values[i], &ret)
- out[i] = ret == 0
+ with nogil:
+ if take_last:
+ for i from n > i >=0:
+ kh_put_int64(table, values[i], &ret)
+ out[i] = ret == 0
+ else:
+ for i from 0 <= i < n:
+ kh_put_int64(table, values[i], &ret)
+ out[i] = ret == 0
kh_destroy_int64(table)
return out
@@ -1087,13 +1063,18 @@ def unique_label_indices(ndarray[int64_t, ndim=1] labels):
kh_int64_t * table = kh_init_int64()
Int64Vector idx = Int64Vector()
ndarray[int64_t, ndim=1] arr
+ Int64VectorData *ud = idx.data
kh_resize_int64(table, min(n, _SIZE_HINT_LIMIT))
- for i in range(n):
- kh_put_int64(table, labels[i], &ret)
- if ret != 0:
- idx.append(i)
+ with nogil:
+ for i in range(n):
+ kh_put_int64(table, labels[i], &ret)
+ if ret != 0:
+ if needs_resize(ud):
+ with gil:
+ idx.resize()
+ append_data(ud, i)
kh_destroy_int64(table)
diff --git a/pandas/index.pyx b/pandas/index.pyx
index 9be7e7404f3fe..1678e3b280ee5 100644
--- a/pandas/index.pyx
+++ b/pandas/index.pyx
@@ -1,3 +1,5 @@
+# cython: profile=False
+
from numpy cimport ndarray
from numpy cimport (float64_t, int32_t, int64_t, uint8_t,
@@ -89,6 +91,7 @@ cdef class IndexEngine:
self.monotonic_check = 0
self.unique = 0
+ self.unique_check = 0
self.monotonic_inc = 0
self.monotonic_dec = 0
@@ -230,16 +233,12 @@ cdef class IndexEngine:
cdef inline _do_monotonic_check(self):
try:
values = self._get_index_values()
- self.monotonic_inc, self.monotonic_dec, unique = \
+ self.monotonic_inc, self.monotonic_dec = \
self._call_monotonic(values)
-
- if unique is not None:
- self.unique = unique
- self.unique_check = 1
-
except TypeError:
self.monotonic_inc = 0
self.monotonic_dec = 0
+
self.monotonic_check = 1
cdef _get_index_values(self):
diff --git a/pandas/src/generate_code.py b/pandas/src/generate_code.py
index 5d4b18b36050f..9016f232afa9a 100644
--- a/pandas/src/generate_code.py
+++ b/pandas/src/generate_code.py
@@ -23,6 +23,9 @@
from cpython cimport PyFloat_Check
cimport cpython
+cdef extern from "numpy/npy_math.h":
+ double NAN "NPY_NAN"
+
import numpy as np
isnan = np.isnan
@@ -70,29 +73,31 @@
return arr.asobject
else:
return np.array(arr, dtype=np.object_)
-
"""
-take_1d_template = """@cython.wraparound(False)
-def take_1d_%(name)s_%(dest)s(ndarray[%(c_type_in)s] values,
- ndarray[int64_t] indexer,
- ndarray[%(c_type_out)s] out,
+take_1d_template = """
+@cython.wraparound(False)
+@cython.boundscheck(False)
+def take_1d_%(name)s_%(dest)s(%(c_type_in)s[:] values,
+ int64_t[:] indexer,
+ %(c_type_out)s[:] out,
fill_value=np.nan):
cdef:
Py_ssize_t i, n, idx
%(c_type_out)s fv
- n = len(indexer)
+ n = indexer.shape[0]
fv = fill_value
- for i from 0 <= i < n:
- idx = indexer[i]
- if idx == -1:
- out[i] = fv
- else:
- out[i] = %(preval)svalues[idx]%(postval)s
+ %(nogil)s
+ %(tab)sfor i from 0 <= i < n:
+ %(tab)s idx = indexer[i]
+ %(tab)s if idx == -1:
+ %(tab)s out[i] = fv
+ %(tab)s else:
+ %(tab)s out[i] = %(preval)svalues[idx]%(postval)s
"""
inner_take_2d_axis0_template = """\
@@ -134,7 +139,6 @@ def take_1d_%(name)s_%(dest)s(ndarray[%(c_type_in)s] values,
else:
for j from 0 <= j < k:
out[i, j] = %(preval)svalues[idx, j]%(postval)s
-
"""
take_2d_axis0_template = """\
@@ -241,7 +245,6 @@ def take_2d_multi_%(name)s_%(dest)s(ndarray[%(c_type_in)s, ndim=2] values,
out[i, j] = fv
else:
out[i, j] = %(preval)svalues[idx, idx1[j]]%(postval)s
-
"""
@@ -332,7 +335,6 @@ def backfill_%(name)s(ndarray[%(c_type)s] old, ndarray[%(c_type)s] new,
cur = prev
return indexer
-
"""
@@ -396,7 +398,6 @@ def pad_%(name)s(ndarray[%(c_type)s] old, ndarray[%(c_type)s] new,
cur = next
return indexer
-
"""
pad_1d_template = """@cython.boundscheck(False)
@@ -431,7 +432,6 @@ def pad_inplace_%(name)s(ndarray[%(c_type)s] values,
else:
fill_count = 0
val = values[i]
-
"""
pad_2d_template = """@cython.boundscheck(False)
@@ -592,12 +592,11 @@ def is_monotonic_%(name)s(ndarray[%(c_type)s] arr, bint timelike):
'''
Returns
-------
- is_monotonic_inc, is_monotonic_dec, is_unique
+ is_monotonic_inc, is_monotonic_dec
'''
cdef:
Py_ssize_t i, n
%(c_type)s prev, cur
- bint is_unique = 1
bint is_monotonic_inc = 1
bint is_monotonic_dec = 1
@@ -606,33 +605,40 @@ def is_monotonic_%(name)s(ndarray[%(c_type)s] arr, bint timelike):
if n == 1:
if arr[0] != arr[0] or (timelike and arr[0] == iNaT):
# single value is NaN
- return False, False, True
+ return False, False
else:
- return True, True, True
+ return True, True
elif n < 2:
- return True, True, True
+ return True, True
if timelike and arr[0] == iNaT:
- return False, False, None
-
- prev = arr[0]
- for i in range(1, n):
- cur = arr[i]
- if timelike and cur == iNaT:
- return False, False, None
- if cur < prev:
- is_monotonic_inc = 0
- elif cur > prev:
- is_monotonic_dec = 0
- elif cur == prev:
- is_unique = 0
- else:
- # cur or prev is NaN
- return False, False, None
- if not is_monotonic_inc and not is_monotonic_dec:
- return False, False, None
- prev = cur
- return is_monotonic_inc, is_monotonic_dec, is_unique
+ return False, False
+
+ %(nogil)s
+ %(tab)sprev = arr[0]
+ %(tab)sfor i in range(1, n):
+ %(tab)s cur = arr[i]
+ %(tab)s if timelike and cur == iNaT:
+ %(tab)s is_monotonic_inc = 0
+ %(tab)s is_monotonic_dec = 0
+ %(tab)s break
+ %(tab)s if cur < prev:
+ %(tab)s is_monotonic_inc = 0
+ %(tab)s elif cur > prev:
+ %(tab)s is_monotonic_dec = 0
+ %(tab)s elif cur == prev:
+ %(tab)s pass # is_unique = 0
+ %(tab)s else:
+ %(tab)s # cur or prev is NaN
+ %(tab)s is_monotonic_inc = 0
+ %(tab)s is_monotonic_dec = 0
+ %(tab)s break
+ %(tab)s if not is_monotonic_inc and not is_monotonic_dec:
+ %(tab)s is_monotonic_inc = 0
+ %(tab)s is_monotonic_dec = 0
+ %(tab)s break
+ %(tab)s prev = cur
+ return is_monotonic_inc, is_monotonic_dec
"""
map_indices_template = """@cython.wraparound(False)
@@ -656,7 +662,6 @@ def is_monotonic_%(name)s(ndarray[%(c_type)s] arr, bint timelike):
result[index[i]] = i
return result
-
"""
groupby_template = """@cython.wraparound(False)
@@ -686,11 +691,10 @@ def groupby_%(name)s(ndarray[%(c_type)s] index, ndarray labels):
result[key] = [idx]
return result
-
"""
group_last_template = """@cython.wraparound(False)
-@cython.wraparound(False)
+@cython.boundscheck(False)
def group_last_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
ndarray[int64_t] counts,
ndarray[%(c_type)s, ndim=2] values,
@@ -699,7 +703,7 @@ def group_last_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
Only aggregates on axis=0
'''
cdef:
- Py_ssize_t i, j, N, K, lab
+ Py_ssize_t i, j, N, K, lab, ncounts = len(counts)
%(dest_type2)s val, count
ndarray[%(dest_type2)s, ndim=2] resx
ndarray[int64_t, ndim=2] nobs
@@ -712,30 +716,31 @@ def group_last_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
N, K = (<object> values).shape
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
+ with nogil:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
- counts[lab] += 1
- for j in range(K):
- val = values[i, j]
+ counts[lab] += 1
+ for j in range(K):
+ val = values[i, j]
- # not nan
- if val == val:
- nobs[lab, j] += 1
- resx[lab, j] = val
+ # not nan
+ if val == val:
+ nobs[lab, j] += 1
+ resx[lab, j] = val
- for i in range(len(counts)):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = %(nan_val)s
- else:
- out[i, j] = resx[i, j]
+ for i in range(ncounts):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = %(nan_val)s
+ else:
+ out[i, j] = resx[i, j]
"""
group_last_bin_template = """@cython.wraparound(False)
-@cython.wraparound(False)
+@cython.boundscheck(False)
def group_last_bin_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
ndarray[int64_t] counts,
ndarray[%(c_type)s, ndim=2] values,
@@ -760,30 +765,31 @@ def group_last_bin_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
N, K = (<object> values).shape
- b = 0
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
-
- counts[b] += 1
- for j in range(K):
- val = values[i, j]
-
- # not nan
- if val == val:
- nobs[b, j] += 1
- resx[b, j] = val
-
- for i in range(ngroups):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = %(nan_val)s
- else:
- out[i, j] = resx[i, j]
+ with nogil:
+ b = 0
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
+
+ counts[b] += 1
+ for j in range(K):
+ val = values[i, j]
+
+ # not nan
+ if val == val:
+ nobs[b, j] += 1
+ resx[b, j] = val
+
+ for i in range(ngroups):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = %(nan_val)s
+ else:
+ out[i, j] = resx[i, j]
"""
-group_nth_bin_template = """@cython.boundscheck(False)
-@cython.wraparound(False)
+group_nth_bin_template = """@cython.wraparound(False)
+@cython.boundscheck(False)
def group_nth_bin_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
ndarray[int64_t] counts,
ndarray[%(c_type)s, ndim=2] values,
@@ -808,31 +814,32 @@ def group_nth_bin_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
N, K = (<object> values).shape
- b = 0
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ with nogil:
+ b = 0
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
- counts[b] += 1
- for j in range(K):
- val = values[i, j]
+ counts[b] += 1
+ for j in range(K):
+ val = values[i, j]
- # not nan
- if val == val:
- nobs[b, j] += 1
- if nobs[b, j] == rank:
- resx[b, j] = val
+ # not nan
+ if val == val:
+ nobs[b, j] += 1
+ if nobs[b, j] == rank:
+ resx[b, j] = val
- for i in range(ngroups):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = %(nan_val)s
- else:
- out[i, j] = resx[i, j]
+ for i in range(ngroups):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = %(nan_val)s
+ else:
+ out[i, j] = resx[i, j]
"""
-group_nth_template = """@cython.boundscheck(False)
-@cython.wraparound(False)
+group_nth_template = """@cython.wraparound(False)
+@cython.boundscheck(False)
def group_nth_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
ndarray[int64_t] counts,
ndarray[%(c_type)s, ndim=2] values,
@@ -841,7 +848,7 @@ def group_nth_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
Only aggregates on axis=0
'''
cdef:
- Py_ssize_t i, j, N, K, lab
+ Py_ssize_t i, j, N, K, lab, ncounts = len(counts)
%(dest_type2)s val, count
ndarray[%(dest_type2)s, ndim=2] resx
ndarray[int64_t, ndim=2] nobs
@@ -854,31 +861,32 @@ def group_nth_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
N, K = (<object> values).shape
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
+ with nogil:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
- counts[lab] += 1
- for j in range(K):
- val = values[i, j]
+ counts[lab] += 1
+ for j in range(K):
+ val = values[i, j]
- # not nan
- if val == val:
- nobs[lab, j] += 1
- if nobs[lab, j] == rank:
- resx[lab, j] = val
+ # not nan
+ if val == val:
+ nobs[lab, j] += 1
+ if nobs[lab, j] == rank:
+ resx[lab, j] = val
- for i in range(len(counts)):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = %(nan_val)s
- else:
- out[i, j] = resx[i, j]
+ for i in range(ncounts):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = %(nan_val)s
+ else:
+ out[i, j] = resx[i, j]
"""
-group_add_template = """@cython.boundscheck(False)
-@cython.wraparound(False)
+group_add_template = """@cython.wraparound(False)
+@cython.boundscheck(False)
def group_add_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
ndarray[int64_t] counts,
ndarray[%(c_type)s, ndim=2] values,
@@ -887,7 +895,7 @@ def group_add_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
Only aggregates on axis=0
'''
cdef:
- Py_ssize_t i, j, N, K, lab
+ Py_ssize_t i, j, N, K, lab, ncounts = len(counts)
%(dest_type2)s val, count
ndarray[%(dest_type2)s, ndim=2] sumx, nobs
@@ -899,44 +907,50 @@ def group_add_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
N, K = (<object> values).shape
- if K > 1:
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
- counts[lab] += 1
- for j in range(K):
- val = values[i, j]
+ with nogil:
- # not nan
- if val == val:
- nobs[lab, j] += 1
- sumx[lab, j] += val
- else:
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
+ if K > 1:
- counts[lab] += 1
- val = values[i, 0]
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
- # not nan
- if val == val:
- nobs[lab, 0] += 1
- sumx[lab, 0] += val
+ counts[lab] += 1
+ for j in range(K):
+ val = values[i, j]
- for i in range(len(counts)):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = nan
- else:
- out[i, j] = sumx[i, j]
+ # not nan
+ if val == val:
+ nobs[lab, j] += 1
+ sumx[lab, j] += val
+
+ else:
+
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
+
+ counts[lab] += 1
+ val = values[i, 0]
+
+ # not nan
+ if val == val:
+ nobs[lab, 0] += 1
+ sumx[lab, 0] += val
+
+ for i in range(ncounts):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = NAN
+ else:
+ out[i, j] = sumx[i, j]
"""
-group_add_bin_template = """@cython.boundscheck(False)
-@cython.wraparound(False)
+group_add_bin_template = """@cython.wraparound(False)
+@cython.boundscheck(False)
def group_add_bin_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
ndarray[int64_t] counts,
ndarray[%(dest_type2)s, ndim=2] values,
@@ -960,43 +974,46 @@ def group_add_bin_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
ngroups = len(bins) + 1
N, K = (<object> values).shape
- b = 0
- if K > 1:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ with nogil:
- counts[b] += 1
- for j in range(K):
- val = values[i, j]
+ b = 0
+ if K > 1:
- # not nan
- if val == val:
- nobs[b, j] += 1
- sumx[b, j] += val
- else:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
- counts[b] += 1
- val = values[i, 0]
+ counts[b] += 1
+ for j in range(K):
+ val = values[i, j]
- # not nan
- if val == val:
- nobs[b, 0] += 1
- sumx[b, 0] += val
+ # not nan
+ if val == val:
+ nobs[b, j] += 1
+ sumx[b, j] += val
+ else:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
- for i in range(ngroups):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = nan
- else:
- out[i, j] = sumx[i, j]
+ counts[b] += 1
+ val = values[i, 0]
+
+ # not nan
+ if val == val:
+ nobs[b, 0] += 1
+ sumx[b, 0] += val
+
+ for i in range(ngroups):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = NAN
+ else:
+ out[i, j] = sumx[i, j]
"""
-group_prod_template = """@cython.boundscheck(False)
-@cython.wraparound(False)
+group_prod_template = """@cython.wraparound(False)
+@cython.boundscheck(False)
def group_prod_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
ndarray[int64_t] counts,
ndarray[%(c_type)s, ndim=2] values,
@@ -1005,7 +1022,7 @@ def group_prod_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
Only aggregates on axis=0
'''
cdef:
- Py_ssize_t i, j, N, K, lab
+ Py_ssize_t i, j, N, K, lab, ncounts = len(counts)
%(dest_type2)s val, count
ndarray[%(dest_type2)s, ndim=2] prodx, nobs
@@ -1017,44 +1034,45 @@ def group_prod_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
N, K = (<object> values).shape
- if K > 1:
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
+ with nogil:
+ if K > 1:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
- counts[lab] += 1
- for j in range(K):
- val = values[i, j]
+ counts[lab] += 1
+ for j in range(K):
+ val = values[i, j]
- # not nan
- if val == val:
- nobs[lab, j] += 1
- prodx[lab, j] *= val
- else:
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
+ # not nan
+ if val == val:
+ nobs[lab, j] += 1
+ prodx[lab, j] *= val
+ else:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
- counts[lab] += 1
- val = values[i, 0]
+ counts[lab] += 1
+ val = values[i, 0]
- # not nan
- if val == val:
- nobs[lab, 0] += 1
- prodx[lab, 0] *= val
+ # not nan
+ if val == val:
+ nobs[lab, 0] += 1
+ prodx[lab, 0] *= val
- for i in range(len(counts)):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = nan
- else:
- out[i, j] = prodx[i, j]
+ for i in range(ncounts):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = NAN
+ else:
+ out[i, j] = prodx[i, j]
"""
-group_prod_bin_template = """@cython.boundscheck(False)
-@cython.wraparound(False)
+group_prod_bin_template = """@cython.wraparound(False)
+@cython.boundscheck(False)
def group_prod_bin_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
ndarray[int64_t] counts,
ndarray[%(dest_type2)s, ndim=2] values,
@@ -1078,39 +1096,41 @@ def group_prod_bin_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
ngroups = len(bins) + 1
N, K = (<object> values).shape
- b = 0
- if K > 1:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ with nogil:
- counts[b] += 1
- for j in range(K):
- val = values[i, j]
+ b = 0
+ if K > 1:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
- # not nan
- if val == val:
- nobs[b, j] += 1
- prodx[b, j] *= val
- else:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ counts[b] += 1
+ for j in range(K):
+ val = values[i, j]
- counts[b] += 1
- val = values[i, 0]
+ # not nan
+ if val == val:
+ nobs[b, j] += 1
+ prodx[b, j] *= val
+ else:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
- # not nan
- if val == val:
- nobs[b, 0] += 1
- prodx[b, 0] *= val
+ counts[b] += 1
+ val = values[i, 0]
- for i in range(ngroups):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = nan
- else:
- out[i, j] = prodx[i, j]
+ # not nan
+ if val == val:
+ nobs[b, 0] += 1
+ prodx[b, 0] *= val
+
+ for i in range(ngroups):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = NAN
+ else:
+ out[i, j] = prodx[i, j]
"""
group_var_template = """@cython.wraparound(False)
@@ -1120,7 +1140,7 @@ def group_var_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
ndarray[%(dest_type2)s, ndim=2] values,
ndarray[int64_t] labels):
cdef:
- Py_ssize_t i, j, N, K, lab
+ Py_ssize_t i, j, N, K, lab, ncounts = len(counts)
%(dest_type2)s val, ct
ndarray[%(dest_type2)s, ndim=2] nobs, sumx, sumxx
@@ -1133,47 +1153,49 @@ def group_var_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
N, K = (<object> values).shape
- if K > 1:
- for i in range(N):
+ with nogil:
+ if K > 1:
+ for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
+ lab = labels[i]
+ if lab < 0:
+ continue
- counts[lab] += 1
+ counts[lab] += 1
- for j in range(K):
- val = values[i, j]
+ for j in range(K):
+ val = values[i, j]
+
+ # not nan
+ if val == val:
+ nobs[lab, j] += 1
+ sumx[lab, j] += val
+ sumxx[lab, j] += val * val
+ else:
+ for i in range(N):
+
+ lab = labels[i]
+ if lab < 0:
+ continue
+
+ counts[lab] += 1
+ val = values[i, 0]
# not nan
if val == val:
- nobs[lab, j] += 1
- sumx[lab, j] += val
- sumxx[lab, j] += val * val
- else:
- for i in range(N):
+ nobs[lab, 0] += 1
+ sumx[lab, 0] += val
+ sumxx[lab, 0] += val * val
- lab = labels[i]
- if lab < 0:
- continue
- counts[lab] += 1
- val = values[i, 0]
- # not nan
- if val == val:
- nobs[lab, 0] += 1
- sumx[lab, 0] += val
- sumxx[lab, 0] += val * val
-
-
- for i in range(len(counts)):
- for j in range(K):
- ct = nobs[i, j]
- if ct < 2:
- out[i, j] = nan
- else:
- out[i, j] = ((ct * sumxx[i, j] - sumx[i, j] * sumx[i, j]) /
- (ct * ct - ct))
+ for i in range(ncounts):
+ for j in range(K):
+ ct = nobs[i, j]
+ if ct < 2:
+ out[i, j] = NAN
+ else:
+ out[i, j] = ((ct * sumxx[i, j] - sumx[i, j] * sumx[i, j]) /
+ (ct * ct - ct))
"""
group_var_bin_template = """@cython.wraparound(False)
@@ -1201,44 +1223,45 @@ def group_var_bin_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
N, K = (<object> values).shape
- b = 0
- if K > 1:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ with nogil:
+ b = 0
+ if K > 1:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
- counts[b] += 1
+ counts[b] += 1
- for j in range(K):
- val = values[i, j]
+ for j in range(K):
+ val = values[i, j]
+
+ # not nan
+ if val == val:
+ nobs[b, j] += 1
+ sumx[b, j] += val
+ sumxx[b, j] += val * val
+ else:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
+
+ counts[b] += 1
+ val = values[i, 0]
# not nan
if val == val:
- nobs[b, j] += 1
- sumx[b, j] += val
- sumxx[b, j] += val * val
- else:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ nobs[b, 0] += 1
+ sumx[b, 0] += val
+ sumxx[b, 0] += val * val
- counts[b] += 1
- val = values[i, 0]
-
- # not nan
- if val == val:
- nobs[b, 0] += 1
- sumx[b, 0] += val
- sumxx[b, 0] += val * val
-
- for i in range(ngroups):
- for j in range(K):
- ct = nobs[i, j]
- if ct < 2:
- out[i, j] = nan
- else:
- out[i, j] = ((ct * sumxx[i, j] - sumx[i, j] * sumx[i, j]) /
- (ct * ct - ct))
+ for i in range(ngroups):
+ for j in range(K):
+ ct = nobs[i, j]
+ if ct < 2:
+ out[i, j] = NAN
+ else:
+ out[i, j] = ((ct * sumxx[i, j] - sumx[i, j] * sumx[i, j]) /
+ (ct * ct - ct))
"""
group_count_template = """@cython.boundscheck(False)
@@ -1251,36 +1274,36 @@ def group_count_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
Only aggregates on axis=0
'''
cdef:
- Py_ssize_t i, j, lab
+ Py_ssize_t i, j, lab, ncounts = len(counts)
Py_ssize_t N = values.shape[0], K = values.shape[1]
%(c_type)s val
ndarray[int64_t, ndim=2] nobs = np.zeros((out.shape[0], out.shape[1]),
dtype=np.int64)
if len(values) != len(labels):
- raise AssertionError("len(index) != len(labels)")
-
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
+ raise AssertionError("len(index) != len(labels)")
- counts[lab] += 1
- for j in range(K):
- val = values[i, j]
- # not nan
- nobs[lab, j] += val == val and val != iNaT
+ %(nogil)s
+ %(tab)sfor i in range(N):
+ %(tab)s lab = labels[i]
+ %(tab)s if lab < 0:
+ %(tab)s continue
- for i in range(len(counts)):
- for j in range(K):
- out[i, j] = nobs[i, j]
+ %(tab)s counts[lab] += 1
+ %(tab)s for j in range(K):
+ %(tab)s val = values[i, j]
+ %(tab)s # not nan
+ %(tab)s nobs[lab, j] += val == val and val != iNaT
+ %(tab)sfor i in range(ncounts):
+ %(tab)s for j in range(K):
+ %(tab)s out[i, j] = nobs[i, j]
"""
-group_count_bin_template = """@cython.boundscheck(False)
-@cython.wraparound(False)
+group_count_bin_template = """@cython.wraparound(False)
+@cython.boundscheck(False)
def group_count_bin_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
ndarray[int64_t] counts,
ndarray[%(c_type)s, ndim=2] values,
@@ -1299,23 +1322,23 @@ def group_count_bin_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
return
ngroups = len(bins) + (bins[len(bins) - 1] != N)
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
-
- counts[b] += 1
- for j in range(K):
- val = values[i, j]
+ %(nogil)s
+ %(tab)sfor i in range(N):
+ %(tab)s while b < ngroups - 1 and i >= bins[b]:
+ %(tab)s b += 1
- # not nan
- nobs[b, j] += val == val and val != iNaT
-
- for i in range(ngroups):
- for j in range(K):
- out[i, j] = nobs[i, j]
+ %(tab)s counts[b] += 1
+ %(tab)s for j in range(K):
+ %(tab)s val = values[i, j]
+ %(tab)s # not nan
+ %(tab)s nobs[b, j] += val == val and val != iNaT
+ %(tab)sfor i in range(ngroups):
+ %(tab)s for j in range(K):
+ %(tab)s out[i, j] = nobs[i, j]
"""
+
# add passing bin edges, instead of labels
@@ -1350,41 +1373,42 @@ def group_min_bin_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
N, K = (<object> values).shape
- b = 0
- if K > 1:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ with nogil:
+ b = 0
+ if K > 1:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
+
+ counts[b] += 1
+ for j in range(K):
+ val = values[i, j]
+
+ # not nan
+ if val == val:
+ nobs[b, j] += 1
+ if val < minx[b, j]:
+ minx[b, j] = val
+ else:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
- counts[b] += 1
- for j in range(K):
- val = values[i, j]
+ counts[b] += 1
+ val = values[i, 0]
# not nan
if val == val:
- nobs[b, j] += 1
- if val < minx[b, j]:
- minx[b, j] = val
- else:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ nobs[b, 0] += 1
+ if val < minx[b, 0]:
+ minx[b, 0] = val
- counts[b] += 1
- val = values[i, 0]
-
- # not nan
- if val == val:
- nobs[b, 0] += 1
- if val < minx[b, 0]:
- minx[b, 0] = val
-
- for i in range(ngroups):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = %(nan_val)s
- else:
- out[i, j] = minx[i, j]
+ for i in range(ngroups):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = %(nan_val)s
+ else:
+ out[i, j] = minx[i, j]
"""
group_max_template = """@cython.wraparound(False)
@@ -1397,7 +1421,7 @@ def group_max_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
Only aggregates on axis=0
'''
cdef:
- Py_ssize_t i, j, N, K, lab
+ Py_ssize_t i, j, N, K, lab, ncounts = len(counts)
%(dest_type2)s val, count
ndarray[%(dest_type2)s, ndim=2] maxx, nobs
@@ -1411,42 +1435,43 @@ def group_max_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
N, K = (<object> values).shape
- if K > 1:
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
+ with nogil:
+ if K > 1:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
- counts[lab] += 1
- for j in range(K):
- val = values[i, j]
+ counts[lab] += 1
+ for j in range(K):
+ val = values[i, j]
+
+ # not nan
+ if val == val:
+ nobs[lab, j] += 1
+ if val > maxx[lab, j]:
+ maxx[lab, j] = val
+ else:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
+
+ counts[lab] += 1
+ val = values[i, 0]
# not nan
if val == val:
- nobs[lab, j] += 1
- if val > maxx[lab, j]:
- maxx[lab, j] = val
- else:
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
+ nobs[lab, 0] += 1
+ if val > maxx[lab, 0]:
+ maxx[lab, 0] = val
- counts[lab] += 1
- val = values[i, 0]
-
- # not nan
- if val == val:
- nobs[lab, 0] += 1
- if val > maxx[lab, 0]:
- maxx[lab, 0] = val
-
- for i in range(len(counts)):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = %(nan_val)s
- else:
- out[i, j] = maxx[i, j]
+ for i in range(ncounts):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = %(nan_val)s
+ else:
+ out[i, j] = maxx[i, j]
"""
group_max_bin_template = """@cython.wraparound(False)
@@ -1476,41 +1501,42 @@ def group_max_bin_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
N, K = (<object> values).shape
- b = 0
- if K > 1:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ with nogil:
+ b = 0
+ if K > 1:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
+
+ counts[b] += 1
+ for j in range(K):
+ val = values[i, j]
+
+ # not nan
+ if val == val:
+ nobs[b, j] += 1
+ if val > maxx[b, j]:
+ maxx[b, j] = val
+ else:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
- counts[b] += 1
- for j in range(K):
- val = values[i, j]
+ counts[b] += 1
+ val = values[i, 0]
# not nan
if val == val:
- nobs[b, j] += 1
- if val > maxx[b, j]:
- maxx[b, j] = val
- else:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ nobs[b, 0] += 1
+ if val > maxx[b, 0]:
+ maxx[b, 0] = val
- counts[b] += 1
- val = values[i, 0]
-
- # not nan
- if val == val:
- nobs[b, 0] += 1
- if val > maxx[b, 0]:
- maxx[b, 0] = val
-
- for i in range(ngroups):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = %(nan_val)s
- else:
- out[i, j] = maxx[i, j]
+ for i in range(ngroups):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = %(nan_val)s
+ else:
+ out[i, j] = maxx[i, j]
"""
@@ -1524,7 +1550,7 @@ def group_min_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
Only aggregates on axis=0
'''
cdef:
- Py_ssize_t i, j, N, K, lab
+ Py_ssize_t i, j, N, K, lab, ncounts = len(counts)
%(dest_type2)s val, count
ndarray[%(dest_type2)s, ndim=2] minx, nobs
@@ -1538,42 +1564,43 @@ def group_min_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
N, K = (<object> values).shape
- if K > 1:
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
+ with nogil:
+ if K > 1:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
- counts[lab] += 1
- for j in range(K):
- val = values[i, j]
+ counts[lab] += 1
+ for j in range(K):
+ val = values[i, j]
+
+ # not nan
+ if val == val:
+ nobs[lab, j] += 1
+ if val < minx[lab, j]:
+ minx[lab, j] = val
+ else:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
+
+ counts[lab] += 1
+ val = values[i, 0]
# not nan
if val == val:
- nobs[lab, j] += 1
- if val < minx[lab, j]:
- minx[lab, j] = val
- else:
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
+ nobs[lab, 0] += 1
+ if val < minx[lab, 0]:
+ minx[lab, 0] = val
- counts[lab] += 1
- val = values[i, 0]
-
- # not nan
- if val == val:
- nobs[lab, 0] += 1
- if val < minx[lab, 0]:
- minx[lab, 0] = val
-
- for i in range(len(counts)):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = %(nan_val)s
- else:
- out[i, j] = minx[i, j]
+ for i in range(ncounts):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = %(nan_val)s
+ else:
+ out[i, j] = minx[i, j]
"""
@@ -1584,7 +1611,7 @@ def group_mean_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
ndarray[%(dest_type2)s, ndim=2] values,
ndarray[int64_t] labels):
cdef:
- Py_ssize_t i, j, N, K, lab
+ Py_ssize_t i, j, N, K, lab, ncounts = len(counts)
%(dest_type2)s val, count
ndarray[%(dest_type2)s, ndim=2] sumx, nobs
@@ -1596,42 +1623,44 @@ def group_mean_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
N, K = (<object> values).shape
- if K > 1:
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
+ with nogil:
+ if K > 1:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
- counts[lab] += 1
- for j in range(K):
- val = values[i, j]
+ counts[lab] += 1
+ for j in range(K):
+ val = values[i, j]
+ # not nan
+ if val == val:
+ nobs[lab, j] += 1
+ sumx[lab, j] += val
+ else:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
+
+ counts[lab] += 1
+ val = values[i, 0]
# not nan
if val == val:
- nobs[lab, j] += 1
- sumx[lab, j] += val
- else:
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
+ nobs[lab, 0] += 1
+ sumx[lab, 0] += val
- counts[lab] += 1
- val = values[i, 0]
- # not nan
- if val == val:
- nobs[lab, 0] += 1
- sumx[lab, 0] += val
-
- for i in range(len(counts)):
- for j in range(K):
- count = nobs[i, j]
- if nobs[i, j] == 0:
- out[i, j] = nan
- else:
- out[i, j] = sumx[i, j] / count
+ for i in range(ncounts):
+ for j in range(K):
+ count = nobs[i, j]
+ if nobs[i, j] == 0:
+ out[i, j] = NAN
+ else:
+ out[i, j] = sumx[i, j] / count
"""
group_mean_bin_template = """
+@cython.boundscheck(False)
def group_mean_bin_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
ndarray[int64_t] counts,
ndarray[%(dest_type2)s, ndim=2] values,
@@ -1652,40 +1681,41 @@ def group_mean_bin_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
else:
ngroups = len(bins) + 1
- b = 0
- if K > 1:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ with nogil:
+ b = 0
+ if K > 1:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
+
+ counts[b] += 1
+ for j in range(K):
+ val = values[i, j]
+
+ # not nan
+ if val == val:
+ nobs[b, j] += 1
+ sumx[b, j] += val
+ else:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
- counts[b] += 1
- for j in range(K):
- val = values[i, j]
+ counts[b] += 1
+ val = values[i, 0]
# not nan
if val == val:
- nobs[b, j] += 1
- sumx[b, j] += val
- else:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ nobs[b, 0] += 1
+ sumx[b, 0] += val
- counts[b] += 1
- val = values[i, 0]
-
- # not nan
- if val == val:
- nobs[b, 0] += 1
- sumx[b, 0] += val
-
- for i in range(ngroups):
- for j in range(K):
- count = nobs[i, j]
- if count == 0:
- out[i, j] = nan
- else:
- out[i, j] = sumx[i, j] / count
+ for i in range(ngroups):
+ for j in range(K):
+ count = nobs[i, j]
+ if count == 0:
+ out[i, j] = NAN
+ else:
+ out[i, j] = sumx[i, j] / count
"""
group_ohlc_template = """@cython.wraparound(False)
@@ -1700,7 +1730,7 @@ def group_ohlc_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
cdef:
Py_ssize_t i, j, N, K, ngroups, b
%(dest_type2)s val, count
- %(dest_type2)s vopen, vhigh, vlow, vclose, NA
+ %(dest_type2)s vopen, vhigh, vlow, vclose
bint got_first = 0
if len(bins) == 0:
@@ -1715,55 +1745,55 @@ def group_ohlc_%(name)s(ndarray[%(dest_type2)s, ndim=2] out,
if out.shape[1] != 4:
raise ValueError('Output array must have 4 columns')
- NA = np.nan
-
b = 0
if K > 1:
raise NotImplementedError("Argument 'values' must have only "
"one dimension")
else:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- if not got_first:
- out[b, 0] = NA
- out[b, 1] = NA
- out[b, 2] = NA
- out[b, 3] = NA
- else:
- out[b, 0] = vopen
- out[b, 1] = vhigh
- out[b, 2] = vlow
- out[b, 3] = vclose
- b += 1
- got_first = 0
- counts[b] += 1
- val = values[i, 0]
-
- # not nan
- if val == val:
- if not got_first:
- got_first = 1
- vopen = val
- vlow = val
- vhigh = val
- else:
- if val < vlow:
+ with nogil:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ if not got_first:
+ out[b, 0] = NAN
+ out[b, 1] = NAN
+ out[b, 2] = NAN
+ out[b, 3] = NAN
+ else:
+ out[b, 0] = vopen
+ out[b, 1] = vhigh
+ out[b, 2] = vlow
+ out[b, 3] = vclose
+ b += 1
+ got_first = 0
+
+ counts[b] += 1
+ val = values[i, 0]
+
+ # not nan
+ if val == val:
+ if not got_first:
+ got_first = 1
+ vopen = val
vlow = val
- if val > vhigh:
vhigh = val
- vclose = val
-
- if not got_first:
- out[b, 0] = NA
- out[b, 1] = NA
- out[b, 2] = NA
- out[b, 3] = NA
- else:
- out[b, 0] = vopen
- out[b, 1] = vhigh
- out[b, 2] = vlow
- out[b, 3] = vclose
+ else:
+ if val < vlow:
+ vlow = val
+ if val > vhigh:
+ vhigh = val
+ vclose = val
+
+ if not got_first:
+ out[b, 0] = NAN
+ out[b, 1] = NAN
+ out[b, 2] = NAN
+ out[b, 3] = NAN
+ else:
+ out[b, 0] = vopen
+ out[b, 1] = vhigh
+ out[b, 2] = vlow
+ out[b, 3] = vclose
"""
arrmap_template = """@cython.wraparound(False)
@@ -1780,7 +1810,6 @@ def arrmap_%(name)s(ndarray[%(c_type)s] index, object func):
result[i] = func(index[i])
return maybe_convert_objects(result)
-
"""
#----------------------------------------------------------------------
@@ -1832,7 +1861,6 @@ def left_join_indexer_unique_%(name)s(ndarray[%(c_type)s] left,
indexer[i] = -1
i += 1
return indexer
-
"""
# @cython.wraparound(False)
@@ -1939,7 +1967,6 @@ def left_join_indexer_%(name)s(ndarray[%(c_type)s] left,
j += 1
return result, lindexer, rindexer
-
"""
@@ -2035,7 +2062,6 @@ def inner_join_indexer_%(name)s(ndarray[%(c_type)s] left,
j += 1
return result, lindexer, rindexer
-
"""
@@ -2167,7 +2193,6 @@ def outer_join_indexer_%(name)s(ndarray[%(c_type)s] left,
j += 1
return result, lindexer, rindexer
-
"""
outer_join_template = """@cython.wraparound(False)
@@ -2265,7 +2290,6 @@ def outer_join_indexer_%(name)s(ndarray[%(c_type)s] left,
count += 1
return result, lindexer, rindexer
-
"""
# ensure_dtype functions
@@ -2279,7 +2303,6 @@ def outer_join_indexer_%(name)s(ndarray[%(c_type)s] left,
return arr.astype(np.%(dtype)s)
else:
return np.array(arr, dtype=np.%(dtype)s)
-
"""
ensure_functions = [
@@ -2323,19 +2346,19 @@ def put2d_%(name)s_%(dest_type)s(ndarray[%(c_type)s, ndim=2, cast=True] values,
def generate_put_template(template, use_ints=True, use_floats=True,
use_objects=False, use_datelikes=False):
floats_list = [
- ('float64', 'float64_t', 'float64_t', 'np.float64'),
- ('float32', 'float32_t', 'float32_t', 'np.float32'),
+ ('float64', 'float64_t', 'float64_t', 'np.float64', True),
+ ('float32', 'float32_t', 'float32_t', 'np.float32', True),
]
ints_list = [
- ('int8', 'int8_t', 'float32_t', 'np.float32'),
- ('int16', 'int16_t', 'float32_t', 'np.float32'),
- ('int32', 'int32_t', 'float64_t', 'np.float64'),
- ('int64', 'int64_t', 'float64_t', 'np.float64'),
+ ('int8', 'int8_t', 'float32_t', 'np.float32', True),
+ ('int16', 'int16_t', 'float32_t', 'np.float32', True),
+ ('int32', 'int32_t', 'float64_t', 'np.float64', True),
+ ('int64', 'int64_t', 'float64_t', 'np.float64', True),
]
date_like_list = [
- ('int64', 'int64_t', 'float64_t', 'np.float64'),
+ ('int64', 'int64_t', 'float64_t', 'np.float64', True),
]
- object_list = [('object', 'object', 'object', 'np.object_')]
+ object_list = [('object', 'object', 'object', 'np.object_', False)]
function_list = []
if use_floats:
function_list.extend(floats_list)
@@ -2347,28 +2370,31 @@ def generate_put_template(template, use_ints=True, use_floats=True,
function_list.extend(date_like_list)
output = StringIO()
- for name, c_type, dest_type, dest_dtype in function_list:
+ for name, c_type, dest_type, dest_dtype, nogil in function_list:
func = template % {'name': name,
'c_type': c_type,
'dest_type': dest_type.replace('_t', ''),
'dest_type2': dest_type,
- 'dest_dtype': dest_dtype}
+ 'dest_dtype': dest_dtype,
+ 'nogil' : 'with nogil:' if nogil else '',
+ 'tab' : ' ' if nogil else '' }
output.write(func)
+ output.write("\n")
return output.getvalue()
def generate_put_min_max_template(template, use_ints=True, use_floats=True,
use_objects=False, use_datelikes=False):
floats_list = [
- ('float64', 'float64_t', 'nan', 'np.inf'),
- ('float32', 'float32_t', 'nan', 'np.inf'),
+ ('float64', 'float64_t', 'NAN', 'np.inf', True),
+ ('float32', 'float32_t', 'NAN', 'np.inf', True),
]
ints_list = [
- ('int64', 'int64_t', 'iNaT', _int64_max),
+ ('int64', 'int64_t', 'iNaT', _int64_max, True),
]
date_like_list = [
- ('int64', 'int64_t', 'iNaT', _int64_max),
+ ('int64', 'int64_t', 'iNaT', _int64_max, True),
]
- object_list = [('object', 'object', 'nan', 'np.inf')]
+ object_list = [('object', 'object', 'np.nan', 'np.inf', False)]
function_list = []
if use_floats:
function_list.extend(floats_list)
@@ -2380,27 +2406,30 @@ def generate_put_min_max_template(template, use_ints=True, use_floats=True,
function_list.extend(date_like_list)
output = StringIO()
- for name, dest_type, nan_val, inf_val in function_list:
+ for name, dest_type, nan_val, inf_val, nogil in function_list:
func = template % {'name': name,
'dest_type2': dest_type,
'nan_val': nan_val,
- 'inf_val': inf_val}
+ 'inf_val': inf_val,
+ 'nogil' : "with nogil:" if nogil else '',
+ 'tab' : ' ' if nogil else '' }
output.write(func)
+ output.write("\n")
return output.getvalue()
def generate_put_selection_template(template, use_ints=True, use_floats=True,
use_objects=False, use_datelikes=False):
floats_list = [
- ('float64', 'float64_t', 'float64_t', 'nan'),
- ('float32', 'float32_t', 'float32_t', 'nan'),
+ ('float64', 'float64_t', 'float64_t', 'NAN', True),
+ ('float32', 'float32_t', 'float32_t', 'NAN', True),
]
ints_list = [
- ('int64', 'int64_t', 'int64_t', 'iNaT'),
+ ('int64', 'int64_t', 'int64_t', 'iNaT', True),
]
date_like_list = [
- ('int64', 'int64_t', 'int64_t', 'iNaT'),
+ ('int64', 'int64_t', 'int64_t', 'iNaT', True),
]
- object_list = [('object', 'object', 'object', 'nan')]
+ object_list = [('object', 'object', 'object', 'np.nan', False)]
function_list = []
if use_floats:
function_list.extend(floats_list)
@@ -2412,72 +2441,97 @@ def generate_put_selection_template(template, use_ints=True, use_floats=True,
function_list.extend(date_like_list)
output = StringIO()
- for name, c_type, dest_type, nan_val in function_list:
+ for name, c_type, dest_type, nan_val, nogil in function_list:
+
+ if nogil:
+ nogil = "with nogil:"
+ tab = ' '
+ else:
+ nogil = ''
+ tab = ''
+
func = template % {'name': name,
'c_type': c_type,
'dest_type2': dest_type,
- 'nan_val': nan_val}
+ 'nan_val': nan_val,
+ 'nogil' : nogil,
+ 'tab' : tab }
output.write(func)
+ output.write("\n")
return output.getvalue()
def generate_take_template(template, exclude=None):
- # name, dest, ctypein, ctypeout, preval, postval, cancopy
+ # name, dest, ctypein, ctypeout, preval, postval, cancopy, nogil
function_list = [
- ('bool', 'bool', 'uint8_t', 'uint8_t', '', '', True),
+ ('bool', 'bool', 'uint8_t', 'uint8_t', '', '', True, True),
('bool', 'object', 'uint8_t', 'object',
- 'True if ', ' > 0 else False', False),
- ('int8', 'int8', 'int8_t', 'int8_t', '', '', True),
- ('int8', 'int32', 'int8_t', 'int32_t', '', '', False),
- ('int8', 'int64', 'int8_t', 'int64_t', '', '', False),
- ('int8', 'float64', 'int8_t', 'float64_t', '', '', False),
- ('int16', 'int16', 'int16_t', 'int16_t', '', '', True),
- ('int16', 'int32', 'int16_t', 'int32_t', '', '', False),
- ('int16', 'int64', 'int16_t', 'int64_t', '', '', False),
- ('int16', 'float64', 'int16_t', 'float64_t', '', '', False),
- ('int32', 'int32', 'int32_t', 'int32_t', '', '', True),
- ('int32', 'int64', 'int32_t', 'int64_t', '', '', False),
- ('int32', 'float64', 'int32_t', 'float64_t', '', '', False),
- ('int64', 'int64', 'int64_t', 'int64_t', '', '', True),
- ('int64', 'float64', 'int64_t', 'float64_t', '', '', False),
- ('float32', 'float32', 'float32_t', 'float32_t', '', '', True),
- ('float32', 'float64', 'float32_t', 'float64_t', '', '', False),
- ('float64', 'float64', 'float64_t', 'float64_t', '', '', True),
- ('object', 'object', 'object', 'object', '', '', False)
+ 'True if ', ' > 0 else False', False, False),
+ ('int8', 'int8', 'int8_t', 'int8_t', '', '', True, False),
+ ('int8', 'int32', 'int8_t', 'int32_t', '', '', False, True),
+ ('int8', 'int64', 'int8_t', 'int64_t', '', '', False, True),
+ ('int8', 'float64', 'int8_t', 'float64_t', '', '', False, True),
+ ('int16', 'int16', 'int16_t', 'int16_t', '', '', True, True),
+ ('int16', 'int32', 'int16_t', 'int32_t', '', '', False, True),
+ ('int16', 'int64', 'int16_t', 'int64_t', '', '', False, True),
+ ('int16', 'float64', 'int16_t', 'float64_t', '', '', False, True),
+ ('int32', 'int32', 'int32_t', 'int32_t', '', '', True, True),
+ ('int32', 'int64', 'int32_t', 'int64_t', '', '', False, True),
+ ('int32', 'float64', 'int32_t', 'float64_t', '', '', False, True),
+ ('int64', 'int64', 'int64_t', 'int64_t', '', '', True, True),
+ ('int64', 'float64', 'int64_t', 'float64_t', '', '', False, True),
+ ('float32', 'float32', 'float32_t', 'float32_t', '', '', True, True),
+ ('float32', 'float64', 'float32_t', 'float64_t', '', '', False, True),
+ ('float64', 'float64', 'float64_t', 'float64_t', '', '', True, True),
+ ('object', 'object', 'object', 'object', '', '', False, False),
]
output = StringIO()
for (name, dest, c_type_in, c_type_out,
- preval, postval, can_copy) in function_list:
+ preval, postval, can_copy, nogil) in function_list:
+
if exclude is not None and name in exclude:
continue
+ if nogil:
+ nogil = "with nogil:"
+ tab = ' '
+ else:
+ nogil = ''
+ tab = ''
+
func = template % {'name': name, 'dest': dest,
'c_type_in': c_type_in, 'c_type_out': c_type_out,
'preval': preval, 'postval': postval,
- 'can_copy': 'True' if can_copy else 'False'}
+ 'can_copy': 'True' if can_copy else 'False',
+ 'nogil' : nogil,
+ 'tab' : tab }
output.write(func)
+ output.write("\n")
return output.getvalue()
def generate_from_template(template, exclude=None):
# name, ctype, capable of holding NA
function_list = [
- ('float64', 'float64_t', 'np.float64', True),
- ('float32', 'float32_t', 'np.float32', True),
- ('object', 'object', 'object', True),
- ('int32', 'int32_t', 'np.int32', False),
- ('int64', 'int64_t', 'np.int64', False),
- ('bool', 'uint8_t', 'np.bool', False)
+ ('float64', 'float64_t', 'np.float64', True, True),
+ ('float32', 'float32_t', 'np.float32', True, True),
+ ('object', 'object', 'object', True, False),
+ ('int32', 'int32_t', 'np.int32', False, True),
+ ('int64', 'int64_t', 'np.int64', False, True),
+ ('bool', 'uint8_t', 'np.bool', False, True)
]
output = StringIO()
- for name, c_type, dtype, can_hold_na in function_list:
+ for name, c_type, dtype, can_hold_na, nogil in function_list:
if exclude is not None and name in exclude:
continue
func = template % {'name': name, 'c_type': c_type,
'dtype': dtype,
- 'raise_on_na': 'False' if can_hold_na else 'True'}
+ 'raise_on_na': 'False' if can_hold_na else 'True',
+ 'nogil' : 'with nogil:' if nogil else '',
+ 'tab' : ' ' if nogil else '' }
output.write(func)
+ output.write("\n")
return output.getvalue()
put_2d = [diff_2d_template]
diff --git a/pandas/src/generated.pyx b/pandas/src/generated.pyx
index 83dfacba45211..11334516ea555 100644
--- a/pandas/src/generated.pyx
+++ b/pandas/src/generated.pyx
@@ -14,6 +14,9 @@ from cpython cimport (PyDict_New, PyDict_GetItem, PyDict_SetItem,
from cpython cimport PyFloat_Check
cimport cpython
+cdef extern from "numpy/npy_math.h":
+ double NAN "NPY_NAN"
+
import numpy as np
isnan = np.isnan
@@ -63,7 +66,6 @@ cpdef ensure_object(object arr):
return np.array(arr, dtype=np.object_)
-
cpdef ensure_float64(object arr):
if util.is_array(arr):
if (<ndarray> arr).descr.type_num == NPY_FLOAT64:
@@ -73,7 +75,6 @@ cpdef ensure_float64(object arr):
else:
return np.array(arr, dtype=np.float64)
-
cpdef ensure_float32(object arr):
if util.is_array(arr):
if (<ndarray> arr).descr.type_num == NPY_FLOAT32:
@@ -83,7 +84,6 @@ cpdef ensure_float32(object arr):
else:
return np.array(arr, dtype=np.float32)
-
cpdef ensure_int8(object arr):
if util.is_array(arr):
if (<ndarray> arr).descr.type_num == NPY_INT8:
@@ -93,7 +93,6 @@ cpdef ensure_int8(object arr):
else:
return np.array(arr, dtype=np.int8)
-
cpdef ensure_int16(object arr):
if util.is_array(arr):
if (<ndarray> arr).descr.type_num == NPY_INT16:
@@ -103,7 +102,6 @@ cpdef ensure_int16(object arr):
else:
return np.array(arr, dtype=np.int16)
-
cpdef ensure_int32(object arr):
if util.is_array(arr):
if (<ndarray> arr).descr.type_num == NPY_INT32:
@@ -113,7 +111,6 @@ cpdef ensure_int32(object arr):
else:
return np.array(arr, dtype=np.int32)
-
cpdef ensure_int64(object arr):
if util.is_array(arr):
if (<ndarray> arr).descr.type_num == NPY_INT64:
@@ -123,7 +120,6 @@ cpdef ensure_int64(object arr):
else:
return np.array(arr, dtype=np.int64)
-
@cython.wraparound(False)
@cython.boundscheck(False)
cpdef map_indices_float64(ndarray[float64_t] index):
@@ -1228,6 +1224,7 @@ def backfill_inplace_float64(ndarray[float64_t] values,
else:
fill_count = 0
val = values[i]
+
@cython.boundscheck(False)
@cython.wraparound(False)
def backfill_inplace_float32(ndarray[float32_t] values,
@@ -1260,6 +1257,7 @@ def backfill_inplace_float32(ndarray[float32_t] values,
else:
fill_count = 0
val = values[i]
+
@cython.boundscheck(False)
@cython.wraparound(False)
def backfill_inplace_object(ndarray[object] values,
@@ -1292,6 +1290,7 @@ def backfill_inplace_object(ndarray[object] values,
else:
fill_count = 0
val = values[i]
+
@cython.boundscheck(False)
@cython.wraparound(False)
def backfill_inplace_int32(ndarray[int32_t] values,
@@ -1324,6 +1323,7 @@ def backfill_inplace_int32(ndarray[int32_t] values,
else:
fill_count = 0
val = values[i]
+
@cython.boundscheck(False)
@cython.wraparound(False)
def backfill_inplace_int64(ndarray[int64_t] values,
@@ -1356,6 +1356,7 @@ def backfill_inplace_int64(ndarray[int64_t] values,
else:
fill_count = 0
val = values[i]
+
@cython.boundscheck(False)
@cython.wraparound(False)
def backfill_inplace_bool(ndarray[uint8_t] values,
@@ -1389,6 +1390,7 @@ def backfill_inplace_bool(ndarray[uint8_t] values,
fill_count = 0
val = values[i]
+
@cython.boundscheck(False)
@cython.wraparound(False)
def pad_2d_inplace_float64(ndarray[float64_t, ndim=2] values,
@@ -1423,6 +1425,7 @@ def pad_2d_inplace_float64(ndarray[float64_t, ndim=2] values,
else:
fill_count = 0
val = values[j, i]
+
@cython.boundscheck(False)
@cython.wraparound(False)
def pad_2d_inplace_float32(ndarray[float32_t, ndim=2] values,
@@ -1457,6 +1460,7 @@ def pad_2d_inplace_float32(ndarray[float32_t, ndim=2] values,
else:
fill_count = 0
val = values[j, i]
+
@cython.boundscheck(False)
@cython.wraparound(False)
def pad_2d_inplace_object(ndarray[object, ndim=2] values,
@@ -1491,6 +1495,7 @@ def pad_2d_inplace_object(ndarray[object, ndim=2] values,
else:
fill_count = 0
val = values[j, i]
+
@cython.boundscheck(False)
@cython.wraparound(False)
def pad_2d_inplace_int32(ndarray[int32_t, ndim=2] values,
@@ -1525,6 +1530,7 @@ def pad_2d_inplace_int32(ndarray[int32_t, ndim=2] values,
else:
fill_count = 0
val = values[j, i]
+
@cython.boundscheck(False)
@cython.wraparound(False)
def pad_2d_inplace_int64(ndarray[int64_t, ndim=2] values,
@@ -1559,6 +1565,7 @@ def pad_2d_inplace_int64(ndarray[int64_t, ndim=2] values,
else:
fill_count = 0
val = values[j, i]
+
@cython.boundscheck(False)
@cython.wraparound(False)
def pad_2d_inplace_bool(ndarray[uint8_t, ndim=2] values,
@@ -1594,6 +1601,7 @@ def pad_2d_inplace_bool(ndarray[uint8_t, ndim=2] values,
fill_count = 0
val = values[j, i]
+
@cython.boundscheck(False)
@cython.wraparound(False)
def backfill_2d_inplace_float64(ndarray[float64_t, ndim=2] values,
@@ -1628,6 +1636,7 @@ def backfill_2d_inplace_float64(ndarray[float64_t, ndim=2] values,
else:
fill_count = 0
val = values[j, i]
+
@cython.boundscheck(False)
@cython.wraparound(False)
def backfill_2d_inplace_float32(ndarray[float32_t, ndim=2] values,
@@ -1662,6 +1671,7 @@ def backfill_2d_inplace_float32(ndarray[float32_t, ndim=2] values,
else:
fill_count = 0
val = values[j, i]
+
@cython.boundscheck(False)
@cython.wraparound(False)
def backfill_2d_inplace_object(ndarray[object, ndim=2] values,
@@ -1696,6 +1706,7 @@ def backfill_2d_inplace_object(ndarray[object, ndim=2] values,
else:
fill_count = 0
val = values[j, i]
+
@cython.boundscheck(False)
@cython.wraparound(False)
def backfill_2d_inplace_int32(ndarray[int32_t, ndim=2] values,
@@ -1730,6 +1741,7 @@ def backfill_2d_inplace_int32(ndarray[int32_t, ndim=2] values,
else:
fill_count = 0
val = values[j, i]
+
@cython.boundscheck(False)
@cython.wraparound(False)
def backfill_2d_inplace_int64(ndarray[int64_t, ndim=2] values,
@@ -1764,6 +1776,7 @@ def backfill_2d_inplace_int64(ndarray[int64_t, ndim=2] values,
else:
fill_count = 0
val = values[j, i]
+
@cython.boundscheck(False)
@cython.wraparound(False)
def backfill_2d_inplace_bool(ndarray[uint8_t, ndim=2] values,
@@ -1799,18 +1812,18 @@ def backfill_2d_inplace_bool(ndarray[uint8_t, ndim=2] values,
fill_count = 0
val = values[j, i]
+
@cython.boundscheck(False)
@cython.wraparound(False)
def is_monotonic_float64(ndarray[float64_t] arr, bint timelike):
'''
Returns
-------
- is_monotonic_inc, is_monotonic_dec, is_unique
+ is_monotonic_inc, is_monotonic_dec
'''
cdef:
Py_ssize_t i, n
float64_t prev, cur
- bint is_unique = 1
bint is_monotonic_inc = 1
bint is_monotonic_dec = 1
@@ -1819,45 +1832,52 @@ def is_monotonic_float64(ndarray[float64_t] arr, bint timelike):
if n == 1:
if arr[0] != arr[0] or (timelike and arr[0] == iNaT):
# single value is NaN
- return False, False, True
+ return False, False
else:
- return True, True, True
+ return True, True
elif n < 2:
- return True, True, True
+ return True, True
if timelike and arr[0] == iNaT:
- return False, False, None
+ return False, False
+
+ with nogil:
+ prev = arr[0]
+ for i in range(1, n):
+ cur = arr[i]
+ if timelike and cur == iNaT:
+ is_monotonic_inc = 0
+ is_monotonic_dec = 0
+ break
+ if cur < prev:
+ is_monotonic_inc = 0
+ elif cur > prev:
+ is_monotonic_dec = 0
+ elif cur == prev:
+ pass # is_unique = 0
+ else:
+ # cur or prev is NaN
+ is_monotonic_inc = 0
+ is_monotonic_dec = 0
+ break
+ if not is_monotonic_inc and not is_monotonic_dec:
+ is_monotonic_inc = 0
+ is_monotonic_dec = 0
+ break
+ prev = cur
+ return is_monotonic_inc, is_monotonic_dec
- prev = arr[0]
- for i in range(1, n):
- cur = arr[i]
- if timelike and cur == iNaT:
- return False, False, None
- if cur < prev:
- is_monotonic_inc = 0
- elif cur > prev:
- is_monotonic_dec = 0
- elif cur == prev:
- is_unique = 0
- else:
- # cur or prev is NaN
- return False, False, None
- if not is_monotonic_inc and not is_monotonic_dec:
- return False, False, None
- prev = cur
- return is_monotonic_inc, is_monotonic_dec, is_unique
@cython.boundscheck(False)
@cython.wraparound(False)
def is_monotonic_float32(ndarray[float32_t] arr, bint timelike):
'''
Returns
-------
- is_monotonic_inc, is_monotonic_dec, is_unique
+ is_monotonic_inc, is_monotonic_dec
'''
cdef:
Py_ssize_t i, n
float32_t prev, cur
- bint is_unique = 1
bint is_monotonic_inc = 1
bint is_monotonic_dec = 1
@@ -1866,45 +1886,52 @@ def is_monotonic_float32(ndarray[float32_t] arr, bint timelike):
if n == 1:
if arr[0] != arr[0] or (timelike and arr[0] == iNaT):
# single value is NaN
- return False, False, True
+ return False, False
else:
- return True, True, True
+ return True, True
elif n < 2:
- return True, True, True
+ return True, True
if timelike and arr[0] == iNaT:
- return False, False, None
+ return False, False
+
+ with nogil:
+ prev = arr[0]
+ for i in range(1, n):
+ cur = arr[i]
+ if timelike and cur == iNaT:
+ is_monotonic_inc = 0
+ is_monotonic_dec = 0
+ break
+ if cur < prev:
+ is_monotonic_inc = 0
+ elif cur > prev:
+ is_monotonic_dec = 0
+ elif cur == prev:
+ pass # is_unique = 0
+ else:
+ # cur or prev is NaN
+ is_monotonic_inc = 0
+ is_monotonic_dec = 0
+ break
+ if not is_monotonic_inc and not is_monotonic_dec:
+ is_monotonic_inc = 0
+ is_monotonic_dec = 0
+ break
+ prev = cur
+ return is_monotonic_inc, is_monotonic_dec
- prev = arr[0]
- for i in range(1, n):
- cur = arr[i]
- if timelike and cur == iNaT:
- return False, False, None
- if cur < prev:
- is_monotonic_inc = 0
- elif cur > prev:
- is_monotonic_dec = 0
- elif cur == prev:
- is_unique = 0
- else:
- # cur or prev is NaN
- return False, False, None
- if not is_monotonic_inc and not is_monotonic_dec:
- return False, False, None
- prev = cur
- return is_monotonic_inc, is_monotonic_dec, is_unique
@cython.boundscheck(False)
@cython.wraparound(False)
def is_monotonic_object(ndarray[object] arr, bint timelike):
'''
Returns
-------
- is_monotonic_inc, is_monotonic_dec, is_unique
+ is_monotonic_inc, is_monotonic_dec
'''
cdef:
Py_ssize_t i, n
object prev, cur
- bint is_unique = 1
bint is_monotonic_inc = 1
bint is_monotonic_dec = 1
@@ -1913,45 +1940,52 @@ def is_monotonic_object(ndarray[object] arr, bint timelike):
if n == 1:
if arr[0] != arr[0] or (timelike and arr[0] == iNaT):
# single value is NaN
- return False, False, True
+ return False, False
else:
- return True, True, True
+ return True, True
elif n < 2:
- return True, True, True
+ return True, True
if timelike and arr[0] == iNaT:
- return False, False, None
+ return False, False
+
prev = arr[0]
for i in range(1, n):
cur = arr[i]
if timelike and cur == iNaT:
- return False, False, None
+ is_monotonic_inc = 0
+ is_monotonic_dec = 0
+ break
if cur < prev:
is_monotonic_inc = 0
elif cur > prev:
is_monotonic_dec = 0
elif cur == prev:
- is_unique = 0
+ pass # is_unique = 0
else:
# cur or prev is NaN
- return False, False, None
+ is_monotonic_inc = 0
+ is_monotonic_dec = 0
+ break
if not is_monotonic_inc and not is_monotonic_dec:
- return False, False, None
+ is_monotonic_inc = 0
+ is_monotonic_dec = 0
+ break
prev = cur
- return is_monotonic_inc, is_monotonic_dec, is_unique
+ return is_monotonic_inc, is_monotonic_dec
+
@cython.boundscheck(False)
@cython.wraparound(False)
def is_monotonic_int32(ndarray[int32_t] arr, bint timelike):
'''
Returns
-------
- is_monotonic_inc, is_monotonic_dec, is_unique
+ is_monotonic_inc, is_monotonic_dec
'''
cdef:
Py_ssize_t i, n
int32_t prev, cur
- bint is_unique = 1
bint is_monotonic_inc = 1
bint is_monotonic_dec = 1
@@ -1960,45 +1994,52 @@ def is_monotonic_int32(ndarray[int32_t] arr, bint timelike):
if n == 1:
if arr[0] != arr[0] or (timelike and arr[0] == iNaT):
# single value is NaN
- return False, False, True
+ return False, False
else:
- return True, True, True
+ return True, True
elif n < 2:
- return True, True, True
+ return True, True
if timelike and arr[0] == iNaT:
- return False, False, None
+ return False, False
+
+ with nogil:
+ prev = arr[0]
+ for i in range(1, n):
+ cur = arr[i]
+ if timelike and cur == iNaT:
+ is_monotonic_inc = 0
+ is_monotonic_dec = 0
+ break
+ if cur < prev:
+ is_monotonic_inc = 0
+ elif cur > prev:
+ is_monotonic_dec = 0
+ elif cur == prev:
+ pass # is_unique = 0
+ else:
+ # cur or prev is NaN
+ is_monotonic_inc = 0
+ is_monotonic_dec = 0
+ break
+ if not is_monotonic_inc and not is_monotonic_dec:
+ is_monotonic_inc = 0
+ is_monotonic_dec = 0
+ break
+ prev = cur
+ return is_monotonic_inc, is_monotonic_dec
- prev = arr[0]
- for i in range(1, n):
- cur = arr[i]
- if timelike and cur == iNaT:
- return False, False, None
- if cur < prev:
- is_monotonic_inc = 0
- elif cur > prev:
- is_monotonic_dec = 0
- elif cur == prev:
- is_unique = 0
- else:
- # cur or prev is NaN
- return False, False, None
- if not is_monotonic_inc and not is_monotonic_dec:
- return False, False, None
- prev = cur
- return is_monotonic_inc, is_monotonic_dec, is_unique
@cython.boundscheck(False)
@cython.wraparound(False)
def is_monotonic_int64(ndarray[int64_t] arr, bint timelike):
'''
Returns
-------
- is_monotonic_inc, is_monotonic_dec, is_unique
+ is_monotonic_inc, is_monotonic_dec
'''
cdef:
Py_ssize_t i, n
int64_t prev, cur
- bint is_unique = 1
bint is_monotonic_inc = 1
bint is_monotonic_dec = 1
@@ -2007,45 +2048,52 @@ def is_monotonic_int64(ndarray[int64_t] arr, bint timelike):
if n == 1:
if arr[0] != arr[0] or (timelike and arr[0] == iNaT):
# single value is NaN
- return False, False, True
+ return False, False
else:
- return True, True, True
+ return True, True
elif n < 2:
- return True, True, True
+ return True, True
if timelike and arr[0] == iNaT:
- return False, False, None
+ return False, False
+
+ with nogil:
+ prev = arr[0]
+ for i in range(1, n):
+ cur = arr[i]
+ if timelike and cur == iNaT:
+ is_monotonic_inc = 0
+ is_monotonic_dec = 0
+ break
+ if cur < prev:
+ is_monotonic_inc = 0
+ elif cur > prev:
+ is_monotonic_dec = 0
+ elif cur == prev:
+ pass # is_unique = 0
+ else:
+ # cur or prev is NaN
+ is_monotonic_inc = 0
+ is_monotonic_dec = 0
+ break
+ if not is_monotonic_inc and not is_monotonic_dec:
+ is_monotonic_inc = 0
+ is_monotonic_dec = 0
+ break
+ prev = cur
+ return is_monotonic_inc, is_monotonic_dec
- prev = arr[0]
- for i in range(1, n):
- cur = arr[i]
- if timelike and cur == iNaT:
- return False, False, None
- if cur < prev:
- is_monotonic_inc = 0
- elif cur > prev:
- is_monotonic_dec = 0
- elif cur == prev:
- is_unique = 0
- else:
- # cur or prev is NaN
- return False, False, None
- if not is_monotonic_inc and not is_monotonic_dec:
- return False, False, None
- prev = cur
- return is_monotonic_inc, is_monotonic_dec, is_unique
@cython.boundscheck(False)
@cython.wraparound(False)
def is_monotonic_bool(ndarray[uint8_t] arr, bint timelike):
'''
Returns
-------
- is_monotonic_inc, is_monotonic_dec, is_unique
+ is_monotonic_inc, is_monotonic_dec
'''
cdef:
Py_ssize_t i, n
uint8_t prev, cur
- bint is_unique = 1
bint is_monotonic_inc = 1
bint is_monotonic_dec = 1
@@ -2054,33 +2102,41 @@ def is_monotonic_bool(ndarray[uint8_t] arr, bint timelike):
if n == 1:
if arr[0] != arr[0] or (timelike and arr[0] == iNaT):
# single value is NaN
- return False, False, True
+ return False, False
else:
- return True, True, True
+ return True, True
elif n < 2:
- return True, True, True
+ return True, True
if timelike and arr[0] == iNaT:
- return False, False, None
+ return False, False
+
+ with nogil:
+ prev = arr[0]
+ for i in range(1, n):
+ cur = arr[i]
+ if timelike and cur == iNaT:
+ is_monotonic_inc = 0
+ is_monotonic_dec = 0
+ break
+ if cur < prev:
+ is_monotonic_inc = 0
+ elif cur > prev:
+ is_monotonic_dec = 0
+ elif cur == prev:
+ pass # is_unique = 0
+ else:
+ # cur or prev is NaN
+ is_monotonic_inc = 0
+ is_monotonic_dec = 0
+ break
+ if not is_monotonic_inc and not is_monotonic_dec:
+ is_monotonic_inc = 0
+ is_monotonic_dec = 0
+ break
+ prev = cur
+ return is_monotonic_inc, is_monotonic_dec
- prev = arr[0]
- for i in range(1, n):
- cur = arr[i]
- if timelike and cur == iNaT:
- return False, False, None
- if cur < prev:
- is_monotonic_inc = 0
- elif cur > prev:
- is_monotonic_dec = 0
- elif cur == prev:
- is_unique = 0
- else:
- # cur or prev is NaN
- return False, False, None
- if not is_monotonic_inc and not is_monotonic_dec:
- return False, False, None
- prev = cur
- return is_monotonic_inc, is_monotonic_dec, is_unique
@cython.wraparound(False)
@cython.boundscheck(False)
@@ -2342,37 +2398,45 @@ def arrmap_bool(ndarray[uint8_t] index, object func):
return maybe_convert_objects(result)
+
@cython.wraparound(False)
-def take_1d_bool_bool(ndarray[uint8_t] values,
- ndarray[int64_t] indexer,
- ndarray[uint8_t] out,
+@cython.boundscheck(False)
+def take_1d_bool_bool(uint8_t[:] values,
+ int64_t[:] indexer,
+ uint8_t[:] out,
fill_value=np.nan):
cdef:
Py_ssize_t i, n, idx
uint8_t fv
- n = len(indexer)
+ n = indexer.shape[0]
fv = fill_value
- for i from 0 <= i < n:
- idx = indexer[i]
- if idx == -1:
- out[i] = fv
- else:
- out[i] = values[idx]
+
+ with nogil:
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ out[i] = fv
+ else:
+ out[i] = values[idx]
+
@cython.wraparound(False)
-def take_1d_bool_object(ndarray[uint8_t] values,
- ndarray[int64_t] indexer,
- ndarray[object] out,
+@cython.boundscheck(False)
+def take_1d_bool_object(uint8_t[:] values,
+ int64_t[:] indexer,
+ object[:] out,
fill_value=np.nan):
cdef:
Py_ssize_t i, n, idx
object fv
- n = len(indexer)
+ n = indexer.shape[0]
fv = fill_value
+
+
for i from 0 <= i < n:
idx = indexer[i]
if idx == -1:
@@ -2380,18 +2444,22 @@ def take_1d_bool_object(ndarray[uint8_t] values,
else:
out[i] = True if values[idx] > 0 else False
+
@cython.wraparound(False)
-def take_1d_int8_int8(ndarray[int8_t] values,
- ndarray[int64_t] indexer,
- ndarray[int8_t] out,
+@cython.boundscheck(False)
+def take_1d_int8_int8(int8_t[:] values,
+ int64_t[:] indexer,
+ int8_t[:] out,
fill_value=np.nan):
cdef:
Py_ssize_t i, n, idx
int8_t fv
- n = len(indexer)
+ n = indexer.shape[0]
fv = fill_value
+
+
for i from 0 <= i < n:
idx = indexer[i]
if idx == -1:
@@ -2399,303 +2467,367 @@ def take_1d_int8_int8(ndarray[int8_t] values,
else:
out[i] = values[idx]
+
@cython.wraparound(False)
-def take_1d_int8_int32(ndarray[int8_t] values,
- ndarray[int64_t] indexer,
- ndarray[int32_t] out,
+@cython.boundscheck(False)
+def take_1d_int8_int32(int8_t[:] values,
+ int64_t[:] indexer,
+ int32_t[:] out,
fill_value=np.nan):
cdef:
Py_ssize_t i, n, idx
int32_t fv
- n = len(indexer)
+ n = indexer.shape[0]
fv = fill_value
- for i from 0 <= i < n:
- idx = indexer[i]
- if idx == -1:
- out[i] = fv
- else:
- out[i] = values[idx]
+
+ with nogil:
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ out[i] = fv
+ else:
+ out[i] = values[idx]
+
@cython.wraparound(False)
-def take_1d_int8_int64(ndarray[int8_t] values,
- ndarray[int64_t] indexer,
- ndarray[int64_t] out,
+@cython.boundscheck(False)
+def take_1d_int8_int64(int8_t[:] values,
+ int64_t[:] indexer,
+ int64_t[:] out,
fill_value=np.nan):
cdef:
Py_ssize_t i, n, idx
int64_t fv
- n = len(indexer)
+ n = indexer.shape[0]
fv = fill_value
- for i from 0 <= i < n:
- idx = indexer[i]
- if idx == -1:
- out[i] = fv
- else:
- out[i] = values[idx]
+
+ with nogil:
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ out[i] = fv
+ else:
+ out[i] = values[idx]
+
@cython.wraparound(False)
-def take_1d_int8_float64(ndarray[int8_t] values,
- ndarray[int64_t] indexer,
- ndarray[float64_t] out,
+@cython.boundscheck(False)
+def take_1d_int8_float64(int8_t[:] values,
+ int64_t[:] indexer,
+ float64_t[:] out,
fill_value=np.nan):
cdef:
Py_ssize_t i, n, idx
float64_t fv
- n = len(indexer)
+ n = indexer.shape[0]
fv = fill_value
- for i from 0 <= i < n:
- idx = indexer[i]
- if idx == -1:
- out[i] = fv
- else:
- out[i] = values[idx]
+
+ with nogil:
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ out[i] = fv
+ else:
+ out[i] = values[idx]
+
@cython.wraparound(False)
-def take_1d_int16_int16(ndarray[int16_t] values,
- ndarray[int64_t] indexer,
- ndarray[int16_t] out,
+@cython.boundscheck(False)
+def take_1d_int16_int16(int16_t[:] values,
+ int64_t[:] indexer,
+ int16_t[:] out,
fill_value=np.nan):
cdef:
Py_ssize_t i, n, idx
int16_t fv
- n = len(indexer)
+ n = indexer.shape[0]
fv = fill_value
- for i from 0 <= i < n:
- idx = indexer[i]
- if idx == -1:
- out[i] = fv
- else:
- out[i] = values[idx]
+
+ with nogil:
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ out[i] = fv
+ else:
+ out[i] = values[idx]
+
@cython.wraparound(False)
-def take_1d_int16_int32(ndarray[int16_t] values,
- ndarray[int64_t] indexer,
- ndarray[int32_t] out,
+@cython.boundscheck(False)
+def take_1d_int16_int32(int16_t[:] values,
+ int64_t[:] indexer,
+ int32_t[:] out,
fill_value=np.nan):
cdef:
Py_ssize_t i, n, idx
int32_t fv
- n = len(indexer)
+ n = indexer.shape[0]
fv = fill_value
- for i from 0 <= i < n:
- idx = indexer[i]
- if idx == -1:
- out[i] = fv
- else:
- out[i] = values[idx]
+
+ with nogil:
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ out[i] = fv
+ else:
+ out[i] = values[idx]
+
@cython.wraparound(False)
-def take_1d_int16_int64(ndarray[int16_t] values,
- ndarray[int64_t] indexer,
- ndarray[int64_t] out,
+@cython.boundscheck(False)
+def take_1d_int16_int64(int16_t[:] values,
+ int64_t[:] indexer,
+ int64_t[:] out,
fill_value=np.nan):
cdef:
Py_ssize_t i, n, idx
int64_t fv
- n = len(indexer)
+ n = indexer.shape[0]
fv = fill_value
- for i from 0 <= i < n:
- idx = indexer[i]
- if idx == -1:
- out[i] = fv
- else:
- out[i] = values[idx]
+
+ with nogil:
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ out[i] = fv
+ else:
+ out[i] = values[idx]
+
@cython.wraparound(False)
-def take_1d_int16_float64(ndarray[int16_t] values,
- ndarray[int64_t] indexer,
- ndarray[float64_t] out,
+@cython.boundscheck(False)
+def take_1d_int16_float64(int16_t[:] values,
+ int64_t[:] indexer,
+ float64_t[:] out,
fill_value=np.nan):
cdef:
Py_ssize_t i, n, idx
float64_t fv
- n = len(indexer)
+ n = indexer.shape[0]
fv = fill_value
- for i from 0 <= i < n:
- idx = indexer[i]
- if idx == -1:
- out[i] = fv
- else:
- out[i] = values[idx]
+
+ with nogil:
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ out[i] = fv
+ else:
+ out[i] = values[idx]
+
@cython.wraparound(False)
-def take_1d_int32_int32(ndarray[int32_t] values,
- ndarray[int64_t] indexer,
- ndarray[int32_t] out,
+@cython.boundscheck(False)
+def take_1d_int32_int32(int32_t[:] values,
+ int64_t[:] indexer,
+ int32_t[:] out,
fill_value=np.nan):
cdef:
Py_ssize_t i, n, idx
int32_t fv
- n = len(indexer)
+ n = indexer.shape[0]
fv = fill_value
- for i from 0 <= i < n:
- idx = indexer[i]
- if idx == -1:
- out[i] = fv
- else:
- out[i] = values[idx]
+
+ with nogil:
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ out[i] = fv
+ else:
+ out[i] = values[idx]
+
@cython.wraparound(False)
-def take_1d_int32_int64(ndarray[int32_t] values,
- ndarray[int64_t] indexer,
- ndarray[int64_t] out,
+@cython.boundscheck(False)
+def take_1d_int32_int64(int32_t[:] values,
+ int64_t[:] indexer,
+ int64_t[:] out,
fill_value=np.nan):
cdef:
Py_ssize_t i, n, idx
int64_t fv
- n = len(indexer)
+ n = indexer.shape[0]
fv = fill_value
- for i from 0 <= i < n:
- idx = indexer[i]
- if idx == -1:
- out[i] = fv
- else:
- out[i] = values[idx]
+
+ with nogil:
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ out[i] = fv
+ else:
+ out[i] = values[idx]
+
@cython.wraparound(False)
-def take_1d_int32_float64(ndarray[int32_t] values,
- ndarray[int64_t] indexer,
- ndarray[float64_t] out,
+@cython.boundscheck(False)
+def take_1d_int32_float64(int32_t[:] values,
+ int64_t[:] indexer,
+ float64_t[:] out,
fill_value=np.nan):
cdef:
Py_ssize_t i, n, idx
float64_t fv
- n = len(indexer)
+ n = indexer.shape[0]
fv = fill_value
- for i from 0 <= i < n:
- idx = indexer[i]
- if idx == -1:
- out[i] = fv
- else:
- out[i] = values[idx]
-@cython.wraparound(False)
-def take_1d_int64_int64(ndarray[int64_t] values,
- ndarray[int64_t] indexer,
- ndarray[int64_t] out,
- fill_value=np.nan):
- cdef:
+ with nogil:
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ out[i] = fv
+ else:
+ out[i] = values[idx]
+
+
+@cython.wraparound(False)
+@cython.boundscheck(False)
+def take_1d_int64_int64(int64_t[:] values,
+ int64_t[:] indexer,
+ int64_t[:] out,
+ fill_value=np.nan):
+ cdef:
Py_ssize_t i, n, idx
int64_t fv
- n = len(indexer)
+ n = indexer.shape[0]
fv = fill_value
- for i from 0 <= i < n:
- idx = indexer[i]
- if idx == -1:
- out[i] = fv
- else:
- out[i] = values[idx]
+
+ with nogil:
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ out[i] = fv
+ else:
+ out[i] = values[idx]
+
@cython.wraparound(False)
-def take_1d_int64_float64(ndarray[int64_t] values,
- ndarray[int64_t] indexer,
- ndarray[float64_t] out,
+@cython.boundscheck(False)
+def take_1d_int64_float64(int64_t[:] values,
+ int64_t[:] indexer,
+ float64_t[:] out,
fill_value=np.nan):
cdef:
Py_ssize_t i, n, idx
float64_t fv
- n = len(indexer)
+ n = indexer.shape[0]
fv = fill_value
- for i from 0 <= i < n:
- idx = indexer[i]
- if idx == -1:
- out[i] = fv
- else:
- out[i] = values[idx]
+
+ with nogil:
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ out[i] = fv
+ else:
+ out[i] = values[idx]
+
@cython.wraparound(False)
-def take_1d_float32_float32(ndarray[float32_t] values,
- ndarray[int64_t] indexer,
- ndarray[float32_t] out,
+@cython.boundscheck(False)
+def take_1d_float32_float32(float32_t[:] values,
+ int64_t[:] indexer,
+ float32_t[:] out,
fill_value=np.nan):
cdef:
Py_ssize_t i, n, idx
float32_t fv
- n = len(indexer)
+ n = indexer.shape[0]
fv = fill_value
- for i from 0 <= i < n:
- idx = indexer[i]
- if idx == -1:
- out[i] = fv
- else:
- out[i] = values[idx]
+
+ with nogil:
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ out[i] = fv
+ else:
+ out[i] = values[idx]
+
@cython.wraparound(False)
-def take_1d_float32_float64(ndarray[float32_t] values,
- ndarray[int64_t] indexer,
- ndarray[float64_t] out,
+@cython.boundscheck(False)
+def take_1d_float32_float64(float32_t[:] values,
+ int64_t[:] indexer,
+ float64_t[:] out,
fill_value=np.nan):
cdef:
Py_ssize_t i, n, idx
float64_t fv
- n = len(indexer)
+ n = indexer.shape[0]
fv = fill_value
- for i from 0 <= i < n:
- idx = indexer[i]
- if idx == -1:
- out[i] = fv
- else:
- out[i] = values[idx]
+
+ with nogil:
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ out[i] = fv
+ else:
+ out[i] = values[idx]
+
@cython.wraparound(False)
-def take_1d_float64_float64(ndarray[float64_t] values,
- ndarray[int64_t] indexer,
- ndarray[float64_t] out,
+@cython.boundscheck(False)
+def take_1d_float64_float64(float64_t[:] values,
+ int64_t[:] indexer,
+ float64_t[:] out,
fill_value=np.nan):
cdef:
Py_ssize_t i, n, idx
float64_t fv
- n = len(indexer)
+ n = indexer.shape[0]
fv = fill_value
- for i from 0 <= i < n:
- idx = indexer[i]
- if idx == -1:
- out[i] = fv
- else:
- out[i] = values[idx]
+
+ with nogil:
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ out[i] = fv
+ else:
+ out[i] = values[idx]
+
@cython.wraparound(False)
-def take_1d_object_object(ndarray[object] values,
- ndarray[int64_t] indexer,
- ndarray[object] out,
+@cython.boundscheck(False)
+def take_1d_object_object(object[:] values,
+ int64_t[:] indexer,
+ object[:] out,
fill_value=np.nan):
cdef:
Py_ssize_t i, n, idx
object fv
- n = len(indexer)
+ n = indexer.shape[0]
fv = fill_value
+
+
for i from 0 <= i < n:
idx = indexer[i]
if idx == -1:
@@ -2750,7 +2882,6 @@ cdef inline take_2d_axis0_bool_bool_memview(uint8_t[:, :] values,
out[i, j] = values[idx, j]
-
@cython.wraparound(False)
@cython.boundscheck(False)
def take_2d_axis0_bool_bool(ndarray[uint8_t, ndim=2] values,
@@ -2851,7 +2982,6 @@ cdef inline take_2d_axis0_bool_object_memview(uint8_t[:, :] values,
out[i, j] = True if values[idx, j] > 0 else False
-
@cython.wraparound(False)
@cython.boundscheck(False)
def take_2d_axis0_bool_object(ndarray[uint8_t, ndim=2] values,
@@ -2952,7 +3082,6 @@ cdef inline take_2d_axis0_int8_int8_memview(int8_t[:, :] values,
out[i, j] = values[idx, j]
-
@cython.wraparound(False)
@cython.boundscheck(False)
def take_2d_axis0_int8_int8(ndarray[int8_t, ndim=2] values,
@@ -3053,7 +3182,6 @@ cdef inline take_2d_axis0_int8_int32_memview(int8_t[:, :] values,
out[i, j] = values[idx, j]
-
@cython.wraparound(False)
@cython.boundscheck(False)
def take_2d_axis0_int8_int32(ndarray[int8_t, ndim=2] values,
@@ -3154,7 +3282,6 @@ cdef inline take_2d_axis0_int8_int64_memview(int8_t[:, :] values,
out[i, j] = values[idx, j]
-
@cython.wraparound(False)
@cython.boundscheck(False)
def take_2d_axis0_int8_int64(ndarray[int8_t, ndim=2] values,
@@ -3255,7 +3382,6 @@ cdef inline take_2d_axis0_int8_float64_memview(int8_t[:, :] values,
out[i, j] = values[idx, j]
-
@cython.wraparound(False)
@cython.boundscheck(False)
def take_2d_axis0_int8_float64(ndarray[int8_t, ndim=2] values,
@@ -3356,7 +3482,6 @@ cdef inline take_2d_axis0_int16_int16_memview(int16_t[:, :] values,
out[i, j] = values[idx, j]
-
@cython.wraparound(False)
@cython.boundscheck(False)
def take_2d_axis0_int16_int16(ndarray[int16_t, ndim=2] values,
@@ -3457,7 +3582,6 @@ cdef inline take_2d_axis0_int16_int32_memview(int16_t[:, :] values,
out[i, j] = values[idx, j]
-
@cython.wraparound(False)
@cython.boundscheck(False)
def take_2d_axis0_int16_int32(ndarray[int16_t, ndim=2] values,
@@ -3558,7 +3682,6 @@ cdef inline take_2d_axis0_int16_int64_memview(int16_t[:, :] values,
out[i, j] = values[idx, j]
-
@cython.wraparound(False)
@cython.boundscheck(False)
def take_2d_axis0_int16_int64(ndarray[int16_t, ndim=2] values,
@@ -3659,7 +3782,6 @@ cdef inline take_2d_axis0_int16_float64_memview(int16_t[:, :] values,
out[i, j] = values[idx, j]
-
@cython.wraparound(False)
@cython.boundscheck(False)
def take_2d_axis0_int16_float64(ndarray[int16_t, ndim=2] values,
@@ -3760,7 +3882,6 @@ cdef inline take_2d_axis0_int32_int32_memview(int32_t[:, :] values,
out[i, j] = values[idx, j]
-
@cython.wraparound(False)
@cython.boundscheck(False)
def take_2d_axis0_int32_int32(ndarray[int32_t, ndim=2] values,
@@ -3861,7 +3982,6 @@ cdef inline take_2d_axis0_int32_int64_memview(int32_t[:, :] values,
out[i, j] = values[idx, j]
-
@cython.wraparound(False)
@cython.boundscheck(False)
def take_2d_axis0_int32_int64(ndarray[int32_t, ndim=2] values,
@@ -3962,7 +4082,6 @@ cdef inline take_2d_axis0_int32_float64_memview(int32_t[:, :] values,
out[i, j] = values[idx, j]
-
@cython.wraparound(False)
@cython.boundscheck(False)
def take_2d_axis0_int32_float64(ndarray[int32_t, ndim=2] values,
@@ -4063,7 +4182,6 @@ cdef inline take_2d_axis0_int64_int64_memview(int64_t[:, :] values,
out[i, j] = values[idx, j]
-
@cython.wraparound(False)
@cython.boundscheck(False)
def take_2d_axis0_int64_int64(ndarray[int64_t, ndim=2] values,
@@ -4164,7 +4282,6 @@ cdef inline take_2d_axis0_int64_float64_memview(int64_t[:, :] values,
out[i, j] = values[idx, j]
-
@cython.wraparound(False)
@cython.boundscheck(False)
def take_2d_axis0_int64_float64(ndarray[int64_t, ndim=2] values,
@@ -4265,7 +4382,6 @@ cdef inline take_2d_axis0_float32_float32_memview(float32_t[:, :] values,
out[i, j] = values[idx, j]
-
@cython.wraparound(False)
@cython.boundscheck(False)
def take_2d_axis0_float32_float32(ndarray[float32_t, ndim=2] values,
@@ -4366,7 +4482,6 @@ cdef inline take_2d_axis0_float32_float64_memview(float32_t[:, :] values,
out[i, j] = values[idx, j]
-
@cython.wraparound(False)
@cython.boundscheck(False)
def take_2d_axis0_float32_float64(ndarray[float32_t, ndim=2] values,
@@ -4467,7 +4582,6 @@ cdef inline take_2d_axis0_float64_float64_memview(float64_t[:, :] values,
out[i, j] = values[idx, j]
-
@cython.wraparound(False)
@cython.boundscheck(False)
def take_2d_axis0_float64_float64(ndarray[float64_t, ndim=2] values,
@@ -4568,7 +4682,6 @@ cdef inline take_2d_axis0_object_object_memview(object[:, :] values,
out[i, j] = values[idx, j]
-
@cython.wraparound(False)
@cython.boundscheck(False)
def take_2d_axis0_object_object(ndarray[object, ndim=2] values,
@@ -4686,6 +4799,7 @@ def take_2d_axis1_bool_bool(ndarray[uint8_t, ndim=2] values,
out[i, j] = fv
else:
out[i, j] = values[i, idx]
+
@cython.wraparound(False)
@cython.boundscheck(False)
cdef inline take_2d_axis1_bool_object_memview(uint8_t[:, :] values,
@@ -4748,6 +4862,7 @@ def take_2d_axis1_bool_object(ndarray[uint8_t, ndim=2] values,
out[i, j] = fv
else:
out[i, j] = True if values[i, idx] > 0 else False
+
@cython.wraparound(False)
@cython.boundscheck(False)
cdef inline take_2d_axis1_int8_int8_memview(int8_t[:, :] values,
@@ -4810,6 +4925,7 @@ def take_2d_axis1_int8_int8(ndarray[int8_t, ndim=2] values,
out[i, j] = fv
else:
out[i, j] = values[i, idx]
+
@cython.wraparound(False)
@cython.boundscheck(False)
cdef inline take_2d_axis1_int8_int32_memview(int8_t[:, :] values,
@@ -4872,6 +4988,7 @@ def take_2d_axis1_int8_int32(ndarray[int8_t, ndim=2] values,
out[i, j] = fv
else:
out[i, j] = values[i, idx]
+
@cython.wraparound(False)
@cython.boundscheck(False)
cdef inline take_2d_axis1_int8_int64_memview(int8_t[:, :] values,
@@ -4934,6 +5051,7 @@ def take_2d_axis1_int8_int64(ndarray[int8_t, ndim=2] values,
out[i, j] = fv
else:
out[i, j] = values[i, idx]
+
@cython.wraparound(False)
@cython.boundscheck(False)
cdef inline take_2d_axis1_int8_float64_memview(int8_t[:, :] values,
@@ -4996,6 +5114,7 @@ def take_2d_axis1_int8_float64(ndarray[int8_t, ndim=2] values,
out[i, j] = fv
else:
out[i, j] = values[i, idx]
+
@cython.wraparound(False)
@cython.boundscheck(False)
cdef inline take_2d_axis1_int16_int16_memview(int16_t[:, :] values,
@@ -5058,6 +5177,7 @@ def take_2d_axis1_int16_int16(ndarray[int16_t, ndim=2] values,
out[i, j] = fv
else:
out[i, j] = values[i, idx]
+
@cython.wraparound(False)
@cython.boundscheck(False)
cdef inline take_2d_axis1_int16_int32_memview(int16_t[:, :] values,
@@ -5120,6 +5240,7 @@ def take_2d_axis1_int16_int32(ndarray[int16_t, ndim=2] values,
out[i, j] = fv
else:
out[i, j] = values[i, idx]
+
@cython.wraparound(False)
@cython.boundscheck(False)
cdef inline take_2d_axis1_int16_int64_memview(int16_t[:, :] values,
@@ -5182,6 +5303,7 @@ def take_2d_axis1_int16_int64(ndarray[int16_t, ndim=2] values,
out[i, j] = fv
else:
out[i, j] = values[i, idx]
+
@cython.wraparound(False)
@cython.boundscheck(False)
cdef inline take_2d_axis1_int16_float64_memview(int16_t[:, :] values,
@@ -5244,6 +5366,7 @@ def take_2d_axis1_int16_float64(ndarray[int16_t, ndim=2] values,
out[i, j] = fv
else:
out[i, j] = values[i, idx]
+
@cython.wraparound(False)
@cython.boundscheck(False)
cdef inline take_2d_axis1_int32_int32_memview(int32_t[:, :] values,
@@ -5306,6 +5429,7 @@ def take_2d_axis1_int32_int32(ndarray[int32_t, ndim=2] values,
out[i, j] = fv
else:
out[i, j] = values[i, idx]
+
@cython.wraparound(False)
@cython.boundscheck(False)
cdef inline take_2d_axis1_int32_int64_memview(int32_t[:, :] values,
@@ -5368,6 +5492,7 @@ def take_2d_axis1_int32_int64(ndarray[int32_t, ndim=2] values,
out[i, j] = fv
else:
out[i, j] = values[i, idx]
+
@cython.wraparound(False)
@cython.boundscheck(False)
cdef inline take_2d_axis1_int32_float64_memview(int32_t[:, :] values,
@@ -5430,6 +5555,7 @@ def take_2d_axis1_int32_float64(ndarray[int32_t, ndim=2] values,
out[i, j] = fv
else:
out[i, j] = values[i, idx]
+
@cython.wraparound(False)
@cython.boundscheck(False)
cdef inline take_2d_axis1_int64_int64_memview(int64_t[:, :] values,
@@ -5492,6 +5618,7 @@ def take_2d_axis1_int64_int64(ndarray[int64_t, ndim=2] values,
out[i, j] = fv
else:
out[i, j] = values[i, idx]
+
@cython.wraparound(False)
@cython.boundscheck(False)
cdef inline take_2d_axis1_int64_float64_memview(int64_t[:, :] values,
@@ -5554,6 +5681,7 @@ def take_2d_axis1_int64_float64(ndarray[int64_t, ndim=2] values,
out[i, j] = fv
else:
out[i, j] = values[i, idx]
+
@cython.wraparound(False)
@cython.boundscheck(False)
cdef inline take_2d_axis1_float32_float32_memview(float32_t[:, :] values,
@@ -5616,6 +5744,7 @@ def take_2d_axis1_float32_float32(ndarray[float32_t, ndim=2] values,
out[i, j] = fv
else:
out[i, j] = values[i, idx]
+
@cython.wraparound(False)
@cython.boundscheck(False)
cdef inline take_2d_axis1_float32_float64_memview(float32_t[:, :] values,
@@ -5678,6 +5807,7 @@ def take_2d_axis1_float32_float64(ndarray[float32_t, ndim=2] values,
out[i, j] = fv
else:
out[i, j] = values[i, idx]
+
@cython.wraparound(False)
@cython.boundscheck(False)
cdef inline take_2d_axis1_float64_float64_memview(float64_t[:, :] values,
@@ -5740,6 +5870,7 @@ def take_2d_axis1_float64_float64(ndarray[float64_t, ndim=2] values,
out[i, j] = fv
else:
out[i, j] = values[i, idx]
+
@cython.wraparound(False)
@cython.boundscheck(False)
cdef inline take_2d_axis1_object_object_memview(object[:, :] values,
@@ -5803,6 +5934,7 @@ def take_2d_axis1_object_object(ndarray[object, ndim=2] values,
else:
out[i, j] = values[i, idx]
+
@cython.wraparound(False)
@cython.boundscheck(False)
def take_2d_multi_bool_bool(ndarray[uint8_t, ndim=2] values,
@@ -6379,6 +6511,7 @@ def diff_2d_float64(ndarray[float64_t, ndim=2] arr,
for i in range(sx):
for j in range(start, stop):
out[i, j] = arr[i, j] - arr[i, j - periods]
+
@cython.boundscheck(False)
@cython.wraparound(False)
def diff_2d_float32(ndarray[float32_t, ndim=2] arr,
@@ -6422,6 +6555,7 @@ def diff_2d_float32(ndarray[float32_t, ndim=2] arr,
for i in range(sx):
for j in range(start, stop):
out[i, j] = arr[i, j] - arr[i, j - periods]
+
@cython.boundscheck(False)
@cython.wraparound(False)
def diff_2d_int8(ndarray[int8_t, ndim=2] arr,
@@ -6465,6 +6599,7 @@ def diff_2d_int8(ndarray[int8_t, ndim=2] arr,
for i in range(sx):
for j in range(start, stop):
out[i, j] = arr[i, j] - arr[i, j - periods]
+
@cython.boundscheck(False)
@cython.wraparound(False)
def diff_2d_int16(ndarray[int16_t, ndim=2] arr,
@@ -6508,6 +6643,7 @@ def diff_2d_int16(ndarray[int16_t, ndim=2] arr,
for i in range(sx):
for j in range(start, stop):
out[i, j] = arr[i, j] - arr[i, j - periods]
+
@cython.boundscheck(False)
@cython.wraparound(False)
def diff_2d_int32(ndarray[int32_t, ndim=2] arr,
@@ -6551,6 +6687,7 @@ def diff_2d_int32(ndarray[int32_t, ndim=2] arr,
for i in range(sx):
for j in range(start, stop):
out[i, j] = arr[i, j] - arr[i, j - periods]
+
@cython.boundscheck(False)
@cython.wraparound(False)
def diff_2d_int64(ndarray[int64_t, ndim=2] arr,
@@ -6595,8 +6732,9 @@ def diff_2d_int64(ndarray[int64_t, ndim=2] arr,
for j in range(start, stop):
out[i, j] = arr[i, j] - arr[i, j - periods]
-@cython.boundscheck(False)
+
@cython.wraparound(False)
+@cython.boundscheck(False)
def group_add_float64(ndarray[float64_t, ndim=2] out,
ndarray[int64_t] counts,
ndarray[float64_t, ndim=2] values,
@@ -6605,7 +6743,7 @@ def group_add_float64(ndarray[float64_t, ndim=2] out,
Only aggregates on axis=0
'''
cdef:
- Py_ssize_t i, j, N, K, lab
+ Py_ssize_t i, j, N, K, lab, ncounts = len(counts)
float64_t val, count
ndarray[float64_t, ndim=2] sumx, nobs
@@ -6617,42 +6755,49 @@ def group_add_float64(ndarray[float64_t, ndim=2] out,
N, K = (<object> values).shape
- if K > 1:
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
- counts[lab] += 1
- for j in range(K):
- val = values[i, j]
+ with nogil:
+
+ if K > 1:
+
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
+
+ counts[lab] += 1
+ for j in range(K):
+ val = values[i, j]
+
+ # not nan
+ if val == val:
+ nobs[lab, j] += 1
+ sumx[lab, j] += val
+
+ else:
+
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
+
+ counts[lab] += 1
+ val = values[i, 0]
# not nan
if val == val:
- nobs[lab, j] += 1
- sumx[lab, j] += val
- else:
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
+ nobs[lab, 0] += 1
+ sumx[lab, 0] += val
- counts[lab] += 1
- val = values[i, 0]
-
- # not nan
- if val == val:
- nobs[lab, 0] += 1
- sumx[lab, 0] += val
+ for i in range(ncounts):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = NAN
+ else:
+ out[i, j] = sumx[i, j]
- for i in range(len(counts)):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = nan
- else:
- out[i, j] = sumx[i, j]
-@cython.boundscheck(False)
@cython.wraparound(False)
+@cython.boundscheck(False)
def group_add_float32(ndarray[float32_t, ndim=2] out,
ndarray[int64_t] counts,
ndarray[float32_t, ndim=2] values,
@@ -6661,7 +6806,7 @@ def group_add_float32(ndarray[float32_t, ndim=2] out,
Only aggregates on axis=0
'''
cdef:
- Py_ssize_t i, j, N, K, lab
+ Py_ssize_t i, j, N, K, lab, ncounts = len(counts)
float32_t val, count
ndarray[float32_t, ndim=2] sumx, nobs
@@ -6673,43 +6818,50 @@ def group_add_float32(ndarray[float32_t, ndim=2] out,
N, K = (<object> values).shape
- if K > 1:
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
- counts[lab] += 1
- for j in range(K):
- val = values[i, j]
+ with nogil:
+
+ if K > 1:
+
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
+
+ counts[lab] += 1
+ for j in range(K):
+ val = values[i, j]
+
+ # not nan
+ if val == val:
+ nobs[lab, j] += 1
+ sumx[lab, j] += val
+
+ else:
+
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
+
+ counts[lab] += 1
+ val = values[i, 0]
# not nan
if val == val:
- nobs[lab, j] += 1
- sumx[lab, j] += val
- else:
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
-
- counts[lab] += 1
- val = values[i, 0]
+ nobs[lab, 0] += 1
+ sumx[lab, 0] += val
- # not nan
- if val == val:
- nobs[lab, 0] += 1
- sumx[lab, 0] += val
+ for i in range(ncounts):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = NAN
+ else:
+ out[i, j] = sumx[i, j]
- for i in range(len(counts)):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = nan
- else:
- out[i, j] = sumx[i, j]
-@cython.boundscheck(False)
@cython.wraparound(False)
+@cython.boundscheck(False)
def group_add_bin_float64(ndarray[float64_t, ndim=2] out,
ndarray[int64_t] counts,
ndarray[float64_t, ndim=2] values,
@@ -6733,41 +6885,45 @@ def group_add_bin_float64(ndarray[float64_t, ndim=2] out,
ngroups = len(bins) + 1
N, K = (<object> values).shape
- b = 0
- if K > 1:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ with nogil:
- counts[b] += 1
- for j in range(K):
- val = values[i, j]
+ b = 0
+ if K > 1:
+
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
+
+ counts[b] += 1
+ for j in range(K):
+ val = values[i, j]
+
+ # not nan
+ if val == val:
+ nobs[b, j] += 1
+ sumx[b, j] += val
+ else:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
+
+ counts[b] += 1
+ val = values[i, 0]
# not nan
if val == val:
- nobs[b, j] += 1
- sumx[b, j] += val
- else:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ nobs[b, 0] += 1
+ sumx[b, 0] += val
- counts[b] += 1
- val = values[i, 0]
-
- # not nan
- if val == val:
- nobs[b, 0] += 1
- sumx[b, 0] += val
+ for i in range(ngroups):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = NAN
+ else:
+ out[i, j] = sumx[i, j]
- for i in range(ngroups):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = nan
- else:
- out[i, j] = sumx[i, j]
-@cython.boundscheck(False)
@cython.wraparound(False)
+@cython.boundscheck(False)
def group_add_bin_float32(ndarray[float32_t, ndim=2] out,
ndarray[int64_t] counts,
ndarray[float32_t, ndim=2] values,
@@ -6791,42 +6947,46 @@ def group_add_bin_float32(ndarray[float32_t, ndim=2] out,
ngroups = len(bins) + 1
N, K = (<object> values).shape
- b = 0
- if K > 1:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ with nogil:
- counts[b] += 1
- for j in range(K):
- val = values[i, j]
+ b = 0
+ if K > 1:
+
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
+
+ counts[b] += 1
+ for j in range(K):
+ val = values[i, j]
+
+ # not nan
+ if val == val:
+ nobs[b, j] += 1
+ sumx[b, j] += val
+ else:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
+
+ counts[b] += 1
+ val = values[i, 0]
# not nan
if val == val:
- nobs[b, j] += 1
- sumx[b, j] += val
- else:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ nobs[b, 0] += 1
+ sumx[b, 0] += val
- counts[b] += 1
- val = values[i, 0]
-
- # not nan
- if val == val:
- nobs[b, 0] += 1
- sumx[b, 0] += val
+ for i in range(ngroups):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = NAN
+ else:
+ out[i, j] = sumx[i, j]
- for i in range(ngroups):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = nan
- else:
- out[i, j] = sumx[i, j]
-@cython.boundscheck(False)
@cython.wraparound(False)
+@cython.boundscheck(False)
def group_prod_float64(ndarray[float64_t, ndim=2] out,
ndarray[int64_t] counts,
ndarray[float64_t, ndim=2] values,
@@ -6835,7 +6995,7 @@ def group_prod_float64(ndarray[float64_t, ndim=2] out,
Only aggregates on axis=0
'''
cdef:
- Py_ssize_t i, j, N, K, lab
+ Py_ssize_t i, j, N, K, lab, ncounts = len(counts)
float64_t val, count
ndarray[float64_t, ndim=2] prodx, nobs
@@ -6847,42 +7007,44 @@ def group_prod_float64(ndarray[float64_t, ndim=2] out,
N, K = (<object> values).shape
- if K > 1:
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
+ with nogil:
+ if K > 1:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
- counts[lab] += 1
- for j in range(K):
- val = values[i, j]
+ counts[lab] += 1
+ for j in range(K):
+ val = values[i, j]
+
+ # not nan
+ if val == val:
+ nobs[lab, j] += 1
+ prodx[lab, j] *= val
+ else:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
+
+ counts[lab] += 1
+ val = values[i, 0]
# not nan
if val == val:
- nobs[lab, j] += 1
- prodx[lab, j] *= val
- else:
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
-
- counts[lab] += 1
- val = values[i, 0]
+ nobs[lab, 0] += 1
+ prodx[lab, 0] *= val
- # not nan
- if val == val:
- nobs[lab, 0] += 1
- prodx[lab, 0] *= val
+ for i in range(ncounts):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = NAN
+ else:
+ out[i, j] = prodx[i, j]
- for i in range(len(counts)):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = nan
- else:
- out[i, j] = prodx[i, j]
-@cython.boundscheck(False)
@cython.wraparound(False)
+@cython.boundscheck(False)
def group_prod_float32(ndarray[float32_t, ndim=2] out,
ndarray[int64_t] counts,
ndarray[float32_t, ndim=2] values,
@@ -6891,7 +7053,7 @@ def group_prod_float32(ndarray[float32_t, ndim=2] out,
Only aggregates on axis=0
'''
cdef:
- Py_ssize_t i, j, N, K, lab
+ Py_ssize_t i, j, N, K, lab, ncounts = len(counts)
float32_t val, count
ndarray[float32_t, ndim=2] prodx, nobs
@@ -6903,43 +7065,45 @@ def group_prod_float32(ndarray[float32_t, ndim=2] out,
N, K = (<object> values).shape
- if K > 1:
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
+ with nogil:
+ if K > 1:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
- counts[lab] += 1
- for j in range(K):
- val = values[i, j]
+ counts[lab] += 1
+ for j in range(K):
+ val = values[i, j]
+
+ # not nan
+ if val == val:
+ nobs[lab, j] += 1
+ prodx[lab, j] *= val
+ else:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
+
+ counts[lab] += 1
+ val = values[i, 0]
# not nan
if val == val:
- nobs[lab, j] += 1
- prodx[lab, j] *= val
- else:
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
-
- counts[lab] += 1
- val = values[i, 0]
+ nobs[lab, 0] += 1
+ prodx[lab, 0] *= val
- # not nan
- if val == val:
- nobs[lab, 0] += 1
- prodx[lab, 0] *= val
+ for i in range(ncounts):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = NAN
+ else:
+ out[i, j] = prodx[i, j]
- for i in range(len(counts)):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = nan
- else:
- out[i, j] = prodx[i, j]
-@cython.boundscheck(False)
@cython.wraparound(False)
+@cython.boundscheck(False)
def group_prod_bin_float64(ndarray[float64_t, ndim=2] out,
ndarray[int64_t] counts,
ndarray[float64_t, ndim=2] values,
@@ -6963,41 +7127,44 @@ def group_prod_bin_float64(ndarray[float64_t, ndim=2] out,
ngroups = len(bins) + 1
N, K = (<object> values).shape
- b = 0
- if K > 1:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ with nogil:
- counts[b] += 1
- for j in range(K):
- val = values[i, j]
+ b = 0
+ if K > 1:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
+
+ counts[b] += 1
+ for j in range(K):
+ val = values[i, j]
+
+ # not nan
+ if val == val:
+ nobs[b, j] += 1
+ prodx[b, j] *= val
+ else:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
+
+ counts[b] += 1
+ val = values[i, 0]
# not nan
if val == val:
- nobs[b, j] += 1
- prodx[b, j] *= val
- else:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
-
- counts[b] += 1
- val = values[i, 0]
+ nobs[b, 0] += 1
+ prodx[b, 0] *= val
- # not nan
- if val == val:
- nobs[b, 0] += 1
- prodx[b, 0] *= val
+ for i in range(ngroups):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = NAN
+ else:
+ out[i, j] = prodx[i, j]
- for i in range(ngroups):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = nan
- else:
- out[i, j] = prodx[i, j]
-@cython.boundscheck(False)
@cython.wraparound(False)
+@cython.boundscheck(False)
def group_prod_bin_float32(ndarray[float32_t, ndim=2] out,
ndarray[int64_t] counts,
ndarray[float32_t, ndim=2] values,
@@ -7021,39 +7188,42 @@ def group_prod_bin_float32(ndarray[float32_t, ndim=2] out,
ngroups = len(bins) + 1
N, K = (<object> values).shape
- b = 0
- if K > 1:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ with nogil:
- counts[b] += 1
- for j in range(K):
- val = values[i, j]
+ b = 0
+ if K > 1:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
+
+ counts[b] += 1
+ for j in range(K):
+ val = values[i, j]
+
+ # not nan
+ if val == val:
+ nobs[b, j] += 1
+ prodx[b, j] *= val
+ else:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
+
+ counts[b] += 1
+ val = values[i, 0]
# not nan
if val == val:
- nobs[b, j] += 1
- prodx[b, j] *= val
- else:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
-
- counts[b] += 1
- val = values[i, 0]
+ nobs[b, 0] += 1
+ prodx[b, 0] *= val
- # not nan
- if val == val:
- nobs[b, 0] += 1
- prodx[b, 0] *= val
+ for i in range(ngroups):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = NAN
+ else:
+ out[i, j] = prodx[i, j]
- for i in range(ngroups):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = nan
- else:
- out[i, j] = prodx[i, j]
@cython.wraparound(False)
@cython.boundscheck(False)
@@ -7062,7 +7232,7 @@ def group_var_float64(ndarray[float64_t, ndim=2] out,
ndarray[float64_t, ndim=2] values,
ndarray[int64_t] labels):
cdef:
- Py_ssize_t i, j, N, K, lab
+ Py_ssize_t i, j, N, K, lab, ncounts = len(counts)
float64_t val, ct
ndarray[float64_t, ndim=2] nobs, sumx, sumxx
@@ -7075,47 +7245,50 @@ def group_var_float64(ndarray[float64_t, ndim=2] out,
N, K = (<object> values).shape
- if K > 1:
- for i in range(N):
+ with nogil:
+ if K > 1:
+ for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
+ lab = labels[i]
+ if lab < 0:
+ continue
- counts[lab] += 1
+ counts[lab] += 1
- for j in range(K):
- val = values[i, j]
+ for j in range(K):
+ val = values[i, j]
+
+ # not nan
+ if val == val:
+ nobs[lab, j] += 1
+ sumx[lab, j] += val
+ sumxx[lab, j] += val * val
+ else:
+ for i in range(N):
+
+ lab = labels[i]
+ if lab < 0:
+ continue
+
+ counts[lab] += 1
+ val = values[i, 0]
# not nan
if val == val:
- nobs[lab, j] += 1
- sumx[lab, j] += val
- sumxx[lab, j] += val * val
- else:
- for i in range(N):
-
- lab = labels[i]
- if lab < 0:
- continue
+ nobs[lab, 0] += 1
+ sumx[lab, 0] += val
+ sumxx[lab, 0] += val * val
- counts[lab] += 1
- val = values[i, 0]
- # not nan
- if val == val:
- nobs[lab, 0] += 1
- sumx[lab, 0] += val
- sumxx[lab, 0] += val * val
+ for i in range(ncounts):
+ for j in range(K):
+ ct = nobs[i, j]
+ if ct < 2:
+ out[i, j] = NAN
+ else:
+ out[i, j] = ((ct * sumxx[i, j] - sumx[i, j] * sumx[i, j]) /
+ (ct * ct - ct))
- for i in range(len(counts)):
- for j in range(K):
- ct = nobs[i, j]
- if ct < 2:
- out[i, j] = nan
- else:
- out[i, j] = ((ct * sumxx[i, j] - sumx[i, j] * sumx[i, j]) /
- (ct * ct - ct))
@cython.wraparound(False)
@cython.boundscheck(False)
def group_var_float32(ndarray[float32_t, ndim=2] out,
@@ -7123,7 +7296,7 @@ def group_var_float32(ndarray[float32_t, ndim=2] out,
ndarray[float32_t, ndim=2] values,
ndarray[int64_t] labels):
cdef:
- Py_ssize_t i, j, N, K, lab
+ Py_ssize_t i, j, N, K, lab, ncounts = len(counts)
float32_t val, ct
ndarray[float32_t, ndim=2] nobs, sumx, sumxx
@@ -7136,47 +7309,50 @@ def group_var_float32(ndarray[float32_t, ndim=2] out,
N, K = (<object> values).shape
- if K > 1:
- for i in range(N):
+ with nogil:
+ if K > 1:
+ for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
+ lab = labels[i]
+ if lab < 0:
+ continue
- counts[lab] += 1
+ counts[lab] += 1
- for j in range(K):
- val = values[i, j]
+ for j in range(K):
+ val = values[i, j]
+
+ # not nan
+ if val == val:
+ nobs[lab, j] += 1
+ sumx[lab, j] += val
+ sumxx[lab, j] += val * val
+ else:
+ for i in range(N):
+
+ lab = labels[i]
+ if lab < 0:
+ continue
+
+ counts[lab] += 1
+ val = values[i, 0]
# not nan
if val == val:
- nobs[lab, j] += 1
- sumx[lab, j] += val
- sumxx[lab, j] += val * val
- else:
- for i in range(N):
-
- lab = labels[i]
- if lab < 0:
- continue
+ nobs[lab, 0] += 1
+ sumx[lab, 0] += val
+ sumxx[lab, 0] += val * val
- counts[lab] += 1
- val = values[i, 0]
- # not nan
- if val == val:
- nobs[lab, 0] += 1
- sumx[lab, 0] += val
- sumxx[lab, 0] += val * val
+ for i in range(ncounts):
+ for j in range(K):
+ ct = nobs[i, j]
+ if ct < 2:
+ out[i, j] = NAN
+ else:
+ out[i, j] = ((ct * sumxx[i, j] - sumx[i, j] * sumx[i, j]) /
+ (ct * ct - ct))
- for i in range(len(counts)):
- for j in range(K):
- ct = nobs[i, j]
- if ct < 2:
- out[i, j] = nan
- else:
- out[i, j] = ((ct * sumxx[i, j] - sumx[i, j] * sumx[i, j]) /
- (ct * ct - ct))
@cython.wraparound(False)
@cython.boundscheck(False)
@@ -7203,44 +7379,46 @@ def group_var_bin_float64(ndarray[float64_t, ndim=2] out,
N, K = (<object> values).shape
- b = 0
- if K > 1:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ with nogil:
+ b = 0
+ if K > 1:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
- counts[b] += 1
+ counts[b] += 1
- for j in range(K):
- val = values[i, j]
+ for j in range(K):
+ val = values[i, j]
+
+ # not nan
+ if val == val:
+ nobs[b, j] += 1
+ sumx[b, j] += val
+ sumxx[b, j] += val * val
+ else:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
+
+ counts[b] += 1
+ val = values[i, 0]
# not nan
if val == val:
- nobs[b, j] += 1
- sumx[b, j] += val
- sumxx[b, j] += val * val
- else:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ nobs[b, 0] += 1
+ sumx[b, 0] += val
+ sumxx[b, 0] += val * val
- counts[b] += 1
- val = values[i, 0]
-
- # not nan
- if val == val:
- nobs[b, 0] += 1
- sumx[b, 0] += val
- sumxx[b, 0] += val * val
+ for i in range(ngroups):
+ for j in range(K):
+ ct = nobs[i, j]
+ if ct < 2:
+ out[i, j] = NAN
+ else:
+ out[i, j] = ((ct * sumxx[i, j] - sumx[i, j] * sumx[i, j]) /
+ (ct * ct - ct))
- for i in range(ngroups):
- for j in range(K):
- ct = nobs[i, j]
- if ct < 2:
- out[i, j] = nan
- else:
- out[i, j] = ((ct * sumxx[i, j] - sumx[i, j] * sumx[i, j]) /
- (ct * ct - ct))
@cython.wraparound(False)
@cython.boundscheck(False)
def group_var_bin_float32(ndarray[float32_t, ndim=2] out,
@@ -7266,44 +7444,46 @@ def group_var_bin_float32(ndarray[float32_t, ndim=2] out,
N, K = (<object> values).shape
- b = 0
- if K > 1:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ with nogil:
+ b = 0
+ if K > 1:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
- counts[b] += 1
+ counts[b] += 1
- for j in range(K):
- val = values[i, j]
+ for j in range(K):
+ val = values[i, j]
+
+ # not nan
+ if val == val:
+ nobs[b, j] += 1
+ sumx[b, j] += val
+ sumxx[b, j] += val * val
+ else:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
+
+ counts[b] += 1
+ val = values[i, 0]
# not nan
if val == val:
- nobs[b, j] += 1
- sumx[b, j] += val
- sumxx[b, j] += val * val
- else:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ nobs[b, 0] += 1
+ sumx[b, 0] += val
+ sumxx[b, 0] += val * val
- counts[b] += 1
- val = values[i, 0]
-
- # not nan
- if val == val:
- nobs[b, 0] += 1
- sumx[b, 0] += val
- sumxx[b, 0] += val * val
+ for i in range(ngroups):
+ for j in range(K):
+ ct = nobs[i, j]
+ if ct < 2:
+ out[i, j] = NAN
+ else:
+ out[i, j] = ((ct * sumxx[i, j] - sumx[i, j] * sumx[i, j]) /
+ (ct * ct - ct))
- for i in range(ngroups):
- for j in range(K):
- ct = nobs[i, j]
- if ct < 2:
- out[i, j] = nan
- else:
- out[i, j] = ((ct * sumxx[i, j] - sumx[i, j] * sumx[i, j]) /
- (ct * ct - ct))
@cython.wraparound(False)
@cython.boundscheck(False)
@@ -7312,7 +7492,7 @@ def group_mean_float64(ndarray[float64_t, ndim=2] out,
ndarray[float64_t, ndim=2] values,
ndarray[int64_t] labels):
cdef:
- Py_ssize_t i, j, N, K, lab
+ Py_ssize_t i, j, N, K, lab, ncounts = len(counts)
float64_t val, count
ndarray[float64_t, ndim=2] sumx, nobs
@@ -7324,39 +7504,41 @@ def group_mean_float64(ndarray[float64_t, ndim=2] out,
N, K = (<object> values).shape
- if K > 1:
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
+ with nogil:
+ if K > 1:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
- counts[lab] += 1
- for j in range(K):
- val = values[i, j]
+ counts[lab] += 1
+ for j in range(K):
+ val = values[i, j]
+ # not nan
+ if val == val:
+ nobs[lab, j] += 1
+ sumx[lab, j] += val
+ else:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
+
+ counts[lab] += 1
+ val = values[i, 0]
# not nan
if val == val:
- nobs[lab, j] += 1
- sumx[lab, j] += val
- else:
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
+ nobs[lab, 0] += 1
+ sumx[lab, 0] += val
- counts[lab] += 1
- val = values[i, 0]
- # not nan
- if val == val:
- nobs[lab, 0] += 1
- sumx[lab, 0] += val
+ for i in range(ncounts):
+ for j in range(K):
+ count = nobs[i, j]
+ if nobs[i, j] == 0:
+ out[i, j] = NAN
+ else:
+ out[i, j] = sumx[i, j] / count
- for i in range(len(counts)):
- for j in range(K):
- count = nobs[i, j]
- if nobs[i, j] == 0:
- out[i, j] = nan
- else:
- out[i, j] = sumx[i, j] / count
@cython.wraparound(False)
@cython.boundscheck(False)
def group_mean_float32(ndarray[float32_t, ndim=2] out,
@@ -7364,7 +7546,7 @@ def group_mean_float32(ndarray[float32_t, ndim=2] out,
ndarray[float32_t, ndim=2] values,
ndarray[int64_t] labels):
cdef:
- Py_ssize_t i, j, N, K, lab
+ Py_ssize_t i, j, N, K, lab, ncounts = len(counts)
float32_t val, count
ndarray[float32_t, ndim=2] sumx, nobs
@@ -7376,41 +7558,44 @@ def group_mean_float32(ndarray[float32_t, ndim=2] out,
N, K = (<object> values).shape
- if K > 1:
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
+ with nogil:
+ if K > 1:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
- counts[lab] += 1
- for j in range(K):
- val = values[i, j]
+ counts[lab] += 1
+ for j in range(K):
+ val = values[i, j]
+ # not nan
+ if val == val:
+ nobs[lab, j] += 1
+ sumx[lab, j] += val
+ else:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
+
+ counts[lab] += 1
+ val = values[i, 0]
# not nan
if val == val:
- nobs[lab, j] += 1
- sumx[lab, j] += val
- else:
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
+ nobs[lab, 0] += 1
+ sumx[lab, 0] += val
- counts[lab] += 1
- val = values[i, 0]
- # not nan
- if val == val:
- nobs[lab, 0] += 1
- sumx[lab, 0] += val
+ for i in range(ncounts):
+ for j in range(K):
+ count = nobs[i, j]
+ if nobs[i, j] == 0:
+ out[i, j] = NAN
+ else:
+ out[i, j] = sumx[i, j] / count
- for i in range(len(counts)):
- for j in range(K):
- count = nobs[i, j]
- if nobs[i, j] == 0:
- out[i, j] = nan
- else:
- out[i, j] = sumx[i, j] / count
+@cython.boundscheck(False)
def group_mean_bin_float64(ndarray[float64_t, ndim=2] out,
ndarray[int64_t] counts,
ndarray[float64_t, ndim=2] values,
@@ -7431,41 +7616,44 @@ def group_mean_bin_float64(ndarray[float64_t, ndim=2] out,
else:
ngroups = len(bins) + 1
- b = 0
- if K > 1:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ with nogil:
+ b = 0
+ if K > 1:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
- counts[b] += 1
- for j in range(K):
- val = values[i, j]
+ counts[b] += 1
+ for j in range(K):
+ val = values[i, j]
+
+ # not nan
+ if val == val:
+ nobs[b, j] += 1
+ sumx[b, j] += val
+ else:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
+
+ counts[b] += 1
+ val = values[i, 0]
# not nan
if val == val:
- nobs[b, j] += 1
- sumx[b, j] += val
- else:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ nobs[b, 0] += 1
+ sumx[b, 0] += val
- counts[b] += 1
- val = values[i, 0]
+ for i in range(ngroups):
+ for j in range(K):
+ count = nobs[i, j]
+ if count == 0:
+ out[i, j] = NAN
+ else:
+ out[i, j] = sumx[i, j] / count
- # not nan
- if val == val:
- nobs[b, 0] += 1
- sumx[b, 0] += val
-
- for i in range(ngroups):
- for j in range(K):
- count = nobs[i, j]
- if count == 0:
- out[i, j] = nan
- else:
- out[i, j] = sumx[i, j] / count
+@cython.boundscheck(False)
def group_mean_bin_float32(ndarray[float32_t, ndim=2] out,
ndarray[int64_t] counts,
ndarray[float32_t, ndim=2] values,
@@ -7486,40 +7674,42 @@ def group_mean_bin_float32(ndarray[float32_t, ndim=2] out,
else:
ngroups = len(bins) + 1
- b = 0
- if K > 1:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ with nogil:
+ b = 0
+ if K > 1:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
- counts[b] += 1
- for j in range(K):
- val = values[i, j]
+ counts[b] += 1
+ for j in range(K):
+ val = values[i, j]
+
+ # not nan
+ if val == val:
+ nobs[b, j] += 1
+ sumx[b, j] += val
+ else:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
+
+ counts[b] += 1
+ val = values[i, 0]
# not nan
if val == val:
- nobs[b, j] += 1
- sumx[b, j] += val
- else:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
-
- counts[b] += 1
- val = values[i, 0]
+ nobs[b, 0] += 1
+ sumx[b, 0] += val
- # not nan
- if val == val:
- nobs[b, 0] += 1
- sumx[b, 0] += val
+ for i in range(ngroups):
+ for j in range(K):
+ count = nobs[i, j]
+ if count == 0:
+ out[i, j] = NAN
+ else:
+ out[i, j] = sumx[i, j] / count
- for i in range(ngroups):
- for j in range(K):
- count = nobs[i, j]
- if count == 0:
- out[i, j] = nan
- else:
- out[i, j] = sumx[i, j] / count
@cython.wraparound(False)
@cython.boundscheck(False)
@@ -7533,7 +7723,7 @@ def group_ohlc_float64(ndarray[float64_t, ndim=2] out,
cdef:
Py_ssize_t i, j, N, K, ngroups, b
float64_t val, count
- float64_t vopen, vhigh, vlow, vclose, NA
+ float64_t vopen, vhigh, vlow, vclose
bint got_first = 0
if len(bins) == 0:
@@ -7548,55 +7738,56 @@ def group_ohlc_float64(ndarray[float64_t, ndim=2] out,
if out.shape[1] != 4:
raise ValueError('Output array must have 4 columns')
- NA = np.nan
-
b = 0
if K > 1:
raise NotImplementedError("Argument 'values' must have only "
"one dimension")
else:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- if not got_first:
- out[b, 0] = NA
- out[b, 1] = NA
- out[b, 2] = NA
- out[b, 3] = NA
- else:
- out[b, 0] = vopen
- out[b, 1] = vhigh
- out[b, 2] = vlow
- out[b, 3] = vclose
- b += 1
- got_first = 0
- counts[b] += 1
- val = values[i, 0]
+ with nogil:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ if not got_first:
+ out[b, 0] = NAN
+ out[b, 1] = NAN
+ out[b, 2] = NAN
+ out[b, 3] = NAN
+ else:
+ out[b, 0] = vopen
+ out[b, 1] = vhigh
+ out[b, 2] = vlow
+ out[b, 3] = vclose
+ b += 1
+ got_first = 0
- # not nan
- if val == val:
- if not got_first:
- got_first = 1
- vopen = val
- vlow = val
- vhigh = val
- else:
- if val < vlow:
+ counts[b] += 1
+ val = values[i, 0]
+
+ # not nan
+ if val == val:
+ if not got_first:
+ got_first = 1
+ vopen = val
vlow = val
- if val > vhigh:
vhigh = val
- vclose = val
+ else:
+ if val < vlow:
+ vlow = val
+ if val > vhigh:
+ vhigh = val
+ vclose = val
+
+ if not got_first:
+ out[b, 0] = NAN
+ out[b, 1] = NAN
+ out[b, 2] = NAN
+ out[b, 3] = NAN
+ else:
+ out[b, 0] = vopen
+ out[b, 1] = vhigh
+ out[b, 2] = vlow
+ out[b, 3] = vclose
- if not got_first:
- out[b, 0] = NA
- out[b, 1] = NA
- out[b, 2] = NA
- out[b, 3] = NA
- else:
- out[b, 0] = vopen
- out[b, 1] = vhigh
- out[b, 2] = vlow
- out[b, 3] = vclose
@cython.wraparound(False)
@cython.boundscheck(False)
def group_ohlc_float32(ndarray[float32_t, ndim=2] out,
@@ -7609,7 +7800,7 @@ def group_ohlc_float32(ndarray[float32_t, ndim=2] out,
cdef:
Py_ssize_t i, j, N, K, ngroups, b
float32_t val, count
- float32_t vopen, vhigh, vlow, vclose, NA
+ float32_t vopen, vhigh, vlow, vclose
bint got_first = 0
if len(bins) == 0:
@@ -7624,58 +7815,59 @@ def group_ohlc_float32(ndarray[float32_t, ndim=2] out,
if out.shape[1] != 4:
raise ValueError('Output array must have 4 columns')
- NA = np.nan
-
b = 0
if K > 1:
raise NotImplementedError("Argument 'values' must have only "
"one dimension")
else:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- if not got_first:
- out[b, 0] = NA
- out[b, 1] = NA
- out[b, 2] = NA
- out[b, 3] = NA
- else:
- out[b, 0] = vopen
- out[b, 1] = vhigh
- out[b, 2] = vlow
- out[b, 3] = vclose
- b += 1
- got_first = 0
- counts[b] += 1
- val = values[i, 0]
+ with nogil:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ if not got_first:
+ out[b, 0] = NAN
+ out[b, 1] = NAN
+ out[b, 2] = NAN
+ out[b, 3] = NAN
+ else:
+ out[b, 0] = vopen
+ out[b, 1] = vhigh
+ out[b, 2] = vlow
+ out[b, 3] = vclose
+ b += 1
+ got_first = 0
- # not nan
- if val == val:
- if not got_first:
- got_first = 1
- vopen = val
- vlow = val
- vhigh = val
- else:
- if val < vlow:
+ counts[b] += 1
+ val = values[i, 0]
+
+ # not nan
+ if val == val:
+ if not got_first:
+ got_first = 1
+ vopen = val
vlow = val
- if val > vhigh:
vhigh = val
- vclose = val
+ else:
+ if val < vlow:
+ vlow = val
+ if val > vhigh:
+ vhigh = val
+ vclose = val
+
+ if not got_first:
+ out[b, 0] = NAN
+ out[b, 1] = NAN
+ out[b, 2] = NAN
+ out[b, 3] = NAN
+ else:
+ out[b, 0] = vopen
+ out[b, 1] = vhigh
+ out[b, 2] = vlow
+ out[b, 3] = vclose
- if not got_first:
- out[b, 0] = NA
- out[b, 1] = NA
- out[b, 2] = NA
- out[b, 3] = NA
- else:
- out[b, 0] = vopen
- out[b, 1] = vhigh
- out[b, 2] = vlow
- out[b, 3] = vclose
@cython.wraparound(False)
-@cython.wraparound(False)
+@cython.boundscheck(False)
def group_last_float64(ndarray[float64_t, ndim=2] out,
ndarray[int64_t] counts,
ndarray[float64_t, ndim=2] values,
@@ -7684,7 +7876,7 @@ def group_last_float64(ndarray[float64_t, ndim=2] out,
Only aggregates on axis=0
'''
cdef:
- Py_ssize_t i, j, N, K, lab
+ Py_ssize_t i, j, N, K, lab, ncounts = len(counts)
float64_t val, count
ndarray[float64_t, ndim=2] resx
ndarray[int64_t, ndim=2] nobs
@@ -7697,28 +7889,30 @@ def group_last_float64(ndarray[float64_t, ndim=2] out,
N, K = (<object> values).shape
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
+ with nogil:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
- counts[lab] += 1
- for j in range(K):
- val = values[i, j]
+ counts[lab] += 1
+ for j in range(K):
+ val = values[i, j]
- # not nan
- if val == val:
- nobs[lab, j] += 1
- resx[lab, j] = val
+ # not nan
+ if val == val:
+ nobs[lab, j] += 1
+ resx[lab, j] = val
+
+ for i in range(ncounts):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = NAN
+ else:
+ out[i, j] = resx[i, j]
- for i in range(len(counts)):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = nan
- else:
- out[i, j] = resx[i, j]
-@cython.wraparound(False)
@cython.wraparound(False)
+@cython.boundscheck(False)
def group_last_float32(ndarray[float32_t, ndim=2] out,
ndarray[int64_t] counts,
ndarray[float32_t, ndim=2] values,
@@ -7727,7 +7921,7 @@ def group_last_float32(ndarray[float32_t, ndim=2] out,
Only aggregates on axis=0
'''
cdef:
- Py_ssize_t i, j, N, K, lab
+ Py_ssize_t i, j, N, K, lab, ncounts = len(counts)
float32_t val, count
ndarray[float32_t, ndim=2] resx
ndarray[int64_t, ndim=2] nobs
@@ -7740,28 +7934,30 @@ def group_last_float32(ndarray[float32_t, ndim=2] out,
N, K = (<object> values).shape
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
+ with nogil:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
- counts[lab] += 1
- for j in range(K):
- val = values[i, j]
+ counts[lab] += 1
+ for j in range(K):
+ val = values[i, j]
- # not nan
- if val == val:
- nobs[lab, j] += 1
- resx[lab, j] = val
+ # not nan
+ if val == val:
+ nobs[lab, j] += 1
+ resx[lab, j] = val
+
+ for i in range(ncounts):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = NAN
+ else:
+ out[i, j] = resx[i, j]
- for i in range(len(counts)):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = nan
- else:
- out[i, j] = resx[i, j]
-@cython.wraparound(False)
@cython.wraparound(False)
+@cython.boundscheck(False)
def group_last_int64(ndarray[int64_t, ndim=2] out,
ndarray[int64_t] counts,
ndarray[int64_t, ndim=2] values,
@@ -7770,7 +7966,7 @@ def group_last_int64(ndarray[int64_t, ndim=2] out,
Only aggregates on axis=0
'''
cdef:
- Py_ssize_t i, j, N, K, lab
+ Py_ssize_t i, j, N, K, lab, ncounts = len(counts)
int64_t val, count
ndarray[int64_t, ndim=2] resx
ndarray[int64_t, ndim=2] nobs
@@ -7783,29 +7979,31 @@ def group_last_int64(ndarray[int64_t, ndim=2] out,
N, K = (<object> values).shape
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
+ with nogil:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
- counts[lab] += 1
- for j in range(K):
- val = values[i, j]
+ counts[lab] += 1
+ for j in range(K):
+ val = values[i, j]
- # not nan
- if val == val:
- nobs[lab, j] += 1
- resx[lab, j] = val
+ # not nan
+ if val == val:
+ nobs[lab, j] += 1
+ resx[lab, j] = val
+
+ for i in range(ncounts):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = iNaT
+ else:
+ out[i, j] = resx[i, j]
- for i in range(len(counts)):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = iNaT
- else:
- out[i, j] = resx[i, j]
@cython.wraparound(False)
-@cython.wraparound(False)
+@cython.boundscheck(False)
def group_last_bin_float64(ndarray[float64_t, ndim=2] out,
ndarray[int64_t] counts,
ndarray[float64_t, ndim=2] values,
@@ -7830,28 +8028,30 @@ def group_last_bin_float64(ndarray[float64_t, ndim=2] out,
N, K = (<object> values).shape
- b = 0
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ with nogil:
+ b = 0
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
- counts[b] += 1
- for j in range(K):
- val = values[i, j]
+ counts[b] += 1
+ for j in range(K):
+ val = values[i, j]
- # not nan
- if val == val:
- nobs[b, j] += 1
- resx[b, j] = val
+ # not nan
+ if val == val:
+ nobs[b, j] += 1
+ resx[b, j] = val
+
+ for i in range(ngroups):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = NAN
+ else:
+ out[i, j] = resx[i, j]
- for i in range(ngroups):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = nan
- else:
- out[i, j] = resx[i, j]
-@cython.wraparound(False)
@cython.wraparound(False)
+@cython.boundscheck(False)
def group_last_bin_float32(ndarray[float32_t, ndim=2] out,
ndarray[int64_t] counts,
ndarray[float32_t, ndim=2] values,
@@ -7876,28 +8076,30 @@ def group_last_bin_float32(ndarray[float32_t, ndim=2] out,
N, K = (<object> values).shape
- b = 0
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ with nogil:
+ b = 0
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
- counts[b] += 1
- for j in range(K):
- val = values[i, j]
+ counts[b] += 1
+ for j in range(K):
+ val = values[i, j]
- # not nan
- if val == val:
- nobs[b, j] += 1
- resx[b, j] = val
+ # not nan
+ if val == val:
+ nobs[b, j] += 1
+ resx[b, j] = val
+
+ for i in range(ngroups):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = NAN
+ else:
+ out[i, j] = resx[i, j]
- for i in range(ngroups):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = nan
- else:
- out[i, j] = resx[i, j]
-@cython.wraparound(False)
@cython.wraparound(False)
+@cython.boundscheck(False)
def group_last_bin_int64(ndarray[int64_t, ndim=2] out,
ndarray[int64_t] counts,
ndarray[int64_t, ndim=2] values,
@@ -7922,29 +8124,31 @@ def group_last_bin_int64(ndarray[int64_t, ndim=2] out,
N, K = (<object> values).shape
- b = 0
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ with nogil:
+ b = 0
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
- counts[b] += 1
- for j in range(K):
- val = values[i, j]
+ counts[b] += 1
+ for j in range(K):
+ val = values[i, j]
- # not nan
- if val == val:
- nobs[b, j] += 1
- resx[b, j] = val
+ # not nan
+ if val == val:
+ nobs[b, j] += 1
+ resx[b, j] = val
+
+ for i in range(ngroups):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = iNaT
+ else:
+ out[i, j] = resx[i, j]
- for i in range(ngroups):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = iNaT
- else:
- out[i, j] = resx[i, j]
-@cython.boundscheck(False)
@cython.wraparound(False)
+@cython.boundscheck(False)
def group_nth_float64(ndarray[float64_t, ndim=2] out,
ndarray[int64_t] counts,
ndarray[float64_t, ndim=2] values,
@@ -7953,7 +8157,7 @@ def group_nth_float64(ndarray[float64_t, ndim=2] out,
Only aggregates on axis=0
'''
cdef:
- Py_ssize_t i, j, N, K, lab
+ Py_ssize_t i, j, N, K, lab, ncounts = len(counts)
float64_t val, count
ndarray[float64_t, ndim=2] resx
ndarray[int64_t, ndim=2] nobs
@@ -7966,29 +8170,31 @@ def group_nth_float64(ndarray[float64_t, ndim=2] out,
N, K = (<object> values).shape
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
+ with nogil:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
- counts[lab] += 1
- for j in range(K):
- val = values[i, j]
+ counts[lab] += 1
+ for j in range(K):
+ val = values[i, j]
- # not nan
- if val == val:
- nobs[lab, j] += 1
- if nobs[lab, j] == rank:
- resx[lab, j] = val
+ # not nan
+ if val == val:
+ nobs[lab, j] += 1
+ if nobs[lab, j] == rank:
+ resx[lab, j] = val
+
+ for i in range(ncounts):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = NAN
+ else:
+ out[i, j] = resx[i, j]
- for i in range(len(counts)):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = nan
- else:
- out[i, j] = resx[i, j]
-@cython.boundscheck(False)
@cython.wraparound(False)
+@cython.boundscheck(False)
def group_nth_float32(ndarray[float32_t, ndim=2] out,
ndarray[int64_t] counts,
ndarray[float32_t, ndim=2] values,
@@ -7997,7 +8203,7 @@ def group_nth_float32(ndarray[float32_t, ndim=2] out,
Only aggregates on axis=0
'''
cdef:
- Py_ssize_t i, j, N, K, lab
+ Py_ssize_t i, j, N, K, lab, ncounts = len(counts)
float32_t val, count
ndarray[float32_t, ndim=2] resx
ndarray[int64_t, ndim=2] nobs
@@ -8010,29 +8216,31 @@ def group_nth_float32(ndarray[float32_t, ndim=2] out,
N, K = (<object> values).shape
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
+ with nogil:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
- counts[lab] += 1
- for j in range(K):
- val = values[i, j]
+ counts[lab] += 1
+ for j in range(K):
+ val = values[i, j]
- # not nan
- if val == val:
- nobs[lab, j] += 1
- if nobs[lab, j] == rank:
- resx[lab, j] = val
+ # not nan
+ if val == val:
+ nobs[lab, j] += 1
+ if nobs[lab, j] == rank:
+ resx[lab, j] = val
+
+ for i in range(ncounts):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = NAN
+ else:
+ out[i, j] = resx[i, j]
- for i in range(len(counts)):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = nan
- else:
- out[i, j] = resx[i, j]
-@cython.boundscheck(False)
@cython.wraparound(False)
+@cython.boundscheck(False)
def group_nth_int64(ndarray[int64_t, ndim=2] out,
ndarray[int64_t] counts,
ndarray[int64_t, ndim=2] values,
@@ -8041,7 +8249,7 @@ def group_nth_int64(ndarray[int64_t, ndim=2] out,
Only aggregates on axis=0
'''
cdef:
- Py_ssize_t i, j, N, K, lab
+ Py_ssize_t i, j, N, K, lab, ncounts = len(counts)
int64_t val, count
ndarray[int64_t, ndim=2] resx
ndarray[int64_t, ndim=2] nobs
@@ -8054,30 +8262,32 @@ def group_nth_int64(ndarray[int64_t, ndim=2] out,
N, K = (<object> values).shape
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
+ with nogil:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
- counts[lab] += 1
- for j in range(K):
- val = values[i, j]
+ counts[lab] += 1
+ for j in range(K):
+ val = values[i, j]
- # not nan
- if val == val:
- nobs[lab, j] += 1
- if nobs[lab, j] == rank:
- resx[lab, j] = val
+ # not nan
+ if val == val:
+ nobs[lab, j] += 1
+ if nobs[lab, j] == rank:
+ resx[lab, j] = val
+
+ for i in range(ncounts):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = iNaT
+ else:
+ out[i, j] = resx[i, j]
- for i in range(len(counts)):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = iNaT
- else:
- out[i, j] = resx[i, j]
-@cython.boundscheck(False)
@cython.wraparound(False)
+@cython.boundscheck(False)
def group_nth_bin_float64(ndarray[float64_t, ndim=2] out,
ndarray[int64_t] counts,
ndarray[float64_t, ndim=2] values,
@@ -8102,29 +8312,31 @@ def group_nth_bin_float64(ndarray[float64_t, ndim=2] out,
N, K = (<object> values).shape
- b = 0
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ with nogil:
+ b = 0
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
- counts[b] += 1
- for j in range(K):
- val = values[i, j]
+ counts[b] += 1
+ for j in range(K):
+ val = values[i, j]
- # not nan
- if val == val:
- nobs[b, j] += 1
- if nobs[b, j] == rank:
- resx[b, j] = val
+ # not nan
+ if val == val:
+ nobs[b, j] += 1
+ if nobs[b, j] == rank:
+ resx[b, j] = val
+
+ for i in range(ngroups):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = NAN
+ else:
+ out[i, j] = resx[i, j]
- for i in range(ngroups):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = nan
- else:
- out[i, j] = resx[i, j]
-@cython.boundscheck(False)
@cython.wraparound(False)
+@cython.boundscheck(False)
def group_nth_bin_float32(ndarray[float32_t, ndim=2] out,
ndarray[int64_t] counts,
ndarray[float32_t, ndim=2] values,
@@ -8149,29 +8361,31 @@ def group_nth_bin_float32(ndarray[float32_t, ndim=2] out,
N, K = (<object> values).shape
- b = 0
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ with nogil:
+ b = 0
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
- counts[b] += 1
- for j in range(K):
- val = values[i, j]
+ counts[b] += 1
+ for j in range(K):
+ val = values[i, j]
- # not nan
- if val == val:
- nobs[b, j] += 1
- if nobs[b, j] == rank:
- resx[b, j] = val
+ # not nan
+ if val == val:
+ nobs[b, j] += 1
+ if nobs[b, j] == rank:
+ resx[b, j] = val
+
+ for i in range(ngroups):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = NAN
+ else:
+ out[i, j] = resx[i, j]
- for i in range(ngroups):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = nan
- else:
- out[i, j] = resx[i, j]
-@cython.boundscheck(False)
@cython.wraparound(False)
+@cython.boundscheck(False)
def group_nth_bin_int64(ndarray[int64_t, ndim=2] out,
ndarray[int64_t] counts,
ndarray[int64_t, ndim=2] values,
@@ -8196,27 +8410,29 @@ def group_nth_bin_int64(ndarray[int64_t, ndim=2] out,
N, K = (<object> values).shape
- b = 0
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ with nogil:
+ b = 0
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
- counts[b] += 1
- for j in range(K):
- val = values[i, j]
+ counts[b] += 1
+ for j in range(K):
+ val = values[i, j]
- # not nan
- if val == val:
- nobs[b, j] += 1
- if nobs[b, j] == rank:
- resx[b, j] = val
+ # not nan
+ if val == val:
+ nobs[b, j] += 1
+ if nobs[b, j] == rank:
+ resx[b, j] = val
+
+ for i in range(ngroups):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = iNaT
+ else:
+ out[i, j] = resx[i, j]
- for i in range(ngroups):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = iNaT
- else:
- out[i, j] = resx[i, j]
@cython.wraparound(False)
@cython.boundscheck(False)
@@ -8228,7 +8444,7 @@ def group_min_float64(ndarray[float64_t, ndim=2] out,
Only aggregates on axis=0
'''
cdef:
- Py_ssize_t i, j, N, K, lab
+ Py_ssize_t i, j, N, K, lab, ncounts = len(counts)
float64_t val, count
ndarray[float64_t, ndim=2] minx, nobs
@@ -8242,42 +8458,44 @@ def group_min_float64(ndarray[float64_t, ndim=2] out,
N, K = (<object> values).shape
- if K > 1:
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
+ with nogil:
+ if K > 1:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
- counts[lab] += 1
- for j in range(K):
- val = values[i, j]
+ counts[lab] += 1
+ for j in range(K):
+ val = values[i, j]
+
+ # not nan
+ if val == val:
+ nobs[lab, j] += 1
+ if val < minx[lab, j]:
+ minx[lab, j] = val
+ else:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
+
+ counts[lab] += 1
+ val = values[i, 0]
# not nan
if val == val:
- nobs[lab, j] += 1
- if val < minx[lab, j]:
- minx[lab, j] = val
- else:
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
-
- counts[lab] += 1
- val = values[i, 0]
+ nobs[lab, 0] += 1
+ if val < minx[lab, 0]:
+ minx[lab, 0] = val
- # not nan
- if val == val:
- nobs[lab, 0] += 1
- if val < minx[lab, 0]:
- minx[lab, 0] = val
+ for i in range(ncounts):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = NAN
+ else:
+ out[i, j] = minx[i, j]
- for i in range(len(counts)):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = nan
- else:
- out[i, j] = minx[i, j]
@cython.wraparound(False)
@cython.boundscheck(False)
def group_min_float32(ndarray[float32_t, ndim=2] out,
@@ -8288,7 +8506,7 @@ def group_min_float32(ndarray[float32_t, ndim=2] out,
Only aggregates on axis=0
'''
cdef:
- Py_ssize_t i, j, N, K, lab
+ Py_ssize_t i, j, N, K, lab, ncounts = len(counts)
float32_t val, count
ndarray[float32_t, ndim=2] minx, nobs
@@ -8302,42 +8520,44 @@ def group_min_float32(ndarray[float32_t, ndim=2] out,
N, K = (<object> values).shape
- if K > 1:
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
+ with nogil:
+ if K > 1:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
- counts[lab] += 1
- for j in range(K):
- val = values[i, j]
+ counts[lab] += 1
+ for j in range(K):
+ val = values[i, j]
+
+ # not nan
+ if val == val:
+ nobs[lab, j] += 1
+ if val < minx[lab, j]:
+ minx[lab, j] = val
+ else:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
+
+ counts[lab] += 1
+ val = values[i, 0]
# not nan
if val == val:
- nobs[lab, j] += 1
- if val < minx[lab, j]:
- minx[lab, j] = val
- else:
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
-
- counts[lab] += 1
- val = values[i, 0]
+ nobs[lab, 0] += 1
+ if val < minx[lab, 0]:
+ minx[lab, 0] = val
- # not nan
- if val == val:
- nobs[lab, 0] += 1
- if val < minx[lab, 0]:
- minx[lab, 0] = val
+ for i in range(ncounts):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = NAN
+ else:
+ out[i, j] = minx[i, j]
- for i in range(len(counts)):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = nan
- else:
- out[i, j] = minx[i, j]
@cython.wraparound(False)
@cython.boundscheck(False)
def group_min_int64(ndarray[int64_t, ndim=2] out,
@@ -8348,7 +8568,7 @@ def group_min_int64(ndarray[int64_t, ndim=2] out,
Only aggregates on axis=0
'''
cdef:
- Py_ssize_t i, j, N, K, lab
+ Py_ssize_t i, j, N, K, lab, ncounts = len(counts)
int64_t val, count
ndarray[int64_t, ndim=2] minx, nobs
@@ -8362,42 +8582,44 @@ def group_min_int64(ndarray[int64_t, ndim=2] out,
N, K = (<object> values).shape
- if K > 1:
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
+ with nogil:
+ if K > 1:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
- counts[lab] += 1
- for j in range(K):
- val = values[i, j]
+ counts[lab] += 1
+ for j in range(K):
+ val = values[i, j]
+
+ # not nan
+ if val == val:
+ nobs[lab, j] += 1
+ if val < minx[lab, j]:
+ minx[lab, j] = val
+ else:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
+
+ counts[lab] += 1
+ val = values[i, 0]
# not nan
if val == val:
- nobs[lab, j] += 1
- if val < minx[lab, j]:
- minx[lab, j] = val
- else:
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
-
- counts[lab] += 1
- val = values[i, 0]
+ nobs[lab, 0] += 1
+ if val < minx[lab, 0]:
+ minx[lab, 0] = val
- # not nan
- if val == val:
- nobs[lab, 0] += 1
- if val < minx[lab, 0]:
- minx[lab, 0] = val
+ for i in range(ncounts):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = iNaT
+ else:
+ out[i, j] = minx[i, j]
- for i in range(len(counts)):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = iNaT
- else:
- out[i, j] = minx[i, j]
@cython.wraparound(False)
@cython.boundscheck(False)
@@ -8427,41 +8649,43 @@ def group_min_bin_float64(ndarray[float64_t, ndim=2] out,
N, K = (<object> values).shape
- b = 0
- if K > 1:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ with nogil:
+ b = 0
+ if K > 1:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
- counts[b] += 1
- for j in range(K):
- val = values[i, j]
+ counts[b] += 1
+ for j in range(K):
+ val = values[i, j]
+
+ # not nan
+ if val == val:
+ nobs[b, j] += 1
+ if val < minx[b, j]:
+ minx[b, j] = val
+ else:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
+
+ counts[b] += 1
+ val = values[i, 0]
# not nan
if val == val:
- nobs[b, j] += 1
- if val < minx[b, j]:
- minx[b, j] = val
- else:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
-
- counts[b] += 1
- val = values[i, 0]
+ nobs[b, 0] += 1
+ if val < minx[b, 0]:
+ minx[b, 0] = val
- # not nan
- if val == val:
- nobs[b, 0] += 1
- if val < minx[b, 0]:
- minx[b, 0] = val
+ for i in range(ngroups):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = NAN
+ else:
+ out[i, j] = minx[i, j]
- for i in range(ngroups):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = nan
- else:
- out[i, j] = minx[i, j]
@cython.wraparound(False)
@cython.boundscheck(False)
def group_min_bin_float32(ndarray[float32_t, ndim=2] out,
@@ -8490,41 +8714,43 @@ def group_min_bin_float32(ndarray[float32_t, ndim=2] out,
N, K = (<object> values).shape
- b = 0
- if K > 1:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ with nogil:
+ b = 0
+ if K > 1:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
- counts[b] += 1
- for j in range(K):
- val = values[i, j]
+ counts[b] += 1
+ for j in range(K):
+ val = values[i, j]
+
+ # not nan
+ if val == val:
+ nobs[b, j] += 1
+ if val < minx[b, j]:
+ minx[b, j] = val
+ else:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
+
+ counts[b] += 1
+ val = values[i, 0]
# not nan
if val == val:
- nobs[b, j] += 1
- if val < minx[b, j]:
- minx[b, j] = val
- else:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
-
- counts[b] += 1
- val = values[i, 0]
+ nobs[b, 0] += 1
+ if val < minx[b, 0]:
+ minx[b, 0] = val
- # not nan
- if val == val:
- nobs[b, 0] += 1
- if val < minx[b, 0]:
- minx[b, 0] = val
+ for i in range(ngroups):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = NAN
+ else:
+ out[i, j] = minx[i, j]
- for i in range(ngroups):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = nan
- else:
- out[i, j] = minx[i, j]
@cython.wraparound(False)
@cython.boundscheck(False)
def group_min_bin_int64(ndarray[int64_t, ndim=2] out,
@@ -8553,41 +8779,43 @@ def group_min_bin_int64(ndarray[int64_t, ndim=2] out,
N, K = (<object> values).shape
- b = 0
- if K > 1:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ with nogil:
+ b = 0
+ if K > 1:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
- counts[b] += 1
- for j in range(K):
- val = values[i, j]
+ counts[b] += 1
+ for j in range(K):
+ val = values[i, j]
+
+ # not nan
+ if val == val:
+ nobs[b, j] += 1
+ if val < minx[b, j]:
+ minx[b, j] = val
+ else:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
+
+ counts[b] += 1
+ val = values[i, 0]
# not nan
if val == val:
- nobs[b, j] += 1
- if val < minx[b, j]:
- minx[b, j] = val
- else:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
-
- counts[b] += 1
- val = values[i, 0]
+ nobs[b, 0] += 1
+ if val < minx[b, 0]:
+ minx[b, 0] = val
- # not nan
- if val == val:
- nobs[b, 0] += 1
- if val < minx[b, 0]:
- minx[b, 0] = val
+ for i in range(ngroups):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = iNaT
+ else:
+ out[i, j] = minx[i, j]
- for i in range(ngroups):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = iNaT
- else:
- out[i, j] = minx[i, j]
@cython.wraparound(False)
@cython.boundscheck(False)
@@ -8599,7 +8827,7 @@ def group_max_float64(ndarray[float64_t, ndim=2] out,
Only aggregates on axis=0
'''
cdef:
- Py_ssize_t i, j, N, K, lab
+ Py_ssize_t i, j, N, K, lab, ncounts = len(counts)
float64_t val, count
ndarray[float64_t, ndim=2] maxx, nobs
@@ -8613,42 +8841,44 @@ def group_max_float64(ndarray[float64_t, ndim=2] out,
N, K = (<object> values).shape
- if K > 1:
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
+ with nogil:
+ if K > 1:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
- counts[lab] += 1
- for j in range(K):
- val = values[i, j]
+ counts[lab] += 1
+ for j in range(K):
+ val = values[i, j]
+
+ # not nan
+ if val == val:
+ nobs[lab, j] += 1
+ if val > maxx[lab, j]:
+ maxx[lab, j] = val
+ else:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
+
+ counts[lab] += 1
+ val = values[i, 0]
# not nan
if val == val:
- nobs[lab, j] += 1
- if val > maxx[lab, j]:
- maxx[lab, j] = val
- else:
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
-
- counts[lab] += 1
- val = values[i, 0]
+ nobs[lab, 0] += 1
+ if val > maxx[lab, 0]:
+ maxx[lab, 0] = val
- # not nan
- if val == val:
- nobs[lab, 0] += 1
- if val > maxx[lab, 0]:
- maxx[lab, 0] = val
+ for i in range(ncounts):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = NAN
+ else:
+ out[i, j] = maxx[i, j]
- for i in range(len(counts)):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = nan
- else:
- out[i, j] = maxx[i, j]
@cython.wraparound(False)
@cython.boundscheck(False)
def group_max_float32(ndarray[float32_t, ndim=2] out,
@@ -8659,7 +8889,7 @@ def group_max_float32(ndarray[float32_t, ndim=2] out,
Only aggregates on axis=0
'''
cdef:
- Py_ssize_t i, j, N, K, lab
+ Py_ssize_t i, j, N, K, lab, ncounts = len(counts)
float32_t val, count
ndarray[float32_t, ndim=2] maxx, nobs
@@ -8673,42 +8903,44 @@ def group_max_float32(ndarray[float32_t, ndim=2] out,
N, K = (<object> values).shape
- if K > 1:
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
+ with nogil:
+ if K > 1:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
- counts[lab] += 1
- for j in range(K):
- val = values[i, j]
+ counts[lab] += 1
+ for j in range(K):
+ val = values[i, j]
+
+ # not nan
+ if val == val:
+ nobs[lab, j] += 1
+ if val > maxx[lab, j]:
+ maxx[lab, j] = val
+ else:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
+
+ counts[lab] += 1
+ val = values[i, 0]
# not nan
if val == val:
- nobs[lab, j] += 1
- if val > maxx[lab, j]:
- maxx[lab, j] = val
- else:
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
-
- counts[lab] += 1
- val = values[i, 0]
+ nobs[lab, 0] += 1
+ if val > maxx[lab, 0]:
+ maxx[lab, 0] = val
- # not nan
- if val == val:
- nobs[lab, 0] += 1
- if val > maxx[lab, 0]:
- maxx[lab, 0] = val
+ for i in range(ncounts):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = NAN
+ else:
+ out[i, j] = maxx[i, j]
- for i in range(len(counts)):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = nan
- else:
- out[i, j] = maxx[i, j]
@cython.wraparound(False)
@cython.boundscheck(False)
def group_max_int64(ndarray[int64_t, ndim=2] out,
@@ -8719,7 +8951,7 @@ def group_max_int64(ndarray[int64_t, ndim=2] out,
Only aggregates on axis=0
'''
cdef:
- Py_ssize_t i, j, N, K, lab
+ Py_ssize_t i, j, N, K, lab, ncounts = len(counts)
int64_t val, count
ndarray[int64_t, ndim=2] maxx, nobs
@@ -8733,42 +8965,44 @@ def group_max_int64(ndarray[int64_t, ndim=2] out,
N, K = (<object> values).shape
- if K > 1:
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
+ with nogil:
+ if K > 1:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
- counts[lab] += 1
- for j in range(K):
- val = values[i, j]
+ counts[lab] += 1
+ for j in range(K):
+ val = values[i, j]
- # not nan
- if val == val:
- nobs[lab, j] += 1
- if val > maxx[lab, j]:
- maxx[lab, j] = val
- else:
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
+ # not nan
+ if val == val:
+ nobs[lab, j] += 1
+ if val > maxx[lab, j]:
+ maxx[lab, j] = val
+ else:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
- counts[lab] += 1
- val = values[i, 0]
+ counts[lab] += 1
+ val = values[i, 0]
+
+ # not nan
+ if val == val:
+ nobs[lab, 0] += 1
+ if val > maxx[lab, 0]:
+ maxx[lab, 0] = val
- # not nan
- if val == val:
- nobs[lab, 0] += 1
- if val > maxx[lab, 0]:
- maxx[lab, 0] = val
+ for i in range(ncounts):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = iNaT
+ else:
+ out[i, j] = maxx[i, j]
- for i in range(len(counts)):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = iNaT
- else:
- out[i, j] = maxx[i, j]
@cython.wraparound(False)
@cython.boundscheck(False)
@@ -8797,41 +9031,43 @@ def group_max_bin_float64(ndarray[float64_t, ndim=2] out,
N, K = (<object> values).shape
- b = 0
- if K > 1:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ with nogil:
+ b = 0
+ if K > 1:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
- counts[b] += 1
- for j in range(K):
- val = values[i, j]
+ counts[b] += 1
+ for j in range(K):
+ val = values[i, j]
+
+ # not nan
+ if val == val:
+ nobs[b, j] += 1
+ if val > maxx[b, j]:
+ maxx[b, j] = val
+ else:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
+
+ counts[b] += 1
+ val = values[i, 0]
# not nan
if val == val:
- nobs[b, j] += 1
- if val > maxx[b, j]:
- maxx[b, j] = val
- else:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
-
- counts[b] += 1
- val = values[i, 0]
+ nobs[b, 0] += 1
+ if val > maxx[b, 0]:
+ maxx[b, 0] = val
- # not nan
- if val == val:
- nobs[b, 0] += 1
- if val > maxx[b, 0]:
- maxx[b, 0] = val
+ for i in range(ngroups):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = NAN
+ else:
+ out[i, j] = maxx[i, j]
- for i in range(ngroups):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = nan
- else:
- out[i, j] = maxx[i, j]
@cython.wraparound(False)
@cython.boundscheck(False)
def group_max_bin_float32(ndarray[float32_t, ndim=2] out,
@@ -8859,41 +9095,43 @@ def group_max_bin_float32(ndarray[float32_t, ndim=2] out,
N, K = (<object> values).shape
- b = 0
- if K > 1:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ with nogil:
+ b = 0
+ if K > 1:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
- counts[b] += 1
- for j in range(K):
- val = values[i, j]
+ counts[b] += 1
+ for j in range(K):
+ val = values[i, j]
+
+ # not nan
+ if val == val:
+ nobs[b, j] += 1
+ if val > maxx[b, j]:
+ maxx[b, j] = val
+ else:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
+
+ counts[b] += 1
+ val = values[i, 0]
# not nan
if val == val:
- nobs[b, j] += 1
- if val > maxx[b, j]:
- maxx[b, j] = val
- else:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
-
- counts[b] += 1
- val = values[i, 0]
+ nobs[b, 0] += 1
+ if val > maxx[b, 0]:
+ maxx[b, 0] = val
- # not nan
- if val == val:
- nobs[b, 0] += 1
- if val > maxx[b, 0]:
- maxx[b, 0] = val
+ for i in range(ngroups):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = NAN
+ else:
+ out[i, j] = maxx[i, j]
- for i in range(ngroups):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = nan
- else:
- out[i, j] = maxx[i, j]
@cython.wraparound(False)
@cython.boundscheck(False)
def group_max_bin_int64(ndarray[int64_t, ndim=2] out,
@@ -8921,41 +9159,43 @@ def group_max_bin_int64(ndarray[int64_t, ndim=2] out,
N, K = (<object> values).shape
- b = 0
- if K > 1:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
+ with nogil:
+ b = 0
+ if K > 1:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
- counts[b] += 1
- for j in range(K):
- val = values[i, j]
+ counts[b] += 1
+ for j in range(K):
+ val = values[i, j]
+
+ # not nan
+ if val == val:
+ nobs[b, j] += 1
+ if val > maxx[b, j]:
+ maxx[b, j] = val
+ else:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
+
+ counts[b] += 1
+ val = values[i, 0]
# not nan
if val == val:
- nobs[b, j] += 1
- if val > maxx[b, j]:
- maxx[b, j] = val
- else:
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
-
- counts[b] += 1
- val = values[i, 0]
+ nobs[b, 0] += 1
+ if val > maxx[b, 0]:
+ maxx[b, 0] = val
- # not nan
- if val == val:
- nobs[b, 0] += 1
- if val > maxx[b, 0]:
- maxx[b, 0] = val
+ for i in range(ngroups):
+ for j in range(K):
+ if nobs[i, j] == 0:
+ out[i, j] = iNaT
+ else:
+ out[i, j] = maxx[i, j]
- for i in range(ngroups):
- for j in range(K):
- if nobs[i, j] == 0:
- out[i, j] = iNaT
- else:
- out[i, j] = maxx[i, j]
@cython.boundscheck(False)
@cython.wraparound(False)
@@ -8967,31 +9207,32 @@ def group_count_float64(ndarray[float64_t, ndim=2] out,
Only aggregates on axis=0
'''
cdef:
- Py_ssize_t i, j, lab
+ Py_ssize_t i, j, lab, ncounts = len(counts)
Py_ssize_t N = values.shape[0], K = values.shape[1]
float64_t val
ndarray[int64_t, ndim=2] nobs = np.zeros((out.shape[0], out.shape[1]),
dtype=np.int64)
if len(values) != len(labels):
- raise AssertionError("len(index) != len(labels)")
+ raise AssertionError("len(index) != len(labels)")
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
- counts[lab] += 1
- for j in range(K):
- val = values[i, j]
+ with nogil:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
- # not nan
- nobs[lab, j] += val == val and val != iNaT
+ counts[lab] += 1
+ for j in range(K):
+ val = values[i, j]
- for i in range(len(counts)):
- for j in range(K):
- out[i, j] = nobs[i, j]
+ # not nan
+ nobs[lab, j] += val == val and val != iNaT
+ for i in range(ncounts):
+ for j in range(K):
+ out[i, j] = nobs[i, j]
@cython.boundscheck(False)
@cython.wraparound(False)
@@ -9003,31 +9244,32 @@ def group_count_float32(ndarray[float32_t, ndim=2] out,
Only aggregates on axis=0
'''
cdef:
- Py_ssize_t i, j, lab
+ Py_ssize_t i, j, lab, ncounts = len(counts)
Py_ssize_t N = values.shape[0], K = values.shape[1]
float32_t val
ndarray[int64_t, ndim=2] nobs = np.zeros((out.shape[0], out.shape[1]),
dtype=np.int64)
if len(values) != len(labels):
- raise AssertionError("len(index) != len(labels)")
+ raise AssertionError("len(index) != len(labels)")
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
- counts[lab] += 1
- for j in range(K):
- val = values[i, j]
+ with nogil:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
- # not nan
- nobs[lab, j] += val == val and val != iNaT
+ counts[lab] += 1
+ for j in range(K):
+ val = values[i, j]
- for i in range(len(counts)):
- for j in range(K):
- out[i, j] = nobs[i, j]
+ # not nan
+ nobs[lab, j] += val == val and val != iNaT
+ for i in range(ncounts):
+ for j in range(K):
+ out[i, j] = nobs[i, j]
@cython.boundscheck(False)
@cython.wraparound(False)
@@ -9039,31 +9281,32 @@ def group_count_int64(ndarray[int64_t, ndim=2] out,
Only aggregates on axis=0
'''
cdef:
- Py_ssize_t i, j, lab
+ Py_ssize_t i, j, lab, ncounts = len(counts)
Py_ssize_t N = values.shape[0], K = values.shape[1]
int64_t val
ndarray[int64_t, ndim=2] nobs = np.zeros((out.shape[0], out.shape[1]),
dtype=np.int64)
if len(values) != len(labels):
- raise AssertionError("len(index) != len(labels)")
+ raise AssertionError("len(index) != len(labels)")
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
- counts[lab] += 1
- for j in range(K):
- val = values[i, j]
+ with nogil:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
- # not nan
- nobs[lab, j] += val == val and val != iNaT
+ counts[lab] += 1
+ for j in range(K):
+ val = values[i, j]
- for i in range(len(counts)):
- for j in range(K):
- out[i, j] = nobs[i, j]
+ # not nan
+ nobs[lab, j] += val == val and val != iNaT
+ for i in range(ncounts):
+ for j in range(K):
+ out[i, j] = nobs[i, j]
@cython.boundscheck(False)
@cython.wraparound(False)
@@ -9075,15 +9318,17 @@ def group_count_object(ndarray[object, ndim=2] out,
Only aggregates on axis=0
'''
cdef:
- Py_ssize_t i, j, lab
+ Py_ssize_t i, j, lab, ncounts = len(counts)
Py_ssize_t N = values.shape[0], K = values.shape[1]
object val
ndarray[int64_t, ndim=2] nobs = np.zeros((out.shape[0], out.shape[1]),
dtype=np.int64)
if len(values) != len(labels):
- raise AssertionError("len(index) != len(labels)")
+ raise AssertionError("len(index) != len(labels)")
+
+
for i in range(N):
lab = labels[i]
if lab < 0:
@@ -9096,11 +9341,10 @@ def group_count_object(ndarray[object, ndim=2] out,
# not nan
nobs[lab, j] += val == val and val != iNaT
- for i in range(len(counts)):
+ for i in range(ncounts):
for j in range(K):
out[i, j] = nobs[i, j]
-
@cython.boundscheck(False)
@cython.wraparound(False)
def group_count_int64(ndarray[int64_t, ndim=2] out,
@@ -9111,35 +9355,36 @@ def group_count_int64(ndarray[int64_t, ndim=2] out,
Only aggregates on axis=0
'''
cdef:
- Py_ssize_t i, j, lab
+ Py_ssize_t i, j, lab, ncounts = len(counts)
Py_ssize_t N = values.shape[0], K = values.shape[1]
int64_t val
ndarray[int64_t, ndim=2] nobs = np.zeros((out.shape[0], out.shape[1]),
dtype=np.int64)
if len(values) != len(labels):
- raise AssertionError("len(index) != len(labels)")
+ raise AssertionError("len(index) != len(labels)")
- for i in range(N):
- lab = labels[i]
- if lab < 0:
- continue
- counts[lab] += 1
- for j in range(K):
- val = values[i, j]
+ with nogil:
+ for i in range(N):
+ lab = labels[i]
+ if lab < 0:
+ continue
- # not nan
- nobs[lab, j] += val == val and val != iNaT
+ counts[lab] += 1
+ for j in range(K):
+ val = values[i, j]
- for i in range(len(counts)):
- for j in range(K):
- out[i, j] = nobs[i, j]
+ # not nan
+ nobs[lab, j] += val == val and val != iNaT
+ for i in range(ncounts):
+ for j in range(K):
+ out[i, j] = nobs[i, j]
-@cython.boundscheck(False)
@cython.wraparound(False)
+@cython.boundscheck(False)
def group_count_bin_float64(ndarray[float64_t, ndim=2] out,
ndarray[int64_t] counts,
ndarray[float64_t, ndim=2] values,
@@ -9158,24 +9403,24 @@ def group_count_bin_float64(ndarray[float64_t, ndim=2] out,
return
ngroups = len(bins) + (bins[len(bins) - 1] != N)
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
-
- counts[b] += 1
- for j in range(K):
- val = values[i, j]
+ with nogil:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
- # not nan
- nobs[b, j] += val == val and val != iNaT
+ counts[b] += 1
+ for j in range(K):
+ val = values[i, j]
- for i in range(ngroups):
- for j in range(K):
- out[i, j] = nobs[i, j]
+ # not nan
+ nobs[b, j] += val == val and val != iNaT
+ for i in range(ngroups):
+ for j in range(K):
+ out[i, j] = nobs[i, j]
-@cython.boundscheck(False)
@cython.wraparound(False)
+@cython.boundscheck(False)
def group_count_bin_float32(ndarray[float32_t, ndim=2] out,
ndarray[int64_t] counts,
ndarray[float32_t, ndim=2] values,
@@ -9194,24 +9439,24 @@ def group_count_bin_float32(ndarray[float32_t, ndim=2] out,
return
ngroups = len(bins) + (bins[len(bins) - 1] != N)
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
-
- counts[b] += 1
- for j in range(K):
- val = values[i, j]
+ with nogil:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
- # not nan
- nobs[b, j] += val == val and val != iNaT
+ counts[b] += 1
+ for j in range(K):
+ val = values[i, j]
- for i in range(ngroups):
- for j in range(K):
- out[i, j] = nobs[i, j]
+ # not nan
+ nobs[b, j] += val == val and val != iNaT
+ for i in range(ngroups):
+ for j in range(K):
+ out[i, j] = nobs[i, j]
-@cython.boundscheck(False)
@cython.wraparound(False)
+@cython.boundscheck(False)
def group_count_bin_int64(ndarray[int64_t, ndim=2] out,
ndarray[int64_t] counts,
ndarray[int64_t, ndim=2] values,
@@ -9230,24 +9475,24 @@ def group_count_bin_int64(ndarray[int64_t, ndim=2] out,
return
ngroups = len(bins) + (bins[len(bins) - 1] != N)
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
-
- counts[b] += 1
- for j in range(K):
- val = values[i, j]
+ with nogil:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
- # not nan
- nobs[b, j] += val == val and val != iNaT
+ counts[b] += 1
+ for j in range(K):
+ val = values[i, j]
- for i in range(ngroups):
- for j in range(K):
- out[i, j] = nobs[i, j]
+ # not nan
+ nobs[b, j] += val == val and val != iNaT
+ for i in range(ngroups):
+ for j in range(K):
+ out[i, j] = nobs[i, j]
-@cython.boundscheck(False)
@cython.wraparound(False)
+@cython.boundscheck(False)
def group_count_bin_object(ndarray[object, ndim=2] out,
ndarray[int64_t] counts,
ndarray[object, ndim=2] values,
@@ -9266,6 +9511,7 @@ def group_count_bin_object(ndarray[object, ndim=2] out,
return
ngroups = len(bins) + (bins[len(bins) - 1] != N)
+
for i in range(N):
while b < ngroups - 1 and i >= bins[b]:
b += 1
@@ -9281,9 +9527,8 @@ def group_count_bin_object(ndarray[object, ndim=2] out,
for j in range(K):
out[i, j] = nobs[i, j]
-
-@cython.boundscheck(False)
@cython.wraparound(False)
+@cython.boundscheck(False)
def group_count_bin_int64(ndarray[int64_t, ndim=2] out,
ndarray[int64_t] counts,
ndarray[int64_t, ndim=2] values,
@@ -9302,21 +9547,21 @@ def group_count_bin_int64(ndarray[int64_t, ndim=2] out,
return
ngroups = len(bins) + (bins[len(bins) - 1] != N)
- for i in range(N):
- while b < ngroups - 1 and i >= bins[b]:
- b += 1
-
- counts[b] += 1
- for j in range(K):
- val = values[i, j]
+ with nogil:
+ for i in range(N):
+ while b < ngroups - 1 and i >= bins[b]:
+ b += 1
- # not nan
- nobs[b, j] += val == val and val != iNaT
+ counts[b] += 1
+ for j in range(K):
+ val = values[i, j]
- for i in range(ngroups):
- for j in range(K):
- out[i, j] = nobs[i, j]
+ # not nan
+ nobs[b, j] += val == val and val != iNaT
+ for i in range(ngroups):
+ for j in range(K):
+ out[i, j] = nobs[i, j]
@cython.wraparound(False)
diff --git a/pandas/src/khash.pxd b/pandas/src/khash.pxd
index a8fd51a62cfbe..b28f43eecfac7 100644
--- a/pandas/src/khash.pxd
+++ b/pandas/src/khash.pxd
@@ -45,15 +45,15 @@ cdef extern from "khash_python.h":
kh_cstr_t *keys
size_t *vals
- inline kh_str_t* kh_init_str()
- inline void kh_destroy_str(kh_str_t*)
- inline void kh_clear_str(kh_str_t*)
- inline khint_t kh_get_str(kh_str_t*, kh_cstr_t)
- inline void kh_resize_str(kh_str_t*, khint_t)
- inline khint_t kh_put_str(kh_str_t*, kh_cstr_t, int*)
- inline void kh_del_str(kh_str_t*, khint_t)
+ inline kh_str_t* kh_init_str() nogil
+ inline void kh_destroy_str(kh_str_t*) nogil
+ inline void kh_clear_str(kh_str_t*) nogil
+ inline khint_t kh_get_str(kh_str_t*, kh_cstr_t) nogil
+ inline void kh_resize_str(kh_str_t*, khint_t) nogil
+ inline khint_t kh_put_str(kh_str_t*, kh_cstr_t, int*) nogil
+ inline void kh_del_str(kh_str_t*, khint_t) nogil
- bint kh_exist_str(kh_str_t*, khiter_t)
+ bint kh_exist_str(kh_str_t*, khiter_t) nogil
ctypedef struct kh_int64_t:
@@ -62,15 +62,15 @@ cdef extern from "khash_python.h":
int64_t *keys
size_t *vals
- inline kh_int64_t* kh_init_int64()
- inline void kh_destroy_int64(kh_int64_t*)
- inline void kh_clear_int64(kh_int64_t*)
- inline khint_t kh_get_int64(kh_int64_t*, int64_t)
- inline void kh_resize_int64(kh_int64_t*, khint_t)
- inline khint_t kh_put_int64(kh_int64_t*, int64_t, int*)
- inline void kh_del_int64(kh_int64_t*, khint_t)
+ inline kh_int64_t* kh_init_int64() nogil
+ inline void kh_destroy_int64(kh_int64_t*) nogil
+ inline void kh_clear_int64(kh_int64_t*) nogil
+ inline khint_t kh_get_int64(kh_int64_t*, int64_t) nogil
+ inline void kh_resize_int64(kh_int64_t*, khint_t) nogil
+ inline khint_t kh_put_int64(kh_int64_t*, int64_t, int*) nogil
+ inline void kh_del_int64(kh_int64_t*, khint_t) nogil
- bint kh_exist_int64(kh_int64_t*, khiter_t)
+ bint kh_exist_int64(kh_int64_t*, khiter_t) nogil
ctypedef struct kh_float64_t:
khint_t n_buckets, size, n_occupied, upper_bound
@@ -78,15 +78,15 @@ cdef extern from "khash_python.h":
float64_t *keys
size_t *vals
- inline kh_float64_t* kh_init_float64()
- inline void kh_destroy_float64(kh_float64_t*)
- inline void kh_clear_float64(kh_float64_t*)
- inline khint_t kh_get_float64(kh_float64_t*, float64_t)
- inline void kh_resize_float64(kh_float64_t*, khint_t)
- inline khint_t kh_put_float64(kh_float64_t*, float64_t, int*)
- inline void kh_del_float64(kh_float64_t*, khint_t)
+ inline kh_float64_t* kh_init_float64() nogil
+ inline void kh_destroy_float64(kh_float64_t*) nogil
+ inline void kh_clear_float64(kh_float64_t*) nogil
+ inline khint_t kh_get_float64(kh_float64_t*, float64_t) nogil
+ inline void kh_resize_float64(kh_float64_t*, khint_t) nogil
+ inline khint_t kh_put_float64(kh_float64_t*, float64_t, int*) nogil
+ inline void kh_del_float64(kh_float64_t*, khint_t) nogil
- bint kh_exist_float64(kh_float64_t*, khiter_t)
+ bint kh_exist_float64(kh_float64_t*, khiter_t) nogil
ctypedef struct kh_int32_t:
khint_t n_buckets, size, n_occupied, upper_bound
@@ -94,15 +94,15 @@ cdef extern from "khash_python.h":
int32_t *keys
size_t *vals
- inline kh_int32_t* kh_init_int32()
- inline void kh_destroy_int32(kh_int32_t*)
- inline void kh_clear_int32(kh_int32_t*)
- inline khint_t kh_get_int32(kh_int32_t*, int32_t)
- inline void kh_resize_int32(kh_int32_t*, khint_t)
- inline khint_t kh_put_int32(kh_int32_t*, int32_t, int*)
- inline void kh_del_int32(kh_int32_t*, khint_t)
+ inline kh_int32_t* kh_init_int32() nogil
+ inline void kh_destroy_int32(kh_int32_t*) nogil
+ inline void kh_clear_int32(kh_int32_t*) nogil
+ inline khint_t kh_get_int32(kh_int32_t*, int32_t) nogil
+ inline void kh_resize_int32(kh_int32_t*, khint_t) nogil
+ inline khint_t kh_put_int32(kh_int32_t*, int32_t, int*) nogil
+ inline void kh_del_int32(kh_int32_t*, khint_t) nogil
- bint kh_exist_int32(kh_int32_t*, khiter_t)
+ bint kh_exist_int32(kh_int32_t*, khiter_t) nogil
# sweep factorize
@@ -112,13 +112,12 @@ cdef extern from "khash_python.h":
kh_cstr_t *keys
PyObject **vals
- inline kh_strbox_t* kh_init_strbox()
- inline void kh_destroy_strbox(kh_strbox_t*)
- inline void kh_clear_strbox(kh_strbox_t*)
- inline khint_t kh_get_strbox(kh_strbox_t*, kh_cstr_t)
- inline void kh_resize_strbox(kh_strbox_t*, khint_t)
- inline khint_t kh_put_strbox(kh_strbox_t*, kh_cstr_t, int*)
- inline void kh_del_strbox(kh_strbox_t*, khint_t)
-
- bint kh_exist_strbox(kh_strbox_t*, khiter_t)
+ inline kh_strbox_t* kh_init_strbox() nogil
+ inline void kh_destroy_strbox(kh_strbox_t*) nogil
+ inline void kh_clear_strbox(kh_strbox_t*) nogil
+ inline khint_t kh_get_strbox(kh_strbox_t*, kh_cstr_t) nogil
+ inline void kh_resize_strbox(kh_strbox_t*, khint_t) nogil
+ inline khint_t kh_put_strbox(kh_strbox_t*, kh_cstr_t, int*) nogil
+ inline void kh_del_strbox(kh_strbox_t*, khint_t) nogil
+ bint kh_exist_strbox(kh_strbox_t*, khiter_t) nogil
diff --git a/pandas/util/testing.py b/pandas/util/testing.py
index 83d6b97788e91..f4d27932f1f3f 100644
--- a/pandas/util/testing.py
+++ b/pandas/util/testing.py
@@ -1817,3 +1817,36 @@ def use_numexpr(use, min_elements=expr._MIN_ELEMENTS):
for name, obj in inspect.getmembers(sys.modules[__name__]):
if inspect.isfunction(obj) and name.startswith('assert'):
setattr(TestCase, name, staticmethod(obj))
+
+def test_parallel(num_threads=2):
+ """Decorator to run the same function multiple times in parallel.
+
+ Parameters
+ ----------
+ num_threads : int, optional
+ The number of times the function is run in parallel.
+
+ Notes
+ -----
+ This decorator does not pass the return value of the decorated function.
+
+ Original from scikit-image: https://github.com/scikit-image/scikit-image/pull/1519
+
+ """
+
+ assert num_threads > 0
+ import threading
+
+ def wrapper(func):
+ @wraps(func)
+ def inner(*args, **kwargs):
+ threads = []
+ for i in range(num_threads):
+ thread = threading.Thread(target=func, args=args, kwargs=kwargs)
+ threads.append(thread)
+ for thread in threads:
+ thread.start()
+ for thread in threads:
+ thread.join()
+ return inner
+ return wrapper
diff --git a/vb_suite/gil.py b/vb_suite/gil.py
new file mode 100644
index 0000000000000..30f41bb3c738d
--- /dev/null
+++ b/vb_suite/gil.py
@@ -0,0 +1,98 @@
+from vbench.api import Benchmark
+from datetime import datetime
+
+common_setup = """from pandas_vb_common import *
+"""
+
+basic = common_setup + """
+from pandas.util.testing import test_parallel
+
+N = 1000000
+ngroups = 1000
+np.random.seed(1234)
+
+df = DataFrame({'key' : np.random.randint(0,ngroups,size=N),
+ 'data' : np.random.randn(N) })
+"""
+
+setup = basic + """
+
+def f():
+ df.groupby('key')['data'].sum()
+
+# run consecutivily
+def g2():
+ for i in range(2):
+ f()
+def g4():
+ for i in range(4):
+ f()
+def g8():
+ for i in range(8):
+ f()
+
+# run in parallel
+@test_parallel(num_threads=2)
+def pg2():
+ f()
+
+@test_parallel(num_threads=4)
+def pg4():
+ f()
+
+@test_parallel(num_threads=8)
+def pg8():
+ f()
+
+"""
+
+nogil_groupby_sum_4 = Benchmark(
+ 'pg4()', setup,
+ start_date=datetime(2015, 1, 1))
+
+nogil_groupby_sum_8 = Benchmark(
+ 'pg8()', setup,
+ start_date=datetime(2015, 1, 1))
+
+
+#### test all groupby funcs ####
+
+setup = basic + """
+
+@test_parallel(num_threads=2)
+def pg2():
+ df.groupby('key')['data'].func()
+
+"""
+
+for f in ['sum','prod','var','count','min','max','mean','last']:
+
+ name = "nogil_groupby_{f}_2".format(f=f)
+ bmark = Benchmark('pg2()', setup.replace('func',f), start_date=datetime(2015, 1, 1))
+ bmark.name = name
+ globals()[name] = bmark
+
+del bmark
+
+
+#### test take_1d ####
+setup = basic + """
+from pandas.core import common as com
+
+N = 1e7
+df = DataFrame({'int64' : np.arange(N,dtype='int64'),
+ 'float64' : np.arange(N,dtype='float64')})
+indexer = np.arange(100,len(df)-100)
+
+@test_parallel(num_threads=2)
+def take_1d_pg2_int64():
+ com.take_1d(df.int64.values,indexer)
+
+@test_parallel(num_threads=2)
+def take_1d_pg2_float64():
+ com.take_1d(df.float64.values,indexer)
+
+"""
+
+nogil_take1d_float64 = Benchmark('take_1d_pg2()_int64', setup, start_date=datetime(2015, 1, 1))
+nogil_take1d_int64 = Benchmark('take_1d_pg2()_float64', setup, start_date=datetime(2015, 1, 1))
diff --git a/vb_suite/suite.py b/vb_suite/suite.py
index a16d183ae62e2..ca7a4a9b70836 100644
--- a/vb_suite/suite.py
+++ b/vb_suite/suite.py
@@ -16,6 +16,7 @@
'inference',
'hdfstore_bench',
'join_merge',
+ 'gil',
'miscellaneous',
'panel_ctor',
'packers',
| closes #8882
closes #10139
This is now implemented for all groupbys with the factorization part as well (which is actually a big part fo the time)
```
In [2]: N = 1000000
In [3]: ngroups = 1000
In [4]: np.random.seed(1234)
In [5]: df = DataFrame({'key' : np.random.randint(0,ngroups,size=N),
...: 'data' : np.random.randn(N) })
```
```
def f():
df.groupby('key')['data'].sum()
# run consecutivily
def g2():
for i in range(2):
f()
def g4():
for i in range(4):
f()
def g8():
for i in range(8):
f()
# run in parallel
@test_parallel(num_threads=2)
def pg2():
f()
@test_parallel(num_threads=4)
def pg4():
f()
@test_parallel(num_threads=8)
def pg8():
f()
```
So seeing a nice curve as far as addtl cores are used (as compared to some of my previous posts).
```
In [19]: df
Out[19]:
after before speedup
2 27.3 52.1 1.908425
4 44.8 105.0 2.343750
8 83.2 213.0 2.560096
```
| https://api.github.com/repos/pandas-dev/pandas/pulls/10199 | 2015-05-22T20:19:47Z | 2015-06-30T10:55:04Z | 2015-06-30T10:55:03Z | 2015-06-30T16:58:13Z |
BUG: Raise TypeError only if key DataFrame is not empty #10126 | diff --git a/doc/source/whatsnew/v0.16.2.txt b/doc/source/whatsnew/v0.16.2.txt
index b571aab0b19a5..b409ea89a8032 100644
--- a/doc/source/whatsnew/v0.16.2.txt
+++ b/doc/source/whatsnew/v0.16.2.txt
@@ -83,3 +83,5 @@ Bug Fixes
- Bug where infer_freq infers timerule (WOM-5XXX) unsupported by to_offset (:issue:`9425`)
+
+- Bug to handle masking empty ``DataFrame``(:issue:`10126`)
diff --git a/pandas/core/frame.py b/pandas/core/frame.py
index f36108262432d..ab6f11a4b8d5b 100644
--- a/pandas/core/frame.py
+++ b/pandas/core/frame.py
@@ -2151,7 +2151,7 @@ def _setitem_array(self, key, value):
def _setitem_frame(self, key, value):
# support boolean setting with DataFrame input, e.g.
# df[df > df2] = 0
- if key.values.dtype != np.bool_:
+ if key.values.size and not com.is_bool_dtype(key.values):
raise TypeError('Must pass DataFrame with boolean values only')
self._check_inplace_setting(value)
diff --git a/pandas/tests/test_frame.py b/pandas/tests/test_frame.py
index 4964d13f7ac28..f74cb07557342 100644
--- a/pandas/tests/test_frame.py
+++ b/pandas/tests/test_frame.py
@@ -794,6 +794,19 @@ def test_setitem_empty(self):
result.loc[result.b.isnull(), 'a'] = result.a
assert_frame_equal(result, df)
+ def test_setitem_empty_frame_with_boolean(self):
+ # Test for issue #10126
+
+ for dtype in ('float', 'int64'):
+ for df in [
+ pd.DataFrame(dtype=dtype),
+ pd.DataFrame(dtype=dtype, index=[1]),
+ pd.DataFrame(dtype=dtype, columns=['A']),
+ ]:
+ df2 = df.copy()
+ df[df > df2] = 47
+ assert_frame_equal(df, df2)
+
def test_delitem_corner(self):
f = self.frame.copy()
del f['D']
@@ -2821,7 +2834,7 @@ def custom_frame_function(self):
data = {'col1': range(10),
'col2': range(10)}
cdf = CustomDataFrame(data)
-
+
# Did we get back our own DF class?
self.assertTrue(isinstance(cdf, CustomDataFrame))
@@ -2833,7 +2846,7 @@ def custom_frame_function(self):
# Do we get back our own DF class after slicing row-wise?
cdf_rows = cdf[1:5]
self.assertTrue(isinstance(cdf_rows, CustomDataFrame))
- self.assertEqual(cdf_rows.custom_frame_function(), 'OK')
+ self.assertEqual(cdf_rows.custom_frame_function(), 'OK')
# Make sure sliced part of multi-index frame is custom class
mcol = pd.MultiIndex.from_tuples([('A', 'A'), ('A', 'B')])
| Proposed fix for #10126
| https://api.github.com/repos/pandas-dev/pandas/pulls/10196 | 2015-05-22T10:46:45Z | 2015-06-03T19:02:45Z | 2015-06-03T19:02:45Z | 2015-06-04T11:17:25Z |
BUG: Check for size != 0 before trying to insert #10193 | diff --git a/pandas/core/generic.py b/pandas/core/generic.py
index b747f0a2ceacb..0deef1b7cd3b7 100644
--- a/pandas/core/generic.py
+++ b/pandas/core/generic.py
@@ -1286,23 +1286,25 @@ def _check_setitem_copy(self, stacklevel=4, t='setting', force=False):
elif t == 'referant':
t = ("\n"
"A value is trying to be set on a copy of a slice from a "
- "DataFrame\n\n"
+ "{name}\n\n"
"See the the caveats in the documentation: "
"http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy")
else:
t = ("\n"
"A value is trying to be set on a copy of a slice from a "
- "DataFrame.\n"
+ "{name}.\n"
"Try using .loc[row_indexer,col_indexer] = value instead\n\n"
"See the the caveats in the documentation: "
"http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy")
+ t = t.format(name=type(self).__name__)
+
if value == 'raise':
raise SettingWithCopyError(t)
elif value == 'warn':
warnings.warn(t, SettingWithCopyWarning, stacklevel=stacklevel)
-
+
def __delitem__(self, key):
"""
Delete item
diff --git a/pandas/core/series.py b/pandas/core/series.py
index 8ef9adb1d24a4..23b75bd1a95f3 100644
--- a/pandas/core/series.py
+++ b/pandas/core/series.py
@@ -562,7 +562,10 @@ def _get_with(self, key):
# other: fancy integer or otherwise
if isinstance(key, slice):
indexer = self.index._convert_slice_indexer(key, kind='getitem')
- return self._get_values(indexer)
+ values = self._get_values(indexer)
+ is_copy = values._is_view
+ values._set_is_copy(self, copy=is_copy)
+ return values
elif isinstance(key, ABCDataFrame):
raise TypeError('Indexing a Series with DataFrame is not supported, '\
'use the appropriate DataFrame column')
@@ -684,6 +687,7 @@ def setitem(key, value):
# do the setitem
cacher_needs_updating = self._check_is_chained_assignment_possible()
setitem(key, value)
+ self._check_setitem_copy()
if cacher_needs_updating:
self._maybe_update_cacher()
diff --git a/pandas/tests/test_series.py b/pandas/tests/test_series.py
index 925cfa875196c..2fbc072fe8f68 100644
--- a/pandas/tests/test_series.py
+++ b/pandas/tests/test_series.py
@@ -569,7 +569,6 @@ def setUp(self):
self.ts = _ts.copy()
self.ts.name = 'ts'
-
self.series = tm.makeStringSeries()
self.series.name = 'series'
@@ -1360,11 +1359,12 @@ def test_slice(self):
self.assertTrue(tm.equalContents(numSliceEnd,
np.array(self.series)[-10:]))
-
- # test return view
- sl = self.series[10:20]
- sl[:] = 0
- self.assertTrue((self.series[10:20] == 0).all())
+ # After fix for #10193, this is needed
+ with pd.option_context('chained_assignment', 'warn'):
+ # test return view
+ sl = self.series[10:20]
+ sl[:] = 0
+ self.assertTrue((self.series[10:20] == 0).all())
def test_slice_can_reorder_not_uniquely_indexed(self):
s = Series(1, index=['a', 'a', 'b', 'b', 'c'])
@@ -1439,6 +1439,36 @@ def test_setitem(self):
expected = self.series.append(Series([1],index=['foobar']))
assert_series_equal(s,expected)
+ # Test for issue #10193
+ key = datetime(2012, 1, 1)
+ series = pd.Series()
+ series[key] = 47
+ expected = pd.Series(47, [key])
+ assert_series_equal(series, expected)
+
+ test_values = [
+ (pd.date_range('2011-01-01', '2011-01-01'), datetime(2012, 1, 1)),
+ (pd.Int64Index([1, 2, 3]), 5)
+ ]
+ for idx, key in test_values:
+
+ series = pd.Series(0, idx)
+ series2 = series[:0]
+
+ def f():
+ series2[key] = 47
+
+ expected = pd.Series(47, [key])
+
+ with pd.option_context('chained_assignment', 'raise'):
+ self.assertRaises(com.SettingWithCopyError, f)
+
+ with pd.option_context('chained_assignment', 'warn'):
+ f()
+ assert_series_equal(series2, expected)
+ # also check that original series remains unchanged.
+ assert_series_equal(series, pd.Series(0, idx))
+
def test_setitem_dtypes(self):
# change dtypes
@@ -4271,15 +4301,14 @@ def test_underlying_data_conversion(self):
# GH 3970
# these are chained assignments as well
- pd.set_option('chained_assignment',None)
- df = DataFrame({ "aa":range(5), "bb":[2.2]*5})
- df["cc"] = 0.0
- ck = [True]*len(df)
- df["bb"].iloc[0] = .13
- df_tmp = df.iloc[ck]
- df["bb"].iloc[0] = .15
- self.assertEqual(df['bb'].iloc[0], 0.15)
- pd.set_option('chained_assignment','raise')
+ with pd.option_context('chained_assignment',None):
+ df = DataFrame({ "aa":range(5), "bb":[2.2]*5})
+ df["cc"] = 0.0
+ ck = [True]*len(df)
+ df["bb"].iloc[0] = .13
+ df_tmp = df.iloc[ck]
+ df["bb"].iloc[0] = .15
+ self.assertEqual(df['bb'].iloc[0], 0.15)
# GH 3217
df = DataFrame(dict(a = [1,3], b = [np.nan, 2]))
@@ -4816,9 +4845,11 @@ def test_rank(self):
tm._skip_if_no_scipy()
from scipy.stats import rankdata
- self.ts[::2] = np.nan
- self.ts[:10][::3] = 4.
-
+ # After fix for #10193, this is needed
+ with pd.option_context('chained_assignment',None):
+ self.ts[::2] = np.nan
+ self.ts[:10][::3] = 4.
+
ranks = self.ts.rank()
oranks = self.ts.astype('O').rank()
diff --git a/pandas/tseries/index.py b/pandas/tseries/index.py
index bd0869b9525b7..f360503abb1a8 100644
--- a/pandas/tseries/index.py
+++ b/pandas/tseries/index.py
@@ -1521,7 +1521,7 @@ def insert(self, loc, item):
if zone != izone:
raise ValueError('Passed item and index have different timezone')
# check freq can be preserved on edge cases
- if self.freq is not None:
+ if self.size and self.freq is not None:
if (loc == 0 or loc == -len(self)) and item + self.freq == self[0]:
freq = self.freq
elif (loc == len(self)) and item - self.freq == self[-1]:
diff --git a/pandas/tseries/tests/test_period.py b/pandas/tseries/tests/test_period.py
index 0218af63ca7d6..e05ce1b9baaf4 100644
--- a/pandas/tseries/tests/test_period.py
+++ b/pandas/tseries/tests/test_period.py
@@ -1669,7 +1669,10 @@ def test_index_duplicate_periods(self):
result = ts[2007]
expected = ts[1:3]
assert_series_equal(result, expected)
- result[:] = 1
+ # After fix for #10193, this is necessary
+ with pd.option_context('chained_assignment',None):
+ result[:] = 1
+
self.assertTrue((ts[1:3] == 1).all())
# not monotonic
| Proposed fix for #10193
| https://api.github.com/repos/pandas-dev/pandas/pulls/10194 | 2015-05-22T09:59:41Z | 2015-06-18T12:56:00Z | null | 2015-06-18T12:56:00Z |
DOC/CLN: period_range kwarg descriptions missing and other minor doc … | diff --git a/pandas/core/groupby.py b/pandas/core/groupby.py
index 4b7d8b9796f01..ffc3e6a08221c 100644
--- a/pandas/core/groupby.py
+++ b/pandas/core/groupby.py
@@ -187,7 +187,7 @@ class Grouper(object):
Examples
--------
- >>> df.groupby(Grouper(key='A')) : syntatic sugar for df.groupby('A')
+ >>> df.groupby(Grouper(key='A')) : syntactic sugar for df.groupby('A')
>>> df.groupby(Grouper(key='date',freq='60s')) : specify a resample on the column 'date'
>>> df.groupby(Grouper(level='date',freq='60s',axis=1)) :
specify a resample on the level 'date' on the columns axis with a frequency of 60s
diff --git a/pandas/tseries/period.py b/pandas/tseries/period.py
index 98d9f9f14d3da..510887a185054 100644
--- a/pandas/tseries/period.py
+++ b/pandas/tseries/period.py
@@ -110,20 +110,20 @@ class PeriodIndex(DatetimeIndexOpsMixin, Int64Index):
Parameters
----------
- data : array-like (1-dimensional), optional
+ data : array-like (1-dimensional), optional
Optional period-like data to construct index with
dtype : NumPy dtype (default: i8)
- copy : bool
+ copy : bool
Make a copy of input ndarray
freq : string or period object, optional
One of pandas period strings or corresponding objects
start : starting value, period-like, optional
If data is None, used as the start point in generating regular
period data.
- periods : int, optional, > 0
+ periods : int, optional, > 0
Number of periods to generate, if generating index. Takes precedence
over end argument
- end : end value, period-like, optional
+ end : end value, period-like, optional
If periods is none, generated index will extend to first conforming
period on or just past end argument
year : int, array, or Series, default None
@@ -501,7 +501,6 @@ def shift(self, n):
----------
n : int
Periods to shift by
- freq : freq string
Returns
-------
@@ -970,8 +969,8 @@ def period_range(start=None, end=None, periods=None, freq='D', name=None):
Parameters
----------
- start :
- end :
+ start : starting value, period-like, optional
+ end : ending value, period-like, optional
periods : int, default None
Number of periods in the index
freq : str/DateOffset, default 'D'
| …fixes
| https://api.github.com/repos/pandas-dev/pandas/pulls/10189 | 2015-05-21T18:13:28Z | 2015-05-23T06:40:55Z | 2015-05-23T06:40:55Z | 2015-06-02T19:26:12Z |
BUG: Adding empty dataframes should result in empty blocks #10181 | diff --git a/doc/source/whatsnew/v0.16.2.txt b/doc/source/whatsnew/v0.16.2.txt
index 3665948d15271..48fce87f5088d 100644
--- a/doc/source/whatsnew/v0.16.2.txt
+++ b/doc/source/whatsnew/v0.16.2.txt
@@ -41,6 +41,8 @@ Other API Changes
- ``Holiday`` now raises ``NotImplementedError`` if both ``offset`` and ``observance`` are used in constructor instead of returning an incorrect result (:issue:`10217`).
+- Adding empty ``DataFrame``s results in a ``DataFrame`` that ``.equals`` an empty ``DataFrame`` (:issue:`10181`)
+
.. _whatsnew_0162.performance:
Performance Improvements
diff --git a/pandas/core/internals.py b/pandas/core/internals.py
index 3395ea360165e..8ff39f4fb0e06 100644
--- a/pandas/core/internals.py
+++ b/pandas/core/internals.py
@@ -3530,11 +3530,15 @@ def construction_error(tot_items, block_shape, axes, e=None):
def create_block_manager_from_blocks(blocks, axes):
try:
if len(blocks) == 1 and not isinstance(blocks[0], Block):
- # It's OK if a single block is passed as values, its placement is
- # basically "all items", but if there're many, don't bother
- # converting, it's an error anyway.
- blocks = [make_block(values=blocks[0],
- placement=slice(0, len(axes[0])))]
+ # if blocks[0] is of length 0, return empty blocks
+ if not len(blocks[0]):
+ blocks = []
+ else:
+ # It's OK if a single block is passed as values, its placement is
+ # basically "all items", but if there're many, don't bother
+ # converting, it's an error anyway.
+ blocks = [make_block(values=blocks[0],
+ placement=slice(0, len(axes[0])))]
mgr = BlockManager(blocks, axes)
mgr._consolidate_inplace()
diff --git a/pandas/tests/test_frame.py b/pandas/tests/test_frame.py
index f74cb07557342..a6fafb445925b 100644
--- a/pandas/tests/test_frame.py
+++ b/pandas/tests/test_frame.py
@@ -5142,6 +5142,17 @@ def test_operators(self):
df = DataFrame({'a': ['a', None, 'b']})
assert_frame_equal(df + df, DataFrame({'a': ['aa', np.nan, 'bb']}))
+ # Test for issue #10181
+ for dtype in ('float', 'int64'):
+ frames = [
+ DataFrame(dtype=dtype),
+ DataFrame(columns=['A'], dtype=dtype),
+ DataFrame(index=[0], dtype=dtype),
+ ]
+ for df in frames:
+ self.assertTrue((df + df).equals(df))
+ assert_frame_equal(df + df, df)
+
def test_ops_np_scalar(self):
vals, xs = np.random.rand(5, 3), [nan, 7, -23, 2.718, -3.14, np.inf]
f = lambda x: DataFrame(x, index=list('ABCDE'),
| Fixes #10181
I added a couple of lines to the dataframe test `test_operators` to assert that adding two empty dataframes returns a dataframe that is equal (both using `assert_frame_equal` as well as `.equals`) to an empty dataframe.
I couldn't get vbench to install (I am running on windows) - the error was:
```
c:\dev\code\opensource\pandas-rekcahpassyla>pip install git+https://github.com/pydata/vbench
You are using pip version 6.0.8, however version 6.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting git+https://github.com/pydata/vbench
Cloning https://github.com/pydata/vbench to c:\users\redacted\appdata\local\temp\pip-ruiahg-build
fatal: unable to connect to github.com:
github.com[0: 192.30.252.129]: errno=No error
Clone of 'git://github.com/yarikoptic/vbenchtest.git' into submodule path 'vbench/tests/vbenchtest/vbenchtest' failed
Complete output from command C:\dev\bin\git\cmd\git.exe submodule update --init --recursive -q:
----------------------------------------
Command "C:\dev\bin\git\cmd\git.exe submodule update --init --recursive -q" failed with error code 1 in c:\users\redacted\appdata\local\temp\pip-ruiahg-build
```
The test suite failed for me in master with 1 failure. The same failure, but no others, were observed when running in my branch.
| https://api.github.com/repos/pandas-dev/pandas/pulls/10188 | 2015-05-21T16:08:46Z | 2015-06-07T22:22:40Z | 2015-06-07T22:22:40Z | 2015-06-16T15:40:21Z |
DOC: Add Index.difference to API doc | diff --git a/doc/source/api.rst b/doc/source/api.rst
index 3f47c0380116c..3b2e8b65768bb 100644
--- a/doc/source/api.rst
+++ b/doc/source/api.rst
@@ -1262,8 +1262,6 @@ Modifying and Computations
Index.argmax
Index.copy
Index.delete
- Index.diff
- Index.sym_diff
Index.drop
Index.drop_duplicates
Index.duplicated
@@ -1309,15 +1307,17 @@ Time-specific operations
Index.shift
-Combining / joining / merging
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Combining / joining / set operations
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. autosummary::
:toctree: generated/
Index.append
- Index.intersection
Index.join
+ Index.intersection
Index.union
+ Index.difference
+ Index.sym_diff
Selecting
~~~~~~~~~
| Add `Index.difference` to api doc rather than deprecated `Index.diff` (#8226)
And is it OK to remove `Index.diff` alias because #6581 lists #8227 (which closes #8226)?
| https://api.github.com/repos/pandas-dev/pandas/pulls/10185 | 2015-05-21T13:51:22Z | 2015-05-23T06:41:18Z | 2015-05-23T06:41:18Z | 2015-06-02T19:26:12Z |
FIX printing index with display.max_seq_items=None (GH10182) | diff --git a/doc/source/whatsnew/v0.16.2.txt b/doc/source/whatsnew/v0.16.2.txt
index c219818a62631..ba7d1b80c7f8a 100644
--- a/doc/source/whatsnew/v0.16.2.txt
+++ b/doc/source/whatsnew/v0.16.2.txt
@@ -137,6 +137,7 @@ Bug Fixes
- Bug in ``Timestamp``'s' ``microsecond``, ``quarter``, ``dayofyear``, ``week`` and ``daysinmonth`` properties return ``np.int`` type, not built-in ``int``. (:issue:`10050`)
- Bug in ``NaT`` raises ``AttributeError`` when accessing to ``daysinmonth``, ``dayofweek`` properties. (:issue:`10096`)
+- Bug in Index repr when using the ``max_seq_items=None`` setting (:issue:`10182`).
- Bug in getting timezone data with ``dateutil`` on various platforms ( :issue:`9059`, :issue:`8639`, :issue:`9663`, :issue:`10121`)
- Bug in display datetimes with mixed frequencies uniformly; display 'ms' datetimes to the proper precision. (:issue:`10170`)
diff --git a/pandas/core/categorical.py b/pandas/core/categorical.py
index c5cd8390359dc..05886fb5a54d4 100644
--- a/pandas/core/categorical.py
+++ b/pandas/core/categorical.py
@@ -1599,6 +1599,20 @@ def describe(self):
return result
+ def repeat(self, repeats):
+ """
+ Repeat elements of a Categorical.
+
+ See also
+ --------
+ numpy.ndarray.repeat
+
+ """
+ codes = self._codes.repeat(repeats)
+ return Categorical(values=codes, categories=self.categories,
+ ordered=self.ordered, name=self.name, fastpath=True)
+
+
##### The Series.cat accessor #####
class CategoricalAccessor(PandasDelegate):
diff --git a/pandas/core/index.py b/pandas/core/index.py
index 1483ca9a47b46..c558f101df0a2 100644
--- a/pandas/core/index.py
+++ b/pandas/core/index.py
@@ -443,7 +443,7 @@ def _format_data(self):
n = len(self)
sep = ','
- max_seq_items = get_option('display.max_seq_items')
+ max_seq_items = get_option('display.max_seq_items') or n
formatter = self._formatter_func
# do we want to justify (only do so for non-objects)
@@ -534,7 +534,7 @@ def _format_attrs(self):
attrs.append(('dtype',"'%s'" % self.dtype))
if self.name is not None:
attrs.append(('name',default_pprint(self.name)))
- max_seq_items = get_option('display.max_seq_items')
+ max_seq_items = get_option('display.max_seq_items') or len(self)
if len(self) > max_seq_items:
attrs.append(('length',len(self)))
return attrs
@@ -2950,7 +2950,7 @@ def _format_attrs(self):
if self.name is not None:
attrs.append(('name',default_pprint(self.name)))
attrs.append(('dtype',"'%s'" % self.dtype))
- max_seq_items = get_option('display.max_seq_items')
+ max_seq_items = get_option('display.max_seq_items') or len(self)
if len(self) > max_seq_items:
attrs.append(('length',len(self)))
return attrs
diff --git a/pandas/tests/test_categorical.py b/pandas/tests/test_categorical.py
index bec688db99114..49efdff139925 100755
--- a/pandas/tests/test_categorical.py
+++ b/pandas/tests/test_categorical.py
@@ -2714,7 +2714,6 @@ def f():
df.append(df_wrong_categories)
self.assertRaises(ValueError, f)
-
def test_merge(self):
# GH 9426
@@ -2747,6 +2746,13 @@ def test_merge(self):
result = pd.merge(cleft, cright, how='left', left_on='b', right_on='c')
tm.assert_frame_equal(result, expected)
+ def test_repeat(self):
+ #GH10183
+ cat = pd.Categorical(["a","b"], categories=["a","b"])
+ exp = pd.Categorical(["a", "a", "b", "b"], categories=["a","b"])
+ res = cat.repeat(2)
+ self.assert_categorical_equal(res, exp)
+
def test_na_actions(self):
cat = pd.Categorical([1,2,3,np.nan], categories=[1,2,3])
diff --git a/pandas/tests/test_index.py b/pandas/tests/test_index.py
index ac071d6d39e57..f422c3b49b691 100644
--- a/pandas/tests/test_index.py
+++ b/pandas/tests/test_index.py
@@ -133,6 +133,14 @@ def test_str(self):
self.assertTrue("'foo'" in str(idx))
self.assertTrue(idx.__class__.__name__ in str(idx))
+ def test_repr_max_seq_item_setting(self):
+ # GH10182
+ idx = self.create_index()
+ idx = idx.repeat(50)
+ with pd.option_context("display.max_seq_items", None):
+ repr(idx)
+ self.assertFalse('...' in str(idx))
+
def test_wrong_number_names(self):
def testit(ind):
ind.names = ["apple", "banana", "carrot"]
@@ -2857,6 +2865,14 @@ def test_get_indexer(self):
with self.assertRaisesRegexp(ValueError, 'different freq'):
idx.asfreq('D').get_indexer(idx)
+ def test_repeat(self):
+ # GH10183
+ idx = pd.period_range('2000-01-01', periods=3, freq='D')
+ res = idx.repeat(3)
+ exp = PeriodIndex(idx.values.repeat(3), freq='D')
+ self.assert_index_equal(res, exp)
+ self.assertEqual(res.freqstr, 'D')
+
class TestTimedeltaIndex(DatetimeLike, tm.TestCase):
_holder = TimedeltaIndex
diff --git a/pandas/tseries/period.py b/pandas/tseries/period.py
index 6627047f0c335..95bbc5016237c 100644
--- a/pandas/tseries/period.py
+++ b/pandas/tseries/period.py
@@ -783,6 +783,17 @@ def append(self, other):
for x in to_concat]
return Index(com._concat_compat(to_concat), name=name)
+ def repeat(self, n):
+ """
+ Return a new Index of the values repeated n times.
+
+ See also
+ --------
+ numpy.ndarray.repeat
+ """
+ # overwrites method from DatetimeIndexOpsMixin
+ return self._shallow_copy(self.values.repeat(n))
+
def __setstate__(self, state):
"""Necessary for making this object picklable"""
| Fixes #10182
| https://api.github.com/repos/pandas-dev/pandas/pulls/10183 | 2015-05-21T11:20:38Z | 2015-06-10T06:47:12Z | 2015-06-10T06:47:12Z | 2015-06-10T06:47:12Z |
BUG: concat on axis=0 with categorical (GH10177) | diff --git a/doc/source/whatsnew/v0.17.0.txt b/doc/source/whatsnew/v0.17.0.txt
index 02ef2bbed19b6..14e185b5b2a26 100644
--- a/doc/source/whatsnew/v0.17.0.txt
+++ b/doc/source/whatsnew/v0.17.0.txt
@@ -103,4 +103,4 @@ Bug Fixes
- Bug that caused segfault when resampling an empty Series (:issue:`10228`)
- Bug in ``DatetimeIndex`` and ``PeriodIndex.value_counts`` resets name from its result, but retains in result's ``Index``. (:issue:`10150`)
-
+- Bug in `pandas.concat` with ``axis=0`` when column is of dtype ``category`` (:issue:`10177`)
diff --git a/pandas/core/internals.py b/pandas/core/internals.py
index 4c4d940f8077c..42d7163e7f741 100644
--- a/pandas/core/internals.py
+++ b/pandas/core/internals.py
@@ -4133,7 +4133,7 @@ def get_empty_dtype_and_na(join_units):
else:
return np.dtype(np.bool_), None
elif 'category' in upcast_classes:
- return com.CategoricalDtype(), np.nan
+ return np.dtype(np.object_), np.nan
elif 'float' in upcast_classes:
return np.dtype(np.float64), np.nan
elif 'datetime' in upcast_classes:
diff --git a/pandas/tests/test_categorical.py b/pandas/tests/test_categorical.py
index beff41fd9d109..63b913f59f18a 100755
--- a/pandas/tests/test_categorical.py
+++ b/pandas/tests/test_categorical.py
@@ -2967,6 +2967,24 @@ def test_pickle_v0_15_2(self):
#
self.assert_categorical_equal(cat, pd.read_pickle(pickle_path))
+ def test_concat_categorical(self):
+ # See GH 10177
+ df1 = pd.DataFrame(np.arange(18).reshape(6, 3), columns=["a", "b", "c"])
+
+ df2 = pd.DataFrame(np.arange(14).reshape(7, 2), columns=["a", "c"])
+ df2['h'] = pd.Series(pd.Categorical(["one", "one", "two", "one", "two", "two", "one"]))
+
+ df_concat = pd.concat((df1, df2), axis=0).reset_index(drop=True)
+
+ df_expected = pd.DataFrame({'a': [0, 3, 6, 9, 12, 15, 0, 2, 4, 6, 8, 10, 12],
+ 'b': [1, 4, 7, 10, 13, 16, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan],
+ 'c': [2, 5, 8, 11, 14, 17, 1, 3, 5, 7, 9, 11, 13]})
+ df_expected['h'] = pd.Series(pd.Categorical([None, None, None, None, None, None,
+ "one", "one", "two", "one", "two", "two", "one"]))
+
+ tm.assert_frame_equal(df_expected, df_concat)
+
+
if __name__ == '__main__':
import nose
| Contains a proposed fix for #10177
| https://api.github.com/repos/pandas-dev/pandas/pulls/10179 | 2015-05-20T15:34:57Z | 2015-06-27T22:04:22Z | 2015-06-27T22:04:22Z | 2015-06-27T22:04:27Z |
BUG: mean overflows for integer dtypes (fixes #10155) | diff --git a/doc/source/whatsnew/v0.17.0.txt b/doc/source/whatsnew/v0.17.0.txt
index 1cff74d41f686..6f04b0358394f 100644
--- a/doc/source/whatsnew/v0.17.0.txt
+++ b/doc/source/whatsnew/v0.17.0.txt
@@ -63,6 +63,7 @@ Bug Fixes
- Bug in ``Categorical`` repr with ``display.width`` of ``None`` in Python 3 (:issue:`10087`)
+- Bug in ``mean()`` where integer dtypes can overflow (:issue:`10172`)
- Bug where Panel.from_dict does not set dtype when specified (:issue:`10058`)
- Bug in ``Timestamp``'s' ``microsecond``, ``quarter``, ``dayofyear``, ``week`` and ``daysinmonth`` properties return ``np.int`` type, not built-in ``int``. (:issue:`10050`)
- Bug in ``NaT`` raises ``AttributeError`` when accessing to ``daysinmonth``, ``dayofweek`` properties. (:issue:`10096`)
diff --git a/pandas/core/nanops.py b/pandas/core/nanops.py
index e921a9d562bc1..0df160618b7c3 100644
--- a/pandas/core/nanops.py
+++ b/pandas/core/nanops.py
@@ -20,7 +20,7 @@
is_complex_dtype, is_integer_dtype,
is_bool_dtype, is_object_dtype,
is_datetime64_dtype, is_timedelta64_dtype,
- is_datetime_or_timedelta_dtype,
+ is_datetime_or_timedelta_dtype, _get_dtype,
is_int_or_datetime_dtype, is_any_int_dtype)
@@ -254,8 +254,16 @@ def nansum(values, axis=None, skipna=True):
@bottleneck_switch()
def nanmean(values, axis=None, skipna=True):
values, mask, dtype, dtype_max = _get_values(values, skipna, 0)
- the_sum = _ensure_numeric(values.sum(axis, dtype=dtype_max))
- count = _get_counts(mask, axis)
+
+ dtype_sum = dtype_max
+ dtype_count = np.float64
+ if is_integer_dtype(dtype):
+ dtype_sum = np.float64
+ elif is_float_dtype(dtype):
+ dtype_sum = dtype
+ dtype_count = dtype
+ count = _get_counts(mask, axis, dtype=dtype_count)
+ the_sum = _ensure_numeric(values.sum(axis, dtype=dtype_sum))
if axis is not None and getattr(the_sum, 'ndim', False):
the_mean = the_sum / count
@@ -557,15 +565,16 @@ def _maybe_arg_null_out(result, axis, mask, skipna):
return result
-def _get_counts(mask, axis):
+def _get_counts(mask, axis, dtype=float):
+ dtype = _get_dtype(dtype)
if axis is None:
- return float(mask.size - mask.sum())
+ return dtype.type(mask.size - mask.sum())
count = mask.shape[axis] - mask.sum(axis)
try:
- return count.astype(float)
+ return count.astype(dtype)
except AttributeError:
- return np.array(count, dtype=float)
+ return np.array(count, dtype=dtype)
def _maybe_null_out(result, axis, mask):
diff --git a/pandas/tests/test_nanops.py b/pandas/tests/test_nanops.py
index 2a605cba8a6c0..1adb8a5d9217c 100644
--- a/pandas/tests/test_nanops.py
+++ b/pandas/tests/test_nanops.py
@@ -5,7 +5,7 @@
import numpy as np
-from pandas.core.common import isnull
+from pandas.core.common import isnull, is_integer_dtype
import pandas.core.nanops as nanops
import pandas.util.testing as tm
@@ -323,6 +323,32 @@ def test_nanmean(self):
allow_complex=False, allow_obj=False,
allow_str=False, allow_date=False, allow_tdelta=True)
+ def test_nanmean_overflow(self):
+ # GH 10155
+ # In the previous implementation mean can overflow for int dtypes, it
+ # is now consistent with numpy
+ from pandas import Series
+
+ # numpy < 1.9.0 is not computing this correctly
+ from distutils.version import LooseVersion
+ if LooseVersion(np.__version__) >= '1.9.0':
+ for a in [2 ** 55, -2 ** 55, 20150515061816532]:
+ s = Series(a, index=range(500), dtype=np.int64)
+ result = s.mean()
+ np_result = s.values.mean()
+ self.assertEqual(result, a)
+ self.assertEqual(result, np_result)
+ self.assertTrue(result.dtype == np.float64)
+
+ # check returned dtype
+ for dtype in [np.int16, np.int32, np.int64, np.float16, np.float32, np.float64]:
+ s = Series(range(10), dtype=dtype)
+ result = s.mean()
+ if is_integer_dtype(dtype):
+ self.assertTrue(result.dtype == np.float64)
+ else:
+ self.assertTrue(result.dtype == dtype)
+
def test_nanmedian(self):
self.check_funs(nanops.nanmedian, np.median,
allow_complex=False, allow_str=False, allow_date=False,
| closes #10155
| https://api.github.com/repos/pandas-dev/pandas/pulls/10172 | 2015-05-19T16:43:57Z | 2015-05-30T20:41:19Z | 2015-05-30T20:41:19Z | 2015-06-02T19:26:12Z |
BUG: consistent datetime display format with < ms #10170 | diff --git a/doc/source/whatsnew/v0.17.0.txt b/doc/source/whatsnew/v0.17.0.txt
index b835733db6f00..82589a5500505 100644
--- a/doc/source/whatsnew/v0.17.0.txt
+++ b/doc/source/whatsnew/v0.17.0.txt
@@ -68,7 +68,7 @@ Bug Fixes
- Bug in ``NaT`` raises ``AttributeError`` when accessing to ``daysinmonth``, ``dayofweek`` properties. (:issue:`10096`)
- Bug in getting timezone data with ``dateutil`` on various platforms ( :issue:`9059`, :issue:`8639`, :issue:`9663`, :issue:`10121`)
-
+- Bug in display datetimes with mixed frequencies uniformly; display 'ms' datetimes to the proper precision. (:issue:`10170`)
- Bug in ``DatetimeIndex`` and ``TimedeltaIndex`` names are lost after timedelta arithmetics ( :issue:`9926`)
diff --git a/pandas/tests/test_format.py b/pandas/tests/test_format.py
index fd9d9546ba235..a7129bca59a7f 100644
--- a/pandas/tests/test_format.py
+++ b/pandas/tests/test_format.py
@@ -14,7 +14,7 @@
from numpy.random import randn
import numpy as np
-from pandas import DataFrame, Series, Index, Timestamp, MultiIndex
+from pandas import DataFrame, Series, Index, Timestamp, MultiIndex, date_range, NaT
import pandas.core.format as fmt
import pandas.util.testing as tm
@@ -2495,7 +2495,7 @@ def test_to_string(self):
def test_freq_name_separation(self):
s = Series(np.random.randn(10),
- index=pd.date_range('1/1/2000', periods=10), name=0)
+ index=date_range('1/1/2000', periods=10), name=0)
result = repr(s)
self.assertTrue('Freq: D, Name: 0' in result)
@@ -2556,7 +2556,6 @@ def test_float_trim_zeros(self):
def test_datetimeindex(self):
- from pandas import date_range, NaT
index = date_range('20130102',periods=6)
s = Series(1,index=index)
result = s.to_string()
@@ -2574,7 +2573,6 @@ def test_datetimeindex(self):
def test_timedelta64(self):
- from pandas import date_range
from datetime import datetime, timedelta
Series(np.array([1100, 20], dtype='timedelta64[ns]')).to_string()
@@ -3179,6 +3177,44 @@ def test_date_nanos(self):
result = fmt.Datetime64Formatter(x).get_result()
self.assertEqual(result[0].strip(), "1970-01-01 00:00:00.000000200")
+ def test_dates_display(self):
+
+ # 10170
+ # make sure that we are consistently display date formatting
+ x = Series(date_range('20130101 09:00:00',periods=5,freq='D'))
+ x.iloc[1] = np.nan
+ result = fmt.Datetime64Formatter(x).get_result()
+ self.assertEqual(result[0].strip(), "2013-01-01 09:00:00")
+ self.assertEqual(result[1].strip(), "NaT")
+ self.assertEqual(result[4].strip(), "2013-01-05 09:00:00")
+
+ x = Series(date_range('20130101 09:00:00',periods=5,freq='s'))
+ x.iloc[1] = np.nan
+ result = fmt.Datetime64Formatter(x).get_result()
+ self.assertEqual(result[0].strip(), "2013-01-01 09:00:00")
+ self.assertEqual(result[1].strip(), "NaT")
+ self.assertEqual(result[4].strip(), "2013-01-01 09:00:04")
+
+ x = Series(date_range('20130101 09:00:00',periods=5,freq='ms'))
+ x.iloc[1] = np.nan
+ result = fmt.Datetime64Formatter(x).get_result()
+ self.assertEqual(result[0].strip(), "2013-01-01 09:00:00.000")
+ self.assertEqual(result[1].strip(), "NaT")
+ self.assertEqual(result[4].strip(), "2013-01-01 09:00:00.004")
+
+ x = Series(date_range('20130101 09:00:00',periods=5,freq='us'))
+ x.iloc[1] = np.nan
+ result = fmt.Datetime64Formatter(x).get_result()
+ self.assertEqual(result[0].strip(), "2013-01-01 09:00:00.000000")
+ self.assertEqual(result[1].strip(), "NaT")
+ self.assertEqual(result[4].strip(), "2013-01-01 09:00:00.000004")
+
+ x = Series(date_range('20130101 09:00:00',periods=5,freq='N'))
+ x.iloc[1] = np.nan
+ result = fmt.Datetime64Formatter(x).get_result()
+ self.assertEqual(result[0].strip(), "2013-01-01 09:00:00.000000000")
+ self.assertEqual(result[1].strip(), "NaT")
+ self.assertEqual(result[4].strip(), "2013-01-01 09:00:00.000000004")
class TestNaTFormatting(tm.TestCase):
def test_repr(self):
diff --git a/pandas/tseries/tests/test_timeseries.py b/pandas/tseries/tests/test_timeseries.py
index 6c20b02324688..8412ba8d4aad1 100644
--- a/pandas/tseries/tests/test_timeseries.py
+++ b/pandas/tseries/tests/test_timeseries.py
@@ -791,7 +791,7 @@ def test_series_repr_nat(self):
series = Series([0, 1000, 2000, iNaT], dtype='M8[ns]')
result = repr(series)
- expected = ('0 1970-01-01 00:00:00\n'
+ expected = ('0 1970-01-01 00:00:00.000000\n'
'1 1970-01-01 00:00:00.000001\n'
'2 1970-01-01 00:00:00.000002\n'
'3 NaT\n'
diff --git a/pandas/tslib.pyx b/pandas/tslib.pyx
index 2b45718d1f9ea..59eb432844ee3 100644
--- a/pandas/tslib.pyx
+++ b/pandas/tslib.pyx
@@ -1418,6 +1418,8 @@ def format_array_from_datetime(ndarray[int64_t] values, object tz=None, object f
"""
cdef:
int64_t val, ns, N = len(values)
+ ndarray[int64_t] consider_values
+ bint show_ms = 0, show_us = 0, show_ns = 0, basic_format = 0
ndarray[object] result = np.empty(N, dtype=object)
object ts, res
pandas_datetimestruct dts
@@ -1425,13 +1427,27 @@ def format_array_from_datetime(ndarray[int64_t] values, object tz=None, object f
if na_rep is None:
na_rep = 'NaT'
+ # if we don't have a format nor tz, then choose
+ # a format based on precision
+ basic_format = format is None and tz is None
+ if basic_format:
+ consider_values = values[values != iNaT]
+ show_ns = (consider_values%1000).any()
+
+ if not show_ns:
+ consider_values //= 1000
+ show_us = (consider_values%1000).any()
+
+ if not show_ms:
+ consider_values //= 1000
+ show_ms = (consider_values%1000).any()
+
for i in range(N):
- val = values[i]
+ val = values[i]
- if val == iNaT:
- result[i] = na_rep
- else:
- if format is None and tz is None:
+ if val == iNaT:
+ result[i] = na_rep
+ elif basic_format:
pandas_datetime_to_datetimestruct(val, PANDAS_FR_ns, &dts)
res = '%d-%.2d-%.2d %.2d:%.2d:%.2d' % (dts.year,
@@ -1441,27 +1457,29 @@ def format_array_from_datetime(ndarray[int64_t] values, object tz=None, object f
dts.min,
dts.sec)
- ns = dts.ps / 1000
-
- if ns != 0:
- res += '.%.9d' % (ns + 1000 * dts.us)
- elif dts.us != 0:
- res += '.%.6d' % dts.us
+ if show_ns:
+ ns = dts.ps / 1000
+ res += '.%.9d' % (ns + 1000 * dts.us)
+ elif show_us:
+ res += '.%.6d' % dts.us
+ elif show_ms:
+ res += '.%.3d' % (dts.us/1000)
result[i] = res
- else:
- ts = Timestamp(val, tz=tz)
- if format is None:
- result[i] = str(ts)
- else:
-
- # invalid format string
- # requires dates > 1900
- try:
- result[i] = ts.strftime(format)
- except ValueError:
- result[i] = str(ts)
+ else:
+
+ ts = Timestamp(val, tz=tz)
+ if format is None:
+ result[i] = str(ts)
+ else:
+
+ # invalid format string
+ # requires dates > 1900
+ try:
+ result[i] = ts.strftime(format)
+ except ValueError:
+ result[i] = str(ts)
return result
| closes #10170
```
In [3]: Series(date_range('20130101 09:00:00',periods=5,freq='D'))
Out[3]:
0 2013-01-01 09:00:00
1 2013-01-02 09:00:00
2 2013-01-03 09:00:00
3 2013-01-04 09:00:00
4 2013-01-05 09:00:00
dtype: datetime64[ns]
In [4]: Series(date_range('20130101 09:00:00',periods=5,freq='s'))
Out[4]:
0 2013-01-01 09:00:00
1 2013-01-01 09:00:01
2 2013-01-01 09:00:02
3 2013-01-01 09:00:03
4 2013-01-01 09:00:04
dtype: datetime64[ns]
In [2]: s = Series(date_range('20130101 09:00:00',periods=5,freq='ms'))
In [3]: s.iloc[1] = np.nan
In [4]: s
Out[4]:
0 2013-01-01 09:00:00.000
1 NaT
2 2013-01-01 09:00:00.002
3 2013-01-01 09:00:00.003
4 2013-01-01 09:00:00.004
dtype: datetime64[ns]
In [6]: Series(date_range('20130101 09:00:00',periods=5,freq='us'))
Out[6]:
0 2013-01-01 09:00:00.000000
1 2013-01-01 09:00:00.000001
2 2013-01-01 09:00:00.000002
3 2013-01-01 09:00:00.000003
4 2013-01-01 09:00:00.000004
dtype: datetime64[ns]
In [7]: Series(date_range('20130101 09:00:00',periods=5,freq='N'))
Out[7]:
0 2013-01-01 09:00:00.000000000
1 2013-01-01 09:00:00.000000001
2 2013-01-01 09:00:00.000000002
3 2013-01-01 09:00:00.000000003
4 2013-01-01 09:00:00.000000004
dtype: datetime64[ns]
```
| https://api.github.com/repos/pandas-dev/pandas/pulls/10171 | 2015-05-19T15:46:04Z | 2015-05-20T22:02:19Z | 2015-05-20T22:02:19Z | 2015-06-02T19:26:12Z |
Delete ez_setup.py | diff --git a/doc/source/install.rst b/doc/source/install.rst
index 476c188faf0cf..31fee45eb0266 100644
--- a/doc/source/install.rst
+++ b/doc/source/install.rst
@@ -212,6 +212,7 @@ installed), make sure you have `nose
Dependencies
------------
+* `setuptools <http://pythonhosted.org/setuptools>`__
* `NumPy <http://www.numpy.org>`__: 1.7.0 or higher
* `python-dateutil <http://labix.org/python-dateutil>`__ 1.5 or higher
* `pytz <http://pytz.sourceforge.net/>`__
diff --git a/ez_setup.py b/ez_setup.py
deleted file mode 100644
index 6f63b856f06c9..0000000000000
--- a/ez_setup.py
+++ /dev/null
@@ -1,264 +0,0 @@
-#!python
-"""Bootstrap setuptools installation
-
-If you want to use setuptools in your package's setup.py, just include this
-file in the same directory with it, and add this to the top of your setup.py::
-
- from ez_setup import use_setuptools
- use_setuptools()
-
-If you want to require a specific version of setuptools, set a download
-mirror, or use an alternate download directory, you can do so by supplying
-the appropriate options to ``use_setuptools()``.
-
-This file can also be run as a script to install or upgrade setuptools.
-"""
-from __future__ import print_function
-import sys
-DEFAULT_VERSION = "0.6c11"
-DEFAULT_URL = "http://pypi.python.org/packages/%s/s/setuptools/" % sys.version[
- :3]
-
-md5_data = {
- 'setuptools-0.6b1-py2.3.egg': '8822caf901250d848b996b7f25c6e6ca',
- 'setuptools-0.6b1-py2.4.egg': 'b79a8a403e4502fbb85ee3f1941735cb',
- 'setuptools-0.6b2-py2.3.egg': '5657759d8a6d8fc44070a9d07272d99b',
- 'setuptools-0.6b2-py2.4.egg': '4996a8d169d2be661fa32a6e52e4f82a',
- 'setuptools-0.6b3-py2.3.egg': 'bb31c0fc7399a63579975cad9f5a0618',
- 'setuptools-0.6b3-py2.4.egg': '38a8c6b3d6ecd22247f179f7da669fac',
- 'setuptools-0.6b4-py2.3.egg': '62045a24ed4e1ebc77fe039aa4e6f7e5',
- 'setuptools-0.6b4-py2.4.egg': '4cb2a185d228dacffb2d17f103b3b1c4',
- 'setuptools-0.6c1-py2.3.egg': 'b3f2b5539d65cb7f74ad79127f1a908c',
- 'setuptools-0.6c1-py2.4.egg': 'b45adeda0667d2d2ffe14009364f2a4b',
- 'setuptools-0.6c10-py2.3.egg': 'ce1e2ab5d3a0256456d9fc13800a7090',
- 'setuptools-0.6c10-py2.4.egg': '57d6d9d6e9b80772c59a53a8433a5dd4',
- 'setuptools-0.6c10-py2.5.egg': 'de46ac8b1c97c895572e5e8596aeb8c7',
- 'setuptools-0.6c10-py2.6.egg': '58ea40aef06da02ce641495523a0b7f5',
- 'setuptools-0.6c11-py2.3.egg': '2baeac6e13d414a9d28e7ba5b5a596de',
- 'setuptools-0.6c11-py2.4.egg': 'bd639f9b0eac4c42497034dec2ec0c2b',
- 'setuptools-0.6c11-py2.5.egg': '64c94f3bf7a72a13ec83e0b24f2749b2',
- 'setuptools-0.6c11-py2.6.egg': 'bfa92100bd772d5a213eedd356d64086',
- 'setuptools-0.6c2-py2.3.egg': 'f0064bf6aa2b7d0f3ba0b43f20817c27',
- 'setuptools-0.6c2-py2.4.egg': '616192eec35f47e8ea16cd6a122b7277',
- 'setuptools-0.6c3-py2.3.egg': 'f181fa125dfe85a259c9cd6f1d7b78fa',
- 'setuptools-0.6c3-py2.4.egg': 'e0ed74682c998bfb73bf803a50e7b71e',
- 'setuptools-0.6c3-py2.5.egg': 'abef16fdd61955514841c7c6bd98965e',
- 'setuptools-0.6c4-py2.3.egg': 'b0b9131acab32022bfac7f44c5d7971f',
- 'setuptools-0.6c4-py2.4.egg': '2a1f9656d4fbf3c97bf946c0a124e6e2',
- 'setuptools-0.6c4-py2.5.egg': '8f5a052e32cdb9c72bcf4b5526f28afc',
- 'setuptools-0.6c5-py2.3.egg': 'ee9fd80965da04f2f3e6b3576e9d8167',
- 'setuptools-0.6c5-py2.4.egg': 'afe2adf1c01701ee841761f5bcd8aa64',
- 'setuptools-0.6c5-py2.5.egg': 'a8d3f61494ccaa8714dfed37bccd3d5d',
- 'setuptools-0.6c6-py2.3.egg': '35686b78116a668847237b69d549ec20',
- 'setuptools-0.6c6-py2.4.egg': '3c56af57be3225019260a644430065ab',
- 'setuptools-0.6c6-py2.5.egg': 'b2f8a7520709a5b34f80946de5f02f53',
- 'setuptools-0.6c7-py2.3.egg': '209fdf9adc3a615e5115b725658e13e2',
- 'setuptools-0.6c7-py2.4.egg': '5a8f954807d46a0fb67cf1f26c55a82e',
- 'setuptools-0.6c7-py2.5.egg': '45d2ad28f9750e7434111fde831e8372',
- 'setuptools-0.6c8-py2.3.egg': '50759d29b349db8cfd807ba8303f1902',
- 'setuptools-0.6c8-py2.4.egg': 'cba38d74f7d483c06e9daa6070cce6de',
- 'setuptools-0.6c8-py2.5.egg': '1721747ee329dc150590a58b3e1ac95b',
- 'setuptools-0.6c9-py2.3.egg': 'a83c4020414807b496e4cfbe08507c03',
- 'setuptools-0.6c9-py2.4.egg': '260a2be2e5388d66bdaee06abec6342a',
- 'setuptools-0.6c9-py2.5.egg': 'fe67c3e5a17b12c0e7c541b7ea43a8e6',
- 'setuptools-0.6c9-py2.6.egg': 'ca37b1ff16fa2ede6e19383e7b59245a',
-}
-
-import sys
-import os
-try:
- from hashlib import md5
-except ImportError:
- from md5 import md5
-
-
-def _validate_md5(egg_name, data):
- if egg_name in md5_data:
- digest = md5(data).hexdigest()
- if digest != md5_data[egg_name]:
- print((
- "md5 validation of %s failed! (Possible download problem?)"
- % egg_name
- ), file=sys.stderr)
- sys.exit(2)
- return data
-
-
-def use_setuptools(
- version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
- download_delay=15
-):
- """Automatically find/download setuptools and make it available on sys.path
-
- `version` should be a valid setuptools version number that is available
- as an egg for download under the `download_base` URL (which should end with
- a '/'). `to_dir` is the directory where setuptools will be downloaded, if
- it is not already available. If `download_delay` is specified, it should
- be the number of seconds that will be paused before initiating a download,
- should one be required. If an older version of setuptools is installed,
- this routine will print a message to ``sys.stderr`` and raise SystemExit in
- an attempt to abort the calling script.
- """
- was_imported = 'pkg_resources' in sys.modules or 'setuptools' in sys.modules
-
- def do_download():
- egg = download_setuptools(
- version, download_base, to_dir, download_delay)
- sys.path.insert(0, egg)
- import setuptools
- setuptools.bootstrap_install_from = egg
- try:
- import pkg_resources
- except ImportError:
- return do_download()
- try:
- pkg_resources.require("setuptools>=" + version)
- return
- except pkg_resources.VersionConflict as e:
- if was_imported:
- print((
- "The required version of setuptools (>=%s) is not available, and\n"
- "can't be installed while this script is running. Please install\n"
- " a more recent version first, using 'easy_install -U setuptools'."
- "\n\n(Currently using %r)"
- ) % (version, e.args[0]), file=sys.stderr)
- sys.exit(2)
- else:
- del pkg_resources, sys.modules['pkg_resources'] # reload ok
- return do_download()
- except pkg_resources.DistributionNotFound:
- return do_download()
-
-
-def download_setuptools(
- version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
- delay=15
-):
- """Download setuptools from a specified location and return its filename
-
- `version` should be a valid setuptools version number that is available
- as an egg for download under the `download_base` URL (which should end
- with a '/'). `to_dir` is the directory where the egg will be downloaded.
- `delay` is the number of seconds to pause before an actual download attempt.
- """
- import urllib2
- import shutil
- egg_name = "setuptools-%s-py%s.egg" % (version, sys.version[:3])
- url = download_base + egg_name
- saveto = os.path.join(to_dir, egg_name)
- src = dst = None
- if not os.path.exists(saveto): # Avoid repeated downloads
- try:
- from distutils import log
- if delay:
- log.warn("""
----------------------------------------------------------------------------
-This script requires setuptools version %s to run (even to display
-help). I will attempt to download it for you (from
-%s), but
-you may need to enable firewall access for this script first.
-I will start the download in %d seconds.
-
-(Note: if this machine does not have network access, please obtain the file
-
- %s
-
-and place it in this directory before rerunning this script.)
----------------------------------------------------------------------------""",
- version, download_base, delay, url
- )
- from time import sleep
- sleep(delay)
- log.warn("Downloading %s", url)
- src = urllib2.urlopen(url)
- # Read/write all in one block, so we don't create a corrupt file
- # if the download is interrupted.
- data = _validate_md5(egg_name, src.read())
- dst = open(saveto, "wb")
- dst.write(data)
- finally:
- if src:
- src.close()
- if dst:
- dst.close()
- return os.path.realpath(saveto)
-
-
-def main(argv, version=DEFAULT_VERSION):
- """Install or upgrade setuptools and EasyInstall"""
- try:
- import setuptools
- except ImportError:
- egg = None
- try:
- egg = download_setuptools(version, delay=0)
- sys.path.insert(0, egg)
- from setuptools.command.easy_install import main
- return main(list(argv) + [egg]) # we're done here
- finally:
- if egg and os.path.exists(egg):
- os.unlink(egg)
- else:
- if setuptools.__version__ == '0.0.1':
- print((
- "You have an obsolete version of setuptools installed. Please\n"
- "remove it from your system entirely before rerunning this script."
- ), file=sys.stderr)
- sys.exit(2)
-
- req = "setuptools>=" + version
- import pkg_resources
- try:
- pkg_resources.require(req)
- except pkg_resources.VersionConflict:
- try:
- from setuptools.command.easy_install import main
- except ImportError:
- from easy_install import main
- main(list(argv) + [download_setuptools(delay=0)])
- sys.exit(0) # try to force an exit
- else:
- if argv:
- from setuptools.command.easy_install import main
- main(argv)
- else:
- print("Setuptools version", version, "or greater has been installed.")
- print('(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)')
-
-
-def update_md5(filenames):
- """Update our built-in md5 registry"""
-
- import re
-
- for name in filenames:
- base = os.path.basename(name)
- f = open(name, 'rb')
- md5_data[base] = md5(f.read()).hexdigest()
- f.close()
-
- data = sorted([" %r: %r,\n" % it for it in md5_data.items()])
- repl = "".join(data)
-
- import inspect
- srcfile = inspect.getsourcefile(sys.modules[__name__])
- f = open(srcfile, 'rb')
- src = f.read()
- f.close()
-
- match = re.search("\nmd5_data = {\n([^}]+)}", src)
- if not match:
- print("Internal error!", file=sys.stderr)
- sys.exit(2)
-
- src = src[:match.start(1)] + repl + src[match.end(1):]
- f = open(srcfile, 'w')
- f.write(src)
- f.close()
-
-
-if __name__ == '__main__':
- if len(sys.argv) > 2 and sys.argv[1] == '--md5update':
- update_md5(sys.argv[2:])
- else:
- main(sys.argv[1:])
diff --git a/setup.py b/setup.py
index 30c5d1052d9b3..06c473ed9900d 100755
--- a/setup.py
+++ b/setup.py
@@ -27,14 +27,8 @@
except ImportError:
_CYTHON_INSTALLED = False
-# try bootstrapping setuptools if it doesn't exist
try:
import pkg_resources
- try:
- pkg_resources.require("setuptools>=0.6c5")
- except pkg_resources.VersionConflict:
- from ez_setup import use_setuptools
- use_setuptools(version="0.6c5")
from setuptools import setup, Command
_have_setuptools = True
except ImportError:
| ez_setup.py is few years out of date, we should stop distributing it.
Up to date versions of Python 2 and 3 provide setuptools and pip out of the box `python -m ensurepip --upgrade`. For other Python versions, we can simply point users to the up to date instructions at https://packaging.python.org/en/latest/installing.html#requirements-for-installing-packages.
| https://api.github.com/repos/pandas-dev/pandas/pulls/10168 | 2015-05-19T06:42:07Z | 2015-08-02T17:03:33Z | null | 2015-08-02T17:03:33Z |
DOC: Reorder arguments in shared fillna docstring | diff --git a/pandas/core/generic.py b/pandas/core/generic.py
index a560dd4c00be7..b747f0a2ceacb 100644
--- a/pandas/core/generic.py
+++ b/pandas/core/generic.py
@@ -2398,15 +2398,15 @@ def convert_objects(self, convert_dates=True, convert_numeric=False,
Parameters
----------
- method : {'backfill', 'bfill', 'pad', 'ffill', None}, default None
- Method to use for filling holes in reindexed Series
- pad / ffill: propagate last valid observation forward to next valid
- backfill / bfill: use NEXT valid observation to fill gap
value : scalar, dict, Series, or DataFrame
Value to use to fill holes (e.g. 0), alternately a dict/Series/DataFrame of
values specifying which value to use for each index (for a Series) or
column (for a DataFrame). (values not in the dict/Series/DataFrame will not be
filled). This value cannot be a list.
+ method : {'backfill', 'bfill', 'pad', 'ffill', None}, default None
+ Method to use for filling holes in reindexed Series
+ pad / ffill: propagate last valid observation forward to next valid
+ backfill / bfill: use NEXT valid observation to fill gap
axis : %(axes_single_arg)s
inplace : boolean, default False
If True, fill in place. Note: this will modify any
| The docstring listed 'method' before 'value' which is not consistent
with the order of the arguments when calling the method.
| https://api.github.com/repos/pandas-dev/pandas/pulls/10166 | 2015-05-18T19:43:07Z | 2015-05-18T20:30:57Z | 2015-05-18T20:30:57Z | 2015-05-18T20:31:00Z |
DOC: clarify purpose of DataFrame.from_csv (GH4191) | diff --git a/pandas/core/frame.py b/pandas/core/frame.py
index d8948bc82fe61..654d6c7fd3436 100644
--- a/pandas/core/frame.py
+++ b/pandas/core/frame.py
@@ -180,7 +180,6 @@ class DataFrame(NDFrame):
--------
DataFrame.from_records : constructor from tuples, also record arrays
DataFrame.from_dict : from dicts of Series, arrays, or dicts
- DataFrame.from_csv : from CSV files
DataFrame.from_items : from sequence of (key, value) pairs
pandas.read_csv, pandas.read_table, pandas.read_clipboard
"""
@@ -1052,13 +1051,29 @@ def from_csv(cls, path, header=0, sep=',', index_col=0,
parse_dates=True, encoding=None, tupleize_cols=False,
infer_datetime_format=False):
"""
- Read delimited file into DataFrame
+ Read CSV file (DISCOURAGED, please use :func:`pandas.read_csv` instead).
+
+ It is preferable to use the more powerful :func:`pandas.read_csv`
+ for most general purposes, but ``from_csv`` makes for an easy
+ roundtrip to and from a file (the exact counterpart of
+ ``to_csv``), especially with a DataFrame of time series data.
+
+ This method only differs from the preferred :func:`pandas.read_csv`
+ in some defaults:
+
+ - `index_col` is ``0`` instead of ``None`` (take first column as index
+ by default)
+ - `parse_dates` is ``True`` instead of ``False`` (try parsing the index
+ as datetime by default)
+
+ So a ``pd.DataFrame.from_csv(path)`` can be replaced by
+ ``pd.read_csv(path, index_col=0, parse_dates=True)``.
Parameters
----------
path : string file path or file handle / StringIO
header : int, default 0
- Row to use at header (skip prior rows)
+ Row to use as header (skip prior rows)
sep : string, default ','
Field delimiter
index_col : int or sequence, default 0
@@ -1074,15 +1089,14 @@ def from_csv(cls, path, header=0, sep=',', index_col=0,
datetime format based on the first datetime string. If the format
can be inferred, there often will be a large parsing speed-up.
- Notes
- -----
- Preferable to use read_table for most general purposes but from_csv
- makes for an easy roundtrip to and from file, especially with a
- DataFrame of time series data
+ See also
+ --------
+ pandas.read_csv
Returns
-------
y : DataFrame
+
"""
from pandas.io.parsers import read_table
return read_table(path, header=header, sep=sep,
diff --git a/pandas/core/series.py b/pandas/core/series.py
index 6586fa10935e6..0aaa142533950 100644
--- a/pandas/core/series.py
+++ b/pandas/core/series.py
@@ -2313,7 +2313,24 @@ def between(self, left, right, inclusive=True):
def from_csv(cls, path, sep=',', parse_dates=True, header=None,
index_col=0, encoding=None, infer_datetime_format=False):
"""
- Read delimited file into Series
+ Read CSV file (DISCOURAGED, please use :func:`pandas.read_csv` instead).
+
+ It is preferable to use the more powerful :func:`pandas.read_csv`
+ for most general purposes, but ``from_csv`` makes for an easy
+ roundtrip to and from a file (the exact counterpart of
+ ``to_csv``), especially with a time Series.
+
+ This method only differs from :func:`pandas.read_csv` in some defaults:
+
+ - `index_col` is ``0`` instead of ``None`` (take first column as index
+ by default)
+ - `header` is ``None`` instead of ``0`` (the first row is not used as
+ the column names)
+ - `parse_dates` is ``True`` instead of ``False`` (try parsing the index
+ as datetime by default)
+
+ With :func:`pandas.read_csv`, the option ``squeeze=True`` can be used
+ to return a Series like ``from_csv``.
Parameters
----------
@@ -2322,8 +2339,8 @@ def from_csv(cls, path, sep=',', parse_dates=True, header=None,
Field delimiter
parse_dates : boolean, default True
Parse dates. Different default from read_table
- header : int, default 0
- Row to use at header (skip prior rows)
+ header : int, default None
+ Row to use as header (skip prior rows)
index_col : int or sequence, default 0
Column to use for index. If a sequence is given, a MultiIndex
is used. Different default from read_table
@@ -2335,6 +2352,10 @@ def from_csv(cls, path, sep=',', parse_dates=True, header=None,
datetime format based on the first datetime string. If the format
can be inferred, there often will be a large parsing speed-up.
+ See also
+ --------
+ pandas.read_csv
+
Returns
-------
y : Series
| Closes #9556
xref #9568, #4916, #4191
However, while writing this up, I started to doubt a bit if this is necessary.
`DataFrame.from_csv` is implemented as a round-trip method together with `to_csv`. If you use a plain `df.to_csv(path)`, you cannnot read it in as `pd.read_csv(path)` to get exactly the same. You at least need `pd.read_csv(path, index_col=True)` and a `parse_dates` keyword if you have datetimes.
Secondly, there is also the question of `Series.from_csv`. It would be logical to deprecate this as well, but for this you don't directly have an alternative (but `pd.read_csv(path, index_col=0)[0]` will work). There is also for example this SO answer of Wes: http://stackoverflow.com/questions/13557559/how-to-write-read-pandas-series-to-from-csv (and it is used in the Python for Data Analysis book).
| https://api.github.com/repos/pandas-dev/pandas/pulls/10163 | 2015-05-18T13:29:40Z | 2015-08-21T07:33:31Z | 2015-08-21T07:33:31Z | 2015-08-21T07:33:31Z |
BUG: Index.name is lost during timedelta ops | diff --git a/doc/source/whatsnew/v0.17.0.txt b/doc/source/whatsnew/v0.17.0.txt
index 2a4a408643451..8f72a8f1240d6 100644
--- a/doc/source/whatsnew/v0.17.0.txt
+++ b/doc/source/whatsnew/v0.17.0.txt
@@ -67,3 +67,7 @@ Bug Fixes
- Bug in ``NaT`` raises ``AttributeError`` when accessing to ``daysinmonth``, ``dayofweek`` properties. (:issue:`10096`)
- Bug in getting timezone data with ``dateutil`` on various platforms ( :issue:`9059`, :issue:`8639`, :issue:`9663`, :issue:`10121`)
+
+
+
+- Bug in ``DatetimeIndex`` and ``TimedeltaIndex`` names are lost after timedelta arithmetics ( :issue:`9926`)
diff --git a/pandas/core/common.py b/pandas/core/common.py
index 3c92300d1f9a5..1c9326c047a79 100644
--- a/pandas/core/common.py
+++ b/pandas/core/common.py
@@ -3322,10 +3322,17 @@ def save(obj, path): # TODO remove in 0.13
def _maybe_match_name(a, b):
- a_name = getattr(a, 'name', None)
- b_name = getattr(b, 'name', None)
- if a_name == b_name:
- return a_name
+ a_has = hasattr(a, 'name')
+ b_has = hasattr(b, 'name')
+ if a_has and b_has:
+ if a.name == b.name:
+ return a.name
+ else:
+ return None
+ elif a_has:
+ return a.name
+ elif b_has:
+ return b.name
return None
def _random_state(state=None):
diff --git a/pandas/tests/test_common.py b/pandas/tests/test_common.py
index 3282a36bda7b8..c3d39fcdf906f 100644
--- a/pandas/tests/test_common.py
+++ b/pandas/tests/test_common.py
@@ -545,6 +545,27 @@ def test_random_state():
com._random_state(5.5)
+def test_maybe_match_name():
+
+ matched = com._maybe_match_name(Series([1], name='x'), Series([2], name='x'))
+ assert(matched == 'x')
+
+ matched = com._maybe_match_name(Series([1], name='x'), Series([2], name='y'))
+ assert(matched is None)
+
+ matched = com._maybe_match_name(Series([1]), Series([2], name='x'))
+ assert(matched is None)
+
+ matched = com._maybe_match_name(Series([1], name='x'), Series([2]))
+ assert(matched is None)
+
+ matched = com._maybe_match_name(Series([1], name='x'), [2])
+ assert(matched == 'x')
+
+ matched = com._maybe_match_name([1], Series([2], name='y'))
+ assert(matched == 'y')
+
+
class TestTake(tm.TestCase):
# standard incompatible fill error
fill_error = re.compile("Incompatible type for fill_value")
diff --git a/pandas/tseries/index.py b/pandas/tseries/index.py
index f3803a04baf01..bd0869b9525b7 100644
--- a/pandas/tseries/index.py
+++ b/pandas/tseries/index.py
@@ -653,14 +653,18 @@ def _sub_datelike(self, other):
def _add_delta(self, delta):
from pandas import TimedeltaIndex
+ name = self.name
+
if isinstance(delta, (Tick, timedelta, np.timedelta64)):
new_values = self._add_delta_td(delta)
elif isinstance(delta, TimedeltaIndex):
new_values = self._add_delta_tdi(delta)
+ # update name when delta is Index
+ name = com._maybe_match_name(self, delta)
else:
new_values = self.astype('O') + delta
tz = 'UTC' if self.tz is not None else None
- result = DatetimeIndex(new_values, tz=tz, freq='infer')
+ result = DatetimeIndex(new_values, tz=tz, name=name, freq='infer')
utc = _utc()
if self.tz is not None and self.tz is not utc:
result = result.tz_convert(self.tz)
diff --git a/pandas/tseries/tdi.py b/pandas/tseries/tdi.py
index fd97ca4c45fc0..1443c22909689 100644
--- a/pandas/tseries/tdi.py
+++ b/pandas/tseries/tdi.py
@@ -281,12 +281,15 @@ def __setstate__(self, state):
def _add_delta(self, delta):
if isinstance(delta, (Tick, timedelta, np.timedelta64)):
new_values = self._add_delta_td(delta)
+ name = self.name
elif isinstance(delta, TimedeltaIndex):
new_values = self._add_delta_tdi(delta)
+ # update name when delta is index
+ name = com._maybe_match_name(self, delta)
else:
raise ValueError("cannot add the type {0} to a TimedeltaIndex".format(type(delta)))
- result = TimedeltaIndex(new_values, freq='infer')
+ result = TimedeltaIndex(new_values, freq='infer', name=name)
return result
def _evaluate_with_timedelta_like(self, other, op, opstr):
diff --git a/pandas/tseries/tests/test_base.py b/pandas/tseries/tests/test_base.py
index d1b986e7a7a1c..55482401a20f4 100644
--- a/pandas/tseries/tests/test_base.py
+++ b/pandas/tseries/tests/test_base.py
@@ -634,27 +634,27 @@ def test_dti_dti_deprecated_ops(self):
def test_dti_tdi_numeric_ops(self):
# These are normally union/diff set-like ops
- tdi = TimedeltaIndex(['1 days',pd.NaT,'2 days'], name='foo')
- dti = date_range('20130101',periods=3, name='bar')
+ tdi = TimedeltaIndex(['1 days', pd.NaT, '2 days'], name='foo')
+ dti = date_range('20130101', periods=3, name='bar')
td = Timedelta('1 days')
dt = Timestamp('20130101')
result = tdi - tdi
expected = TimedeltaIndex(['0 days', pd.NaT, '0 days'], name='foo')
- tm.assert_index_equal(result, expected, check_names=False) # must be foo
+ tm.assert_index_equal(result, expected)
result = tdi + tdi
expected = TimedeltaIndex(['2 days', pd.NaT, '4 days'], name='foo')
- tm.assert_index_equal(result, expected, check_names=False) # must be foo
+ tm.assert_index_equal(result, expected)
- result = dti - tdi
+ result = dti - tdi # name will be reset
expected = DatetimeIndex(['20121231', pd.NaT, '20130101'])
tm.assert_index_equal(result, expected)
def test_addition_ops(self):
# with datetimes/timedelta and tdi/dti
- tdi = TimedeltaIndex(['1 days',pd.NaT,'2 days'], name='foo')
+ tdi = TimedeltaIndex(['1 days', pd.NaT, '2 days'], name='foo')
dti = date_range('20130101', periods=3, name='bar')
td = Timedelta('1 days')
dt = Timestamp('20130101')
@@ -669,11 +669,11 @@ def test_addition_ops(self):
result = td + tdi
expected = TimedeltaIndex(['2 days', pd.NaT, '3 days'], name='foo')
- tm.assert_index_equal(result, expected, check_names=False) # must be foo
+ tm.assert_index_equal(result, expected)
result = tdi + td
expected = TimedeltaIndex(['2 days', pd.NaT, '3 days'], name='foo')
- tm.assert_index_equal(result,expected, check_names=False) # must be foo
+ tm.assert_index_equal(result, expected)
# unequal length
self.assertRaises(ValueError, lambda : tdi + dti[0:1])
@@ -685,21 +685,21 @@ def test_addition_ops(self):
# this is a union!
#self.assertRaises(TypeError, lambda : Int64Index([1,2,3]) + tdi)
- result = tdi + dti
+ result = tdi + dti # name will be reset
expected = DatetimeIndex(['20130102', pd.NaT, '20130105'])
- tm.assert_index_equal(result,expected)
+ tm.assert_index_equal(result, expected)
- result = dti + tdi
- expected = DatetimeIndex(['20130102',pd.NaT,'20130105'])
- tm.assert_index_equal(result,expected)
+ result = dti + tdi # name will be reset
+ expected = DatetimeIndex(['20130102', pd.NaT, '20130105'])
+ tm.assert_index_equal(result, expected)
result = dt + td
expected = Timestamp('20130102')
- self.assertEqual(result,expected)
+ self.assertEqual(result, expected)
result = td + dt
expected = Timestamp('20130102')
- self.assertEqual(result,expected)
+ self.assertEqual(result, expected)
def test_value_counts_unique(self):
# GH 7735
| Closes #9926.
CC @hsperr I've changed `common._maybe_match_names` to work with not-named objects, and hopefully can use in #9965 also.
| https://api.github.com/repos/pandas-dev/pandas/pulls/10158 | 2015-05-16T21:31:49Z | 2015-05-18T11:59:45Z | 2015-05-18T11:59:45Z | 2015-06-02T19:26:12Z |
BUG: Index.union cannot handle array-likes | diff --git a/doc/source/whatsnew/v0.17.0.txt b/doc/source/whatsnew/v0.17.0.txt
index dae1342c3cd76..bebce2d3e2d87 100644
--- a/doc/source/whatsnew/v0.17.0.txt
+++ b/doc/source/whatsnew/v0.17.0.txt
@@ -67,6 +67,7 @@ Bug Fixes
- Bug in ``mean()`` where integer dtypes can overflow (:issue:`10172`)
- Bug where Panel.from_dict does not set dtype when specified (:issue:`10058`)
+- Bug in ``Index.union`` raises ``AttributeError`` when passing array-likes. (:issue:`10149`)
- Bug in ``Timestamp``'s' ``microsecond``, ``quarter``, ``dayofyear``, ``week`` and ``daysinmonth`` properties return ``np.int`` type, not built-in ``int``. (:issue:`10050`)
- Bug in ``NaT`` raises ``AttributeError`` when accessing to ``daysinmonth``, ``dayofweek`` properties. (:issue:`10096`)
@@ -91,3 +92,4 @@ Bug Fixes
- Bug where infer_freq infers timerule (WOM-5XXX) unsupported by to_offset (:issue:`9425`)
+
diff --git a/pandas/core/index.py b/pandas/core/index.py
index de30fee4009f4..2bd96fcec2e42 100644
--- a/pandas/core/index.py
+++ b/pandas/core/index.py
@@ -580,8 +580,18 @@ def to_datetime(self, dayfirst=False):
return DatetimeIndex(self.values)
def _assert_can_do_setop(self, other):
+ if not com.is_list_like(other):
+ raise TypeError('Input must be Index or array-like')
return True
+ def _convert_can_do_setop(self, other):
+ if not isinstance(other, Index):
+ other = Index(other, name=self.name)
+ result_name = self.name
+ else:
+ result_name = self.name if self.name == other.name else None
+ return other, result_name
+
@property
def nlevels(self):
return 1
@@ -1364,16 +1374,14 @@ def union(self, other):
-------
union : Index
"""
- if not hasattr(other, '__iter__'):
- raise TypeError('Input must be iterable.')
+ self._assert_can_do_setop(other)
+ other = _ensure_index(other)
if len(other) == 0 or self.equals(other):
return self
if len(self) == 0:
- return _ensure_index(other)
-
- self._assert_can_do_setop(other)
+ return other
if not is_dtype_equal(self.dtype,other.dtype):
this = self.astype('O')
@@ -1439,11 +1447,7 @@ def intersection(self, other):
-------
intersection : Index
"""
- if not hasattr(other, '__iter__'):
- raise TypeError('Input must be iterable!')
-
self._assert_can_do_setop(other)
-
other = _ensure_index(other)
if self.equals(other):
@@ -1492,18 +1496,12 @@ def difference(self, other):
>>> index.difference(index2)
"""
-
- if not hasattr(other, '__iter__'):
- raise TypeError('Input must be iterable!')
+ self._assert_can_do_setop(other)
if self.equals(other):
return Index([], name=self.name)
- if not isinstance(other, Index):
- other = np.asarray(other)
- result_name = self.name
- else:
- result_name = self.name if self.name == other.name else None
+ other, result_name = self._convert_can_do_setop(other)
theDiff = sorted(set(self) - set(other))
return Index(theDiff, name=result_name)
@@ -1517,7 +1515,7 @@ def sym_diff(self, other, result_name=None):
Parameters
----------
- other : array-like
+ other : Index or array-like
result_name : str
Returns
@@ -1545,13 +1543,10 @@ def sym_diff(self, other, result_name=None):
>>> idx1 ^ idx2
Int64Index([1, 5], dtype='int64')
"""
- if not hasattr(other, '__iter__'):
- raise TypeError('Input must be iterable!')
-
- if not isinstance(other, Index):
- other = Index(other)
- result_name = result_name or self.name
-
+ self._assert_can_do_setop(other)
+ other, result_name_update = self._convert_can_do_setop(other)
+ if result_name is None:
+ result_name = result_name_update
the_diff = sorted(set((self.difference(other)).union(other.difference(self))))
return Index(the_diff, name=result_name)
@@ -5460,12 +5455,11 @@ def union(self, other):
>>> index.union(index2)
"""
self._assert_can_do_setop(other)
+ other, result_names = self._convert_can_do_setop(other)
if len(other) == 0 or self.equals(other):
return self
- result_names = self.names if self.names == other.names else None
-
uniq_tuples = lib.fast_unique_multiple([self.values, other.values])
return MultiIndex.from_arrays(lzip(*uniq_tuples), sortorder=0,
names=result_names)
@@ -5483,12 +5477,11 @@ def intersection(self, other):
Index
"""
self._assert_can_do_setop(other)
+ other, result_names = self._convert_can_do_setop(other)
if self.equals(other):
return self
- result_names = self.names if self.names == other.names else None
-
self_tuples = self.values
other_tuples = other.values
uniq_tuples = sorted(set(self_tuples) & set(other_tuples))
@@ -5509,18 +5502,10 @@ def difference(self, other):
diff : MultiIndex
"""
self._assert_can_do_setop(other)
+ other, result_names = self._convert_can_do_setop(other)
- if not isinstance(other, MultiIndex):
- if len(other) == 0:
+ if len(other) == 0:
return self
- try:
- other = MultiIndex.from_tuples(other)
- except:
- raise TypeError('other must be a MultiIndex or a list of'
- ' tuples')
- result_names = self.names
- else:
- result_names = self.names if self.names == other.names else None
if self.equals(other):
return MultiIndex(levels=[[]] * self.nlevels,
@@ -5537,15 +5522,30 @@ def difference(self, other):
return MultiIndex.from_tuples(difference, sortorder=0,
names=result_names)
- def _assert_can_do_setop(self, other):
- pass
-
def astype(self, dtype):
if not is_object_dtype(np.dtype(dtype)):
raise TypeError('Setting %s dtype to anything other than object '
'is not supported' % self.__class__)
return self._shallow_copy()
+ def _convert_can_do_setop(self, other):
+ result_names = self.names
+
+ if not hasattr(other, 'names'):
+ if len(other) == 0:
+ other = MultiIndex(levels=[[]] * self.nlevels,
+ labels=[[]] * self.nlevels,
+ verify_integrity=False)
+ else:
+ msg = 'other must be a MultiIndex or a list of tuples'
+ try:
+ other = MultiIndex.from_tuples(other)
+ except:
+ raise TypeError(msg)
+ else:
+ result_names = self.names if self.names == other.names else None
+ return other, result_names
+
def insert(self, loc, item):
"""
Make new MultiIndex inserting new item at location
diff --git a/pandas/tests/test_index.py b/pandas/tests/test_index.py
index 93299292cf353..ed84c9764dd84 100644
--- a/pandas/tests/test_index.py
+++ b/pandas/tests/test_index.py
@@ -251,6 +251,136 @@ def test_take(self):
expected = ind[indexer]
self.assertTrue(result.equals(expected))
+ def test_setops_errorcases(self):
+ for name, idx in compat.iteritems(self.indices):
+ # # non-iterable input
+ cases = [0.5, 'xxx']
+ methods = [idx.intersection, idx.union, idx.difference, idx.sym_diff]
+
+ for method in methods:
+ for case in cases:
+ assertRaisesRegexp(TypeError,
+ "Input must be Index or array-like",
+ method, case)
+
+ def test_intersection_base(self):
+ for name, idx in compat.iteritems(self.indices):
+ first = idx[:5]
+ second = idx[:3]
+ intersect = first.intersection(second)
+
+ if isinstance(idx, CategoricalIndex):
+ pass
+ else:
+ self.assertTrue(tm.equalContents(intersect, second))
+
+ # GH 10149
+ cases = [klass(second.values) for klass in [np.array, Series, list]]
+ for case in cases:
+ if isinstance(idx, PeriodIndex):
+ msg = "can only call with other PeriodIndex-ed objects"
+ with tm.assertRaisesRegexp(ValueError, msg):
+ result = first.intersection(case)
+ elif isinstance(idx, CategoricalIndex):
+ pass
+ else:
+ result = first.intersection(case)
+ self.assertTrue(tm.equalContents(result, second))
+
+ if isinstance(idx, MultiIndex):
+ msg = "other must be a MultiIndex or a list of tuples"
+ with tm.assertRaisesRegexp(TypeError, msg):
+ result = first.intersection([1, 2, 3])
+
+ def test_union_base(self):
+ for name, idx in compat.iteritems(self.indices):
+ first = idx[3:]
+ second = idx[:5]
+ everything = idx
+ union = first.union(second)
+ self.assertTrue(tm.equalContents(union, everything))
+
+ # GH 10149
+ cases = [klass(second.values) for klass in [np.array, Series, list]]
+ for case in cases:
+ if isinstance(idx, PeriodIndex):
+ msg = "can only call with other PeriodIndex-ed objects"
+ with tm.assertRaisesRegexp(ValueError, msg):
+ result = first.union(case)
+ elif isinstance(idx, CategoricalIndex):
+ pass
+ else:
+ result = first.union(case)
+ self.assertTrue(tm.equalContents(result, everything))
+
+ if isinstance(idx, MultiIndex):
+ msg = "other must be a MultiIndex or a list of tuples"
+ with tm.assertRaisesRegexp(TypeError, msg):
+ result = first.union([1, 2, 3])
+
+ def test_difference_base(self):
+ for name, idx in compat.iteritems(self.indices):
+ first = idx[2:]
+ second = idx[:4]
+ answer = idx[4:]
+ result = first.difference(second)
+
+ if isinstance(idx, CategoricalIndex):
+ pass
+ else:
+ self.assertTrue(tm.equalContents(result, answer))
+
+ # GH 10149
+ cases = [klass(second.values) for klass in [np.array, Series, list]]
+ for case in cases:
+ if isinstance(idx, PeriodIndex):
+ msg = "can only call with other PeriodIndex-ed objects"
+ with tm.assertRaisesRegexp(ValueError, msg):
+ result = first.difference(case)
+ elif isinstance(idx, CategoricalIndex):
+ pass
+ elif isinstance(idx, (DatetimeIndex, TimedeltaIndex)):
+ self.assertEqual(result.__class__, answer.__class__)
+ self.assert_numpy_array_equal(result.asi8, answer.asi8)
+ else:
+ result = first.difference(case)
+ self.assertTrue(tm.equalContents(result, answer))
+
+ if isinstance(idx, MultiIndex):
+ msg = "other must be a MultiIndex or a list of tuples"
+ with tm.assertRaisesRegexp(TypeError, msg):
+ result = first.difference([1, 2, 3])
+
+ def test_symmetric_diff(self):
+ for name, idx in compat.iteritems(self.indices):
+ first = idx[1:]
+ second = idx[:-1]
+ if isinstance(idx, CategoricalIndex):
+ pass
+ else:
+ answer = idx[[0, -1]]
+ result = first.sym_diff(second)
+ self.assertTrue(tm.equalContents(result, answer))
+
+ # GH 10149
+ cases = [klass(second.values) for klass in [np.array, Series, list]]
+ for case in cases:
+ if isinstance(idx, PeriodIndex):
+ msg = "can only call with other PeriodIndex-ed objects"
+ with tm.assertRaisesRegexp(ValueError, msg):
+ result = first.sym_diff(case)
+ elif isinstance(idx, CategoricalIndex):
+ pass
+ else:
+ result = first.sym_diff(case)
+ self.assertTrue(tm.equalContents(result, answer))
+
+ if isinstance(idx, MultiIndex):
+ msg = "other must be a MultiIndex or a list of tuples"
+ with tm.assertRaisesRegexp(TypeError, msg):
+ result = first.sym_diff([1, 2, 3])
+
+
class TestIndex(Base, tm.TestCase):
_holder = Index
_multiprocess_can_split_ = True
@@ -620,16 +750,12 @@ def test_intersection(self):
first = self.strIndex[:20]
second = self.strIndex[:10]
intersect = first.intersection(second)
-
self.assertTrue(tm.equalContents(intersect, second))
# Corner cases
inter = first.intersection(first)
self.assertIs(inter, first)
- # non-iterable input
- assertRaisesRegexp(TypeError, "iterable", first.intersection, 0.5)
-
idx1 = Index([1, 2, 3, 4, 5], name='idx')
# if target has the same name, it is preserved
idx2 = Index([3, 4, 5, 6, 7], name='idx')
@@ -671,6 +797,12 @@ def test_union(self):
union = first.union(second)
self.assertTrue(tm.equalContents(union, everything))
+ # GH 10149
+ cases = [klass(second.values) for klass in [np.array, Series, list]]
+ for case in cases:
+ result = first.union(case)
+ self.assertTrue(tm.equalContents(result, everything))
+
# Corner cases
union = first.union(first)
self.assertIs(union, first)
@@ -681,9 +813,6 @@ def test_union(self):
union = Index([]).union(first)
self.assertIs(union, first)
- # non-iterable input
- assertRaisesRegexp(TypeError, "iterable", first.union, 0.5)
-
# preserve names
first.name = 'A'
second.name = 'A'
@@ -792,11 +921,7 @@ def test_difference(self):
self.assertEqual(len(result), 0)
self.assertEqual(result.name, first.name)
- # non-iterable input
- assertRaisesRegexp(TypeError, "iterable", first.difference, 0.5)
-
def test_symmetric_diff(self):
-
# smoke
idx1 = Index([1, 2, 3, 4], name='idx1')
idx2 = Index([2, 3, 4, 5])
@@ -842,10 +967,6 @@ def test_symmetric_diff(self):
self.assertTrue(tm.equalContents(result, expected))
self.assertEqual(result.name, 'new_name')
- # other isn't iterable
- with tm.assertRaises(TypeError):
- Index(idx1,dtype='object').difference(1)
-
def test_is_numeric(self):
self.assertFalse(self.dateIndex.is_numeric())
self.assertFalse(self.strIndex.is_numeric())
@@ -1786,6 +1907,7 @@ def test_equals(self):
self.assertFalse(CategoricalIndex(list('aabca') + [np.nan],categories=['c','a','b',np.nan]).equals(list('aabca')))
self.assertTrue(CategoricalIndex(list('aabca') + [np.nan],categories=['c','a','b',np.nan]).equals(list('aabca') + [np.nan]))
+
class Numeric(Base):
def test_numeric_compat(self):
@@ -2661,6 +2783,36 @@ def test_time_overflow_for_32bit_machines(self):
idx2 = pd.date_range(end='2000', periods=periods, freq='S')
self.assertEqual(len(idx2), periods)
+ def test_intersection(self):
+ first = self.index
+ second = self.index[5:]
+ intersect = first.intersection(second)
+ self.assertTrue(tm.equalContents(intersect, second))
+
+ # GH 10149
+ cases = [klass(second.values) for klass in [np.array, Series, list]]
+ for case in cases:
+ result = first.intersection(case)
+ self.assertTrue(tm.equalContents(result, second))
+
+ third = Index(['a', 'b', 'c'])
+ result = first.intersection(third)
+ expected = pd.Index([], dtype=object)
+ self.assert_index_equal(result, expected)
+
+ def test_union(self):
+ first = self.index[:5]
+ second = self.index[5:]
+ everything = self.index
+ union = first.union(second)
+ self.assertTrue(tm.equalContents(union, everything))
+
+ # GH 10149
+ cases = [klass(second.values) for klass in [np.array, Series, list]]
+ for case in cases:
+ result = first.union(case)
+ self.assertTrue(tm.equalContents(result, everything))
+
class TestPeriodIndex(DatetimeLike, tm.TestCase):
_holder = PeriodIndex
@@ -2671,7 +2823,7 @@ def setUp(self):
self.setup_indices()
def create_index(self):
- return period_range('20130101',periods=5,freq='D')
+ return period_range('20130101', periods=5, freq='D')
def test_pickle_compat_construction(self):
pass
diff --git a/pandas/tseries/index.py b/pandas/tseries/index.py
index bd0869b9525b7..745c536914e47 100644
--- a/pandas/tseries/index.py
+++ b/pandas/tseries/index.py
@@ -804,6 +804,7 @@ def union(self, other):
-------
y : Index or DatetimeIndex
"""
+ self._assert_can_do_setop(other)
if not isinstance(other, DatetimeIndex):
try:
other = DatetimeIndex(other)
@@ -1039,6 +1040,7 @@ def intersection(self, other):
-------
y : Index or DatetimeIndex
"""
+ self._assert_can_do_setop(other)
if not isinstance(other, DatetimeIndex):
try:
other = DatetimeIndex(other)
diff --git a/pandas/tseries/period.py b/pandas/tseries/period.py
index 510887a185054..6627047f0c335 100644
--- a/pandas/tseries/period.py
+++ b/pandas/tseries/period.py
@@ -679,6 +679,8 @@ def join(self, other, how='left', level=None, return_indexers=False):
return self._apply_meta(result)
def _assert_can_do_setop(self, other):
+ super(PeriodIndex, self)._assert_can_do_setop(other)
+
if not isinstance(other, PeriodIndex):
raise ValueError('can only call with other PeriodIndex-ed objects')
diff --git a/pandas/tseries/tdi.py b/pandas/tseries/tdi.py
index 1443c22909689..de68dd763d68c 100644
--- a/pandas/tseries/tdi.py
+++ b/pandas/tseries/tdi.py
@@ -436,12 +436,12 @@ def union(self, other):
-------
y : Index or TimedeltaIndex
"""
- if _is_convertible_to_index(other):
+ self._assert_can_do_setop(other)
+ if not isinstance(other, TimedeltaIndex):
try:
other = TimedeltaIndex(other)
- except TypeError:
+ except (TypeError, ValueError):
pass
-
this, other = self, other
if this._can_fast_union(other):
@@ -581,6 +581,7 @@ def intersection(self, other):
-------
y : Index or TimedeltaIndex
"""
+ self._assert_can_do_setop(other)
if not isinstance(other, TimedeltaIndex):
try:
other = TimedeltaIndex(other)
| Closes #10149.
- Added explicit tests for array-likes in set-ops, `intersection`, `union`, `difference` and `sym_diff`.
- `TimedeltaIndex` previously did additional input check which is inconsistent with others. Made it work as the same manner as others.
- `MultiIndex` set-ops should only accept list-likes of tuples. Implement the logic and add explicit test.
- Changed to understandable error message for `str` which has `__iter__` in py3.
```
# current error msg
idx.intersection('aaa')
# TypeError: Index(...) must be called with a collection of some kind, 'aaa' was passed
```
NOTE: This DOESN'T care the `name` attribute checks, which is being worked in #9965.
| https://api.github.com/repos/pandas-dev/pandas/pulls/10157 | 2015-05-16T21:26:19Z | 2015-06-01T11:45:10Z | 2015-06-01T11:45:10Z | 2015-06-02T19:26:12Z |
TST: use compat.long in test_tslib for py3 | diff --git a/pandas/tseries/tests/test_timedeltas.py b/pandas/tseries/tests/test_timedeltas.py
index c5843862306ca..948a0be91b276 100644
--- a/pandas/tseries/tests/test_timedeltas.py
+++ b/pandas/tseries/tests/test_timedeltas.py
@@ -23,6 +23,8 @@
import pandas.util.testing as tm
from numpy.random import rand, randn
from pandas import _np_version_under1p8
+import pandas.compat as compat
+
iNaT = tslib.iNaT
@@ -311,7 +313,7 @@ def test_fields(self):
def check(value):
# that we are int/long like
- self.assertTrue(isinstance(value, (int, long)))
+ self.assertTrue(isinstance(value, (int, compat.long)))
# compat to datetime.timedelta
rng = to_timedelta('1 days, 10:11:12')
diff --git a/pandas/tseries/tests/test_tslib.py b/pandas/tseries/tests/test_tslib.py
index 27e5b927f9719..341450f504e2a 100644
--- a/pandas/tseries/tests/test_tslib.py
+++ b/pandas/tseries/tests/test_tslib.py
@@ -14,6 +14,8 @@
import pandas.tseries.offsets as offsets
import pandas.util.testing as tm
from pandas.util.testing import assert_series_equal
+import pandas.compat as compat
+
class TestTimestamp(tm.TestCase):
@@ -373,7 +375,7 @@ def test_fields(self):
def check(value, equal):
# that we are int/long like
- self.assertTrue(isinstance(value, (int, long)))
+ self.assertTrue(isinstance(value, (int, compat.long)))
self.assertEqual(value, equal)
# GH 10050
| https://api.github.com/repos/pandas-dev/pandas/pulls/10152 | 2015-05-15T23:45:07Z | 2015-05-16T15:01:07Z | 2015-05-16T15:01:07Z | 2015-05-17T14:40:11Z | |
ENH: groupby.apply for Categorical should preserve categories (closes… | diff --git a/doc/source/whatsnew/v0.16.2.txt b/doc/source/whatsnew/v0.16.2.txt
index b571aab0b19a5..1a8fc90b9683f 100644
--- a/doc/source/whatsnew/v0.16.2.txt
+++ b/doc/source/whatsnew/v0.16.2.txt
@@ -55,7 +55,7 @@ Bug Fixes
multi-indexed (:issue:`7212`)
- Bug in ``Categorical`` repr with ``display.width`` of ``None`` in Python 3 (:issue:`10087`)
-
+- Bug in groupby.apply aggregation for Categorical not preserving categories (:issue:`10138`)
- Bug in ``mean()`` where integer dtypes can overflow (:issue:`10172`)
- Bug where Panel.from_dict does not set dtype when specified (:issue:`10058`)
- Bug in ``Index.union`` raises ``AttributeError`` when passing array-likes. (:issue:`10149`)
diff --git a/pandas/core/groupby.py b/pandas/core/groupby.py
index 51674bad60f5b..4abdd1112c721 100644
--- a/pandas/core/groupby.py
+++ b/pandas/core/groupby.py
@@ -2944,7 +2944,8 @@ def _wrap_applied_output(self, keys, values, not_indexed_same=False):
cd = 'coerce'
else:
cd = True
- return result.convert_objects(convert_dates=cd)
+ result = result.convert_objects(convert_dates=cd)
+ return self._reindex_output(result)
else:
# only coerce dates if we find at least 1 datetime
diff --git a/pandas/tests/test_groupby.py b/pandas/tests/test_groupby.py
index 0789e20df3945..ab78bd63a7c94 100644
--- a/pandas/tests/test_groupby.py
+++ b/pandas/tests/test_groupby.py
@@ -2595,6 +2595,35 @@ def get_stats(group):
result = self.df.groupby(cats).D.apply(get_stats)
self.assertEqual(result.index.names[0], 'C')
+ def test_apply_categorical_data(self):
+ # GH 10138
+ for ordered in [True, False]:
+ dense = Categorical(list('abc'), ordered=ordered)
+ # 'b' is in the categories but not in the list
+ missing = Categorical(list('aaa'), categories=['a', 'b'], ordered=ordered)
+ values = np.arange(len(dense))
+ df = DataFrame({'missing': missing,
+ 'dense': dense,
+ 'values': values})
+ grouped = df.groupby(['missing', 'dense'])
+
+ # missing category 'b' should still exist in the output index
+ idx = MultiIndex.from_product([['a', 'b'], ['a', 'b', 'c']],
+ names=['missing', 'dense'])
+ expected = DataFrame([0, 1, 2, np.nan, np.nan, np.nan],
+ index=idx,
+ columns=['values'])
+
+ assert_frame_equal(grouped.apply(lambda x: np.mean(x)), expected)
+ assert_frame_equal(grouped.mean(), expected)
+ assert_frame_equal(grouped.agg(np.mean), expected)
+
+ # but for transform we should still get back the original index
+ idx = MultiIndex.from_product([['a'], ['a', 'b', 'c']],
+ names=['missing', 'dense'])
+ expected = Series(1, index=idx)
+ assert_series_equal(grouped.apply(lambda x: 1), expected)
+
def test_apply_corner_cases(self):
# #535, can't use sliding iterator
| closes #10138
| https://api.github.com/repos/pandas-dev/pandas/pulls/10142 | 2015-05-15T04:33:27Z | 2015-06-04T13:50:27Z | 2015-06-04T13:50:27Z | 2015-06-04T15:18:02Z |
CLN: clean up unused imports part II | diff --git a/pandas/tseries/base.py b/pandas/tseries/base.py
index f3a7aa0bfa4c6..88b4117d4807c 100644
--- a/pandas/tseries/base.py
+++ b/pandas/tseries/base.py
@@ -3,7 +3,7 @@
"""
import warnings
-from datetime import datetime, time, timedelta
+from datetime import datetime, timedelta
from pandas import compat
import numpy as np
@@ -13,11 +13,9 @@
import pandas.lib as lib
from pandas.core.index import Index
from pandas.util.decorators import Appender, cache_readonly
-from pandas.tseries.frequencies import (
- infer_freq, to_offset, get_period_alias,
- Resolution)
+from pandas.tseries.frequencies import infer_freq, to_offset, Resolution
import pandas.algos as _algos
-from pandas.core.config import get_option
+
class DatetimeIndexOpsMixin(object):
""" common ops mixin to support a unified inteface datetimelike Index """
diff --git a/pandas/tseries/common.py b/pandas/tseries/common.py
index 8e468a7701462..c273906ef3d05 100644
--- a/pandas/tseries/common.py
+++ b/pandas/tseries/common.py
@@ -6,7 +6,7 @@
from pandas.tseries.index import DatetimeIndex
from pandas.tseries.period import PeriodIndex
from pandas.tseries.tdi import TimedeltaIndex
-from pandas import lib, tslib
+from pandas import tslib
from pandas.core.common import (_NS_DTYPE, _TD_DTYPE, is_period_arraylike,
is_datetime_arraylike, is_integer_dtype, is_list_like,
get_dtype_kinds)
diff --git a/pandas/tseries/index.py b/pandas/tseries/index.py
index f56b40a70d551..f3803a04baf01 100644
--- a/pandas/tseries/index.py
+++ b/pandas/tseries/index.py
@@ -1,13 +1,8 @@
# pylint: disable=E1101
import operator
-
from datetime import time, datetime
from datetime import timedelta
-
import numpy as np
-
-import warnings
-
from pandas.core.common import (_NS_DTYPE, _INT64_DTYPE,
_values_from_object, _maybe_box,
ABCSeries, is_integer, is_float)
diff --git a/pandas/tseries/interval.py b/pandas/tseries/interval.py
index 104e088ee4e84..bcce64c3a71bf 100644
--- a/pandas/tseries/interval.py
+++ b/pandas/tseries/interval.py
@@ -1,4 +1,3 @@
-import numpy as np
from pandas.core.index import Index
diff --git a/pandas/tseries/period.py b/pandas/tseries/period.py
index 8b7dc90738bd0..98d9f9f14d3da 100644
--- a/pandas/tseries/period.py
+++ b/pandas/tseries/period.py
@@ -1,10 +1,6 @@
# pylint: disable=E1101,E1103,W0232
-import operator
-
-from datetime import datetime, date, timedelta
+from datetime import datetime, timedelta
import numpy as np
-from pandas.core.base import PandasObject
-
import pandas.tseries.frequencies as frequencies
from pandas.tseries.frequencies import get_freq_code as _gfc
from pandas.tseries.index import DatetimeIndex, Int64Index, Index
diff --git a/pandas/tseries/plotting.py b/pandas/tseries/plotting.py
index 899d2bfdc9c76..9d28fa11f646f 100644
--- a/pandas/tseries/plotting.py
+++ b/pandas/tseries/plotting.py
@@ -5,17 +5,13 @@
#!!! TODO: Use the fact that axis can have units to simplify the process
from matplotlib import pylab
-
-import numpy as np
-
-from pandas import isnull
from pandas.tseries.period import Period
from pandas.tseries.offsets import DateOffset
import pandas.tseries.frequencies as frequencies
from pandas.tseries.index import DatetimeIndex
import pandas.core.common as com
-from pandas.tseries.converter import (PeriodConverter, TimeSeries_DateLocator,
+from pandas.tseries.converter import (TimeSeries_DateLocator,
TimeSeries_DateFormatter)
#----------------------------------------------------------------------
diff --git a/pandas/tseries/resample.py b/pandas/tseries/resample.py
index 942dea84f501a..53c1292204f71 100644
--- a/pandas/tseries/resample.py
+++ b/pandas/tseries/resample.py
@@ -1,14 +1,11 @@
from datetime import timedelta
-
import numpy as np
-
from pandas.core.groupby import BinGrouper, Grouper
from pandas.tseries.frequencies import to_offset, is_subperiod, is_superperiod
from pandas.tseries.index import DatetimeIndex, date_range
from pandas.tseries.tdi import TimedeltaIndex
from pandas.tseries.offsets import DateOffset, Tick, Day, _delta_to_nanoseconds
from pandas.tseries.period import PeriodIndex, period_range
-import pandas.tseries.tools as tools
import pandas.core.common as com
import pandas.compat as compat
diff --git a/pandas/tseries/tdi.py b/pandas/tseries/tdi.py
index 80475fc8426db..fd97ca4c45fc0 100644
--- a/pandas/tseries/tdi.py
+++ b/pandas/tseries/tdi.py
@@ -1,17 +1,13 @@
""" implement the TimedeltaIndex """
-import operator
-import datetime
from datetime import timedelta
import numpy as np
-
from pandas.core.common import (ABCSeries, _TD_DTYPE, _INT64_DTYPE,
is_timedelta64_dtype, _maybe_box,
_values_from_object, isnull, is_integer, is_float)
from pandas.core.index import Index, Int64Index
import pandas.compat as compat
from pandas.compat import u
-from pandas.core.base import PandasObject
from pandas.util.decorators import cache_readonly
from pandas.tseries.frequencies import to_offset
import pandas.core.common as com
diff --git a/pandas/tseries/timedeltas.py b/pandas/tseries/timedeltas.py
index 5b353058f0093..624981c5536f5 100644
--- a/pandas/tseries/timedeltas.py
+++ b/pandas/tseries/timedeltas.py
@@ -3,14 +3,12 @@
"""
import re
-from datetime import timedelta
-
import numpy as np
import pandas.tslib as tslib
from pandas import compat
-from pandas.core.common import (ABCSeries, is_integer, is_integer_dtype,
- is_timedelta64_dtype, _values_from_object,
- is_list_like, isnull, _ensure_object)
+from pandas.core.common import (ABCSeries, is_integer_dtype,
+ is_timedelta64_dtype, is_list_like,
+ isnull, _ensure_object)
def to_timedelta(arg, unit='ns', box=True, coerce=False):
"""
diff --git a/pandas/tseries/util.py b/pandas/tseries/util.py
index 72b12ea495ba0..6c534de0a7aaa 100644
--- a/pandas/tseries/util.py
+++ b/pandas/tseries/util.py
@@ -1,8 +1,5 @@
from pandas.compat import range, lrange
import numpy as np
-
-import pandas as pd
-
import pandas.core.common as com
from pandas.core.frame import DataFrame
import pandas.core.nanops as nanops
| found quite a few more under `pandas/tseries/` ... this should be it for now :)
| https://api.github.com/repos/pandas-dev/pandas/pulls/10141 | 2015-05-15T02:03:35Z | 2015-05-15T13:09:15Z | 2015-05-15T13:09:15Z | 2015-06-02T19:26:12Z |
BUG: declare and use correctly self.unique_check | diff --git a/pandas/index.pyx b/pandas/index.pyx
index 9be7e7404f3fe..bed385a9ad6aa 100644
--- a/pandas/index.pyx
+++ b/pandas/index.pyx
@@ -87,6 +87,7 @@ cdef class IndexEngine:
self.initialized = 0
self.monotonic_check = 0
+ self.unique_check = 0
self.unique = 0
self.monotonic_inc = 0
@@ -269,7 +270,7 @@ cdef class IndexEngine:
if len(self.mapping) == len(values):
self.unique = 1
- self.unique_check = 1
+ self.unique_check = 1
self.initialized = 1
| I am not sure I understood the last comment in [the previous pull request](https://github.com/pydata/pandas/pull/9526), but anyway this is a rebased version.
In the previous PR I proposed to simply make the `__get__` of `is_unique` directly rely on `self.initialized`, but I am no more so sure it is a good idea, since the current status is slightly redundant but clearer (and coherent with the use of "is_monotonic").
| https://api.github.com/repos/pandas-dev/pandas/pulls/10139 | 2015-05-14T21:20:10Z | 2015-05-29T08:40:01Z | null | 2015-06-30T10:55:21Z |
DOC: consistent imports (GH9886) part II | diff --git a/doc/source/10min.rst b/doc/source/10min.rst
index 94c2d921eb116..1714e00030026 100644
--- a/doc/source/10min.rst
+++ b/doc/source/10min.rst
@@ -6,18 +6,16 @@
:suppress:
import numpy as np
- import random
+ import pandas as pd
import os
np.random.seed(123456)
- from pandas import options
- import pandas as pd
np.set_printoptions(precision=4, suppress=True)
import matplotlib
try:
matplotlib.style.use('ggplot')
except AttributeError:
- options.display.mpl_style = 'default'
- options.display.max_rows=15
+ pd.options.display.mpl_style = 'default'
+ pd.options.display.max_rows = 15
#### portions of this were borrowed from the
#### Pandas cheatsheet
@@ -298,7 +296,7 @@ Using the :func:`~Series.isin` method for filtering:
.. ipython:: python
df2 = df.copy()
- df2['E']=['one', 'one','two','three','four','three']
+ df2['E'] = ['one', 'one','two','three','four','three']
df2
df2[df2['E'].isin(['two','four'])]
@@ -310,7 +308,7 @@ by the indexes
.. ipython:: python
- s1 = pd.Series([1,2,3,4,5,6],index=pd.date_range('20130102',periods=6))
+ s1 = pd.Series([1,2,3,4,5,6], index=pd.date_range('20130102', periods=6))
s1
df['F'] = s1
@@ -359,7 +357,7 @@ returns a copy of the data.
.. ipython:: python
- df1 = df.reindex(index=dates[0:4],columns=list(df.columns) + ['E'])
+ df1 = df.reindex(index=dates[0:4], columns=list(df.columns) + ['E'])
df1.loc[dates[0]:dates[1],'E'] = 1
df1
@@ -409,9 +407,9 @@ In addition, pandas automatically broadcasts along the specified dimension.
.. ipython:: python
- s = pd.Series([1,3,5,np.nan,6,8],index=dates).shift(2)
+ s = pd.Series([1,3,5,np.nan,6,8], index=dates).shift(2)
s
- df.sub(s,axis='index')
+ df.sub(s, axis='index')
Apply
@@ -431,7 +429,7 @@ See more at :ref:`Histogramming and Discretization <basics.discretization>`
.. ipython:: python
- s = pd.Series(np.random.randint(0,7,size=10))
+ s = pd.Series(np.random.randint(0, 7, size=10))
s
s.value_counts()
@@ -516,9 +514,9 @@ See the :ref:`Grouping section <groupby>`
.. ipython:: python
df = pd.DataFrame({'A' : ['foo', 'bar', 'foo', 'bar',
- 'foo', 'bar', 'foo', 'foo'],
+ 'foo', 'bar', 'foo', 'foo'],
'B' : ['one', 'one', 'two', 'three',
- 'two', 'two', 'one', 'three'],
+ 'two', 'two', 'one', 'three'],
'C' : np.random.randn(8),
'D' : np.random.randn(8)})
df
diff --git a/doc/source/advanced.rst b/doc/source/advanced.rst
index 688935c6b104d..656eff744bb47 100644
--- a/doc/source/advanced.rst
+++ b/doc/source/advanced.rst
@@ -6,15 +6,10 @@
:suppress:
import numpy as np
- import random
- np.random.seed(123456)
- from pandas import *
- options.display.max_rows=15
import pandas as pd
- randn = np.random.randn
- randint = np.random.randint
+ np.random.seed(123456)
np.set_printoptions(precision=4, suppress=True)
- from pandas.compat import range, zip
+ pd.options.display.max_rows=15
******************************
MultiIndex / Advanced Indexing
@@ -80,10 +75,10 @@ demo different ways to initialize MultiIndexes.
tuples = list(zip(*arrays))
tuples
- index = MultiIndex.from_tuples(tuples, names=['first', 'second'])
+ index = pd.MultiIndex.from_tuples(tuples, names=['first', 'second'])
index
- s = Series(randn(8), index=index)
+ s = pd.Series(np.random.randn(8), index=index)
s
When you want every pairing of the elements in two iterables, it can be easier
@@ -92,7 +87,7 @@ to use the ``MultiIndex.from_product`` function:
.. ipython:: python
iterables = [['bar', 'baz', 'foo', 'qux'], ['one', 'two']]
- MultiIndex.from_product(iterables, names=['first', 'second'])
+ pd.MultiIndex.from_product(iterables, names=['first', 'second'])
As a convenience, you can pass a list of arrays directly into Series or
DataFrame to construct a MultiIndex automatically:
@@ -101,9 +96,9 @@ DataFrame to construct a MultiIndex automatically:
arrays = [np.array(['bar', 'bar', 'baz', 'baz', 'foo', 'foo', 'qux', 'qux']),
np.array(['one', 'two', 'one', 'two', 'one', 'two', 'one', 'two'])]
- s = Series(randn(8), index=arrays)
+ s = pd.Series(np.random.randn(8), index=arrays)
s
- df = DataFrame(randn(8, 4), index=arrays)
+ df = pd.DataFrame(np.random.randn(8, 4), index=arrays)
df
All of the ``MultiIndex`` constructors accept a ``names`` argument which stores
@@ -119,9 +114,9 @@ of the index is up to you:
.. ipython:: python
- df = DataFrame(randn(3, 8), index=['A', 'B', 'C'], columns=index)
+ df = pd.DataFrame(np.random.randn(3, 8), index=['A', 'B', 'C'], columns=index)
df
- DataFrame(randn(6, 6), index=index[:6], columns=index[:6])
+ pd.DataFrame(np.random.randn(6, 6), index=index[:6], columns=index[:6])
We've "sparsified" the higher levels of the indexes to make the console output a
bit easier on the eyes.
@@ -131,7 +126,7 @@ tuples as atomic labels on an axis:
.. ipython:: python
- Series(randn(8), index=tuples)
+ pd.Series(np.random.randn(8), index=tuples)
The reason that the ``MultiIndex`` matters is that it can allow you to do
grouping, selection, and reshaping operations as we will describe below and in
@@ -282,16 +277,16 @@ As usual, **both sides** of the slicers are included as this is label indexing.
def mklbl(prefix,n):
return ["%s%s" % (prefix,i) for i in range(n)]
- miindex = MultiIndex.from_product([mklbl('A',4),
- mklbl('B',2),
- mklbl('C',4),
- mklbl('D',2)])
- micolumns = MultiIndex.from_tuples([('a','foo'),('a','bar'),
- ('b','foo'),('b','bah')],
- names=['lvl0', 'lvl1'])
- dfmi = DataFrame(np.arange(len(miindex)*len(micolumns)).reshape((len(miindex),len(micolumns))),
- index=miindex,
- columns=micolumns).sortlevel().sortlevel(axis=1)
+ miindex = pd.MultiIndex.from_product([mklbl('A',4),
+ mklbl('B',2),
+ mklbl('C',4),
+ mklbl('D',2)])
+ micolumns = pd.MultiIndex.from_tuples([('a','foo'),('a','bar'),
+ ('b','foo'),('b','bah')],
+ names=['lvl0', 'lvl1'])
+ dfmi = pd.DataFrame(np.arange(len(miindex)*len(micolumns)).reshape((len(miindex),len(micolumns))),
+ index=miindex,
+ columns=micolumns).sortlevel().sortlevel(axis=1)
dfmi
Basic multi-index slicing using slices, lists, and labels.
@@ -418,9 +413,9 @@ instance:
.. ipython:: python
- midx = MultiIndex(levels=[['zero', 'one'], ['x','y']],
- labels=[[1,1,0,0],[1,0,1,0]])
- df = DataFrame(randn(4,2), index=midx)
+ midx = pd.MultiIndex(levels=[['zero', 'one'], ['x','y']],
+ labels=[[1,1,0,0],[1,0,1,0]])
+ df = pd.DataFrame(np.random.randn(4,2), index=midx)
df
df2 = df.mean(level=0)
df2
@@ -471,7 +466,7 @@ labels will be sorted lexicographically!
.. ipython:: python
import random; random.shuffle(tuples)
- s = Series(randn(8), index=MultiIndex.from_tuples(tuples))
+ s = pd.Series(np.random.randn(8), index=pd.MultiIndex.from_tuples(tuples))
s
s.sortlevel(0)
s.sortlevel(1)
@@ -509,13 +504,13 @@ an exception. Here is a concrete example to illustrate this:
.. ipython:: python
tuples = [('a', 'a'), ('a', 'b'), ('b', 'a'), ('b', 'b')]
- idx = MultiIndex.from_tuples(tuples)
+ idx = pd.MultiIndex.from_tuples(tuples)
idx.lexsort_depth
reordered = idx[[1, 0, 3, 2]]
reordered.lexsort_depth
- s = Series(randn(4), index=reordered)
+ s = pd.Series(np.random.randn(4), index=reordered)
s.ix['a':'a']
However:
@@ -540,7 +535,7 @@ index positions. ``take`` will also accept negative integers as relative positio
.. ipython:: python
- index = Index(randint(0, 1000, 10))
+ index = pd.Index(np.random.randint(0, 1000, 10))
index
positions = [0, 9, 3]
@@ -548,7 +543,7 @@ index positions. ``take`` will also accept negative integers as relative positio
index[positions]
index.take(positions)
- ser = Series(randn(10))
+ ser = pd.Series(np.random.randn(10))
ser.iloc[positions]
ser.take(positions)
@@ -558,7 +553,7 @@ row or column positions.
.. ipython:: python
- frm = DataFrame(randn(5, 3))
+ frm = pd.DataFrame(np.random.randn(5, 3))
frm.take([1, 4, 3])
@@ -569,11 +564,11 @@ intended to work on boolean indices and may return unexpected results.
.. ipython:: python
- arr = randn(10)
+ arr = np.random.randn(10)
arr.take([False, False, True, True])
arr[[0, 1]]
- ser = Series(randn(10))
+ ser = pd.Series(np.random.randn(10))
ser.take([False, False, True, True])
ser.ix[[0, 1]]
@@ -583,14 +578,14 @@ faster than fancy indexing.
.. ipython::
- arr = randn(10000, 5)
+ arr = np.random.randn(10000, 5)
indexer = np.arange(10000)
random.shuffle(indexer)
timeit arr[indexer]
timeit arr.take(indexer, axis=0)
- ser = Series(arr[:, 0])
+ ser = pd.Series(arr[:, 0])
timeit ser.ix[indexer]
timeit ser.take(indexer)
@@ -608,10 +603,9 @@ setting the index of a ``DataFrame/Series`` with a ``category`` dtype would conv
.. ipython:: python
- df = DataFrame({'A' : np.arange(6),
- 'B' : Series(list('aabbca')).astype('category',
- categories=list('cab'))
- })
+ df = pd.DataFrame({'A': np.arange(6),
+ 'B': list('aabbca')})
+ df['B'] = df['B'].astype('category', categories=list('cab'))
df
df.dtypes
df.B.cat.categories
@@ -669,10 +663,10 @@ values NOT in the categories, similarly to how you can reindex ANY pandas index.
.. code-block:: python
- In [10]: df3 = DataFrame({'A' : np.arange(6),
- 'B' : Series(list('aabbca')).astype('category',
- categories=list('abc'))
- }).set_index('B')
+ In [9]: df3 = pd.DataFrame({'A' : np.arange(6),
+ 'B' : pd.Series(list('aabbca')).astype('category')})
+
+ In [11]: df3 = df3.set_index('B')
In [11]: df3.index
Out[11]:
@@ -680,7 +674,7 @@ values NOT in the categories, similarly to how you can reindex ANY pandas index.
categories=[u'a', u'b', u'c'],
ordered=False)
- In [12]: pd.concat([df2,df3]
+ In [12]: pd.concat([df2, df3]
TypeError: categories must match existing categories when appending
.. _indexing.float64index:
@@ -705,9 +699,9 @@ same.
.. ipython:: python
- indexf = Index([1.5, 2, 3, 4.5, 5])
+ indexf = pd.Index([1.5, 2, 3, 4.5, 5])
indexf
- sf = Series(range(5),index=indexf)
+ sf = pd.Series(range(5), index=indexf)
sf
Scalar selection for ``[],.ix,.loc`` will always be label based. An integer will match an equal float index (e.g. ``3`` is equivalent to ``3.0``)
@@ -749,17 +743,17 @@ In non-float indexes, slicing using floats will raise a ``TypeError``
.. code-block:: python
- In [1]: Series(range(5))[3.5]
+ In [1]: pd.Series(range(5))[3.5]
TypeError: the label [3.5] is not a proper indexer for this index type (Int64Index)
- In [1]: Series(range(5))[3.5:4.5]
+ In [1]: pd.Series(range(5))[3.5:4.5]
TypeError: the slice start [3.5] is not a proper indexer for this index type (Int64Index)
Using a scalar float indexer will be deprecated in a future version, but is allowed for now.
.. code-block:: python
- In [3]: Series(range(5))[3.0]
+ In [3]: pd.Series(range(5))[3.0]
Out[3]: 3
Here is a typical use-case for using this type of indexing. Imagine that you have a somewhat
@@ -768,12 +762,12 @@ example be millisecond offsets.
.. ipython:: python
- dfir = concat([DataFrame(randn(5,2),
- index=np.arange(5) * 250.0,
- columns=list('AB')),
- DataFrame(randn(6,2),
- index=np.arange(4,10) * 250.1,
- columns=list('AB'))])
+ dfir = pd.concat([pd.DataFrame(np.random.randn(5,2),
+ index=np.arange(5) * 250.0,
+ columns=list('AB')),
+ pd.DataFrame(np.random.randn(6,2),
+ index=np.arange(4,10) * 250.1,
+ columns=list('AB'))])
dfir
Selection operations then will always work on a value basis, for all selection operators.
diff --git a/doc/source/basics.rst b/doc/source/basics.rst
index 76efdc0553c7d..96372ddab68bc 100644
--- a/doc/source/basics.rst
+++ b/doc/source/basics.rst
@@ -1,16 +1,14 @@
.. currentmodule:: pandas
-.. _basics:
.. ipython:: python
:suppress:
import numpy as np
- from pandas import *
- randn = np.random.randn
+ import pandas as pd
np.set_printoptions(precision=4, suppress=True)
- from pandas.compat import lrange
- options.display.max_rows=15
+ pd.options.display.max_rows = 15
+.. _basics:
==============================
Essential Basic Functionality
@@ -22,13 +20,13 @@ the previous section:
.. ipython:: python
- index = date_range('1/1/2000', periods=8)
- s = Series(randn(5), index=['a', 'b', 'c', 'd', 'e'])
- df = DataFrame(randn(8, 3), index=index,
- columns=['A', 'B', 'C'])
- wp = Panel(randn(2, 5, 4), items=['Item1', 'Item2'],
- major_axis=date_range('1/1/2000', periods=5),
- minor_axis=['A', 'B', 'C', 'D'])
+ index = pd.date_range('1/1/2000', periods=8)
+ s = pd.Series(np.random.randn(5), index=['a', 'b', 'c', 'd', 'e'])
+ df = pd.DataFrame(np.random.randn(8, 3), index=index,
+ columns=['A', 'B', 'C'])
+ wp = pd.Panel(np.random.randn(2, 5, 4), items=['Item1', 'Item2'],
+ major_axis=pd.date_range('1/1/2000', periods=5),
+ minor_axis=['A', 'B', 'C', 'D'])
.. _basics.head_tail:
@@ -41,7 +39,7 @@ of elements to display is five, but you may pass a custom number.
.. ipython:: python
- long_series = Series(randn(1000))
+ long_series = pd.Series(np.random.randn(1000))
long_series.head()
long_series.tail(3)
@@ -143,9 +141,9 @@ either match on the *index* or *columns* via the **axis** keyword:
.. ipython:: python
- df = DataFrame({'one' : Series(randn(3), index=['a', 'b', 'c']),
- 'two' : Series(randn(4), index=['a', 'b', 'c', 'd']),
- 'three' : Series(randn(3), index=['b', 'c', 'd'])})
+ df = pd.DataFrame({'one' : pd.Series(np.random.randn(3), index=['a', 'b', 'c']),
+ 'two' : pd.Series(np.random.randn(4), index=['a', 'b', 'c', 'd']),
+ 'three' : pd.Series(np.random.randn(3), index=['b', 'c', 'd'])})
df
row = df.ix[1]
column = df['two']
@@ -166,8 +164,8 @@ Furthermore you can align a level of a multi-indexed DataFrame with a Series.
.. ipython:: python
dfmi = df.copy()
- dfmi.index = MultiIndex.from_tuples([(1,'a'),(1,'b'),(1,'c'),(2,'a')],
- names=['first','second'])
+ dfmi.index = pd.MultiIndex.from_tuples([(1,'a'),(1,'b'),(1,'c'),(2,'a')],
+ names=['first','second'])
dfmi.sub(column, axis=0, level='second')
With Panel, describing the matching behavior is a bit more difficult, so
@@ -256,17 +254,17 @@ You can test if a pandas object is empty, via the :attr:`~DataFrame.empty` prope
.. ipython:: python
df.empty
- DataFrame(columns=list('ABC')).empty
+ pd.DataFrame(columns=list('ABC')).empty
To evaluate single-element pandas objects in a boolean context, use the method
:meth:`~DataFrame.bool`:
.. ipython:: python
- Series([True]).bool()
- Series([False]).bool()
- DataFrame([[True]]).bool()
- DataFrame([[False]]).bool()
+ pd.Series([True]).bool()
+ pd.Series([False]).bool()
+ pd.DataFrame([[True]]).bool()
+ pd.DataFrame([[False]]).bool()
.. warning::
@@ -327,8 +325,8 @@ equality to be True:
.. ipython:: python
- df1 = DataFrame({'col':['foo', 0, np.nan]})
- df2 = DataFrame({'col':[np.nan, 0, 'foo']}, index=[2,1,0])
+ df1 = pd.DataFrame({'col':['foo', 0, np.nan]})
+ df2 = pd.DataFrame({'col':[np.nan, 0, 'foo']}, index=[2,1,0])
df1.equals(df2)
df1.equals(df2.sort())
@@ -348,10 +346,10 @@ which we illustrate:
.. ipython:: python
- df1 = DataFrame({'A' : [1., np.nan, 3., 5., np.nan],
- 'B' : [np.nan, 2., 3., np.nan, 6.]})
- df2 = DataFrame({'A' : [5., 2., 4., np.nan, 3., 7.],
- 'B' : [np.nan, np.nan, 3., 4., 6., 8.]})
+ df1 = pd.DataFrame({'A' : [1., np.nan, 3., 5., np.nan],
+ 'B' : [np.nan, 2., 3., np.nan, 6.]})
+ df2 = pd.DataFrame({'A' : [5., 2., 4., np.nan, 3., 7.],
+ 'B' : [np.nan, np.nan, 3., 4., 6., 8.]})
df1
df2
df1.combine_first(df2)
@@ -368,7 +366,7 @@ So, for instance, to reproduce :meth:`~DataFrame.combine_first` as above:
.. ipython:: python
- combiner = lambda x, y: np.where(isnull(x), y, x)
+ combiner = lambda x, y: np.where(pd.isnull(x), y, x)
df1.combine(df2, combiner)
.. _basics.stats:
@@ -467,7 +465,7 @@ number of unique non-null values:
.. ipython:: python
- series = Series(randn(500))
+ series = pd.Series(np.random.randn(500))
series[20:500] = np.nan
series[10:20] = 5
series.nunique()
@@ -483,10 +481,10 @@ course):
.. ipython:: python
- series = Series(randn(1000))
+ series = pd.Series(np.random.randn(1000))
series[::2] = np.nan
series.describe()
- frame = DataFrame(randn(1000, 5), columns=['a', 'b', 'c', 'd', 'e'])
+ frame = pd.DataFrame(np.random.randn(1000, 5), columns=['a', 'b', 'c', 'd', 'e'])
frame.ix[::2] = np.nan
frame.describe()
@@ -503,7 +501,7 @@ summary of the number of unique values and most frequently occurring values:
.. ipython:: python
- s = Series(['a', 'a', 'b', 'b', 'a', 'a', np.nan, 'c', 'd', 'a'])
+ s = pd.Series(['a', 'a', 'b', 'b', 'a', 'a', np.nan, 'c', 'd', 'a'])
s.describe()
Note that on a mixed-type DataFrame object, :meth:`~DataFrame.describe` will
@@ -512,7 +510,7 @@ categorical columns:
.. ipython:: python
- frame = DataFrame({'a': ['Yes', 'Yes', 'No', 'No'], 'b': range(4)})
+ frame = pd.DataFrame({'a': ['Yes', 'Yes', 'No', 'No'], 'b': range(4)})
frame.describe()
This behaviour can be controlled by providing a list of types as ``include``/``exclude``
@@ -538,11 +536,11 @@ corresponding values:
.. ipython:: python
- s1 = Series(randn(5))
+ s1 = pd.Series(np.random.randn(5))
s1
s1.idxmin(), s1.idxmax()
- df1 = DataFrame(randn(5,3), columns=['A','B','C'])
+ df1 = pd.DataFrame(np.random.randn(5,3), columns=['A','B','C'])
df1
df1.idxmin(axis=0)
df1.idxmax(axis=1)
@@ -553,7 +551,7 @@ matching index:
.. ipython:: python
- df3 = DataFrame([2, 1, 1, 3, np.nan], columns=['A'], index=list('edcba'))
+ df3 = pd.DataFrame([2, 1, 1, 3, np.nan], columns=['A'], index=list('edcba'))
df3
df3['A'].idxmin()
@@ -573,18 +571,18 @@ of a 1D array of values. It can also be used as a function on regular arrays:
data = np.random.randint(0, 7, size=50)
data
- s = Series(data)
+ s = pd.Series(data)
s.value_counts()
- value_counts(data)
+ pd.value_counts(data)
Similarly, you can get the most frequently occurring value(s) (the mode) of the values in a Series or DataFrame:
.. ipython:: python
- s5 = Series([1, 1, 3, 3, 3, 5, 5, 7, 7, 7])
+ s5 = pd.Series([1, 1, 3, 3, 3, 5, 5, 7, 7, 7])
s5.mode()
- df5 = DataFrame({"A": np.random.randint(0, 7, size=50),
- "B": np.random.randint(-10, 15, size=50)})
+ df5 = pd.DataFrame({"A": np.random.randint(0, 7, size=50),
+ "B": np.random.randint(-10, 15, size=50)})
df5.mode()
@@ -597,10 +595,10 @@ and :func:`qcut` (bins based on sample quantiles) functions:
.. ipython:: python
arr = np.random.randn(20)
- factor = cut(arr, 4)
+ factor = pd.cut(arr, 4)
factor
- factor = cut(arr, [-5, -1, 0, 1, 5])
+ factor = pd.cut(arr, [-5, -1, 0, 1, 5])
factor
:func:`qcut` computes sample quantiles. For example, we could slice up some
@@ -609,16 +607,16 @@ normally distributed data into equal-size quartiles like so:
.. ipython:: python
arr = np.random.randn(30)
- factor = qcut(arr, [0, .25, .5, .75, 1])
+ factor = pd.qcut(arr, [0, .25, .5, .75, 1])
factor
- value_counts(factor)
+ pd.value_counts(factor)
We can also pass infinite values to define the bins:
.. ipython:: python
arr = np.random.randn(20)
- factor = cut(arr, [-np.inf, 0, np.inf])
+ factor = pd.cut(arr, [-np.inf, 0, np.inf])
factor
.. _basics.apply:
@@ -647,8 +645,8 @@ maximum value for each column occurred:
.. ipython:: python
- tsdf = DataFrame(randn(1000, 3), columns=['A', 'B', 'C'],
- index=date_range('1/1/2000', periods=1000))
+ tsdf = pd.DataFrame(np.random.randn(1000, 3), columns=['A', 'B', 'C'],
+ index=pd.date_range('1/1/2000', periods=1000))
tsdf.apply(lambda x: x.idxmax())
You may also pass additional arguments and keyword arguments to the :meth:`~DataFrame.apply`
@@ -671,14 +669,14 @@ Series operation on each column or row:
.. ipython:: python
:suppress:
- tsdf = DataFrame(randn(10, 3), columns=['A', 'B', 'C'],
- index=date_range('1/1/2000', periods=10))
+ tsdf = pd.DataFrame(np.random.randn(10, 3), columns=['A', 'B', 'C'],
+ index=pd.date_range('1/1/2000', periods=10))
tsdf.values[3:7] = np.nan
.. ipython:: python
tsdf
- tsdf.apply(Series.interpolate)
+ tsdf.apply(pd.Series.interpolate)
Finally, :meth:`~DataFrame.apply` takes an argument ``raw`` which is False by default, which
converts each row or column into a Series before applying the function. When
@@ -718,9 +716,9 @@ to :ref:`merging/joining functionality <merging>`:
.. ipython:: python
- s = Series(['six', 'seven', 'six', 'seven', 'six'],
- index=['a', 'b', 'c', 'd', 'e'])
- t = Series({'six' : 6., 'seven' : 7.})
+ s = pd.Series(['six', 'seven', 'six', 'seven', 'six'],
+ index=['a', 'b', 'c', 'd', 'e'])
+ t = pd.Series({'six' : 6., 'seven' : 7.})
s
s.map(t)
@@ -797,7 +795,7 @@ This is equivalent to the following
.. ipython:: python
- result = Panel(dict([ (ax,f(panel.loc[:,:,ax]))
+ result = pd.Panel(dict([ (ax, f(panel.loc[:,:,ax]))
for ax in panel.minor_axis ]))
result
result.loc[:,:,'ItemA']
@@ -823,7 +821,7 @@ Here is a simple example:
.. ipython:: python
- s = Series(randn(5), index=['a', 'b', 'c', 'd', 'e'])
+ s = pd.Series(np.random.randn(5), index=['a', 'b', 'c', 'd', 'e'])
s
s.reindex(['e', 'b', 'f', 'd'])
@@ -909,7 +907,7 @@ It returns a tuple with both of the reindexed Series:
.. ipython:: python
- s = Series(randn(5), index=['a', 'b', 'c', 'd', 'e'])
+ s = pd.Series(np.random.randn(5), index=['a', 'b', 'c', 'd', 'e'])
s1 = s[:4]
s2 = s[1:]
s1.align(s2)
@@ -960,8 +958,8 @@ We illustrate these fill methods on a simple Series:
.. ipython:: python
- rng = date_range('1/3/2000', periods=8)
- ts = Series(randn(8), index=rng)
+ rng = pd.date_range('1/3/2000', periods=8)
+ ts = pd.Series(np.random.randn(8), index=rng)
ts2 = ts[[0, 3, 6]]
ts
ts2
@@ -1095,11 +1093,11 @@ For instance, a contrived way to transpose the DataFrame would be:
.. ipython:: python
- df2 = DataFrame({'x': [1, 2, 3], 'y': [4, 5, 6]})
+ df2 = pd.DataFrame({'x': [1, 2, 3], 'y': [4, 5, 6]})
print(df2)
print(df2.T)
- df2_t = DataFrame(dict((idx,values) for idx, values in df2.iterrows()))
+ df2_t = pd.DataFrame(dict((idx,values) for idx, values in df2.iterrows()))
print(df2_t)
.. note::
@@ -1109,7 +1107,7 @@ For instance, a contrived way to transpose the DataFrame would be:
.. ipython:: python
- df_iter = DataFrame([[1, 1.0]], columns=['x', 'y'])
+ df_iter = pd.DataFrame([[1, 1.0]], columns=['x', 'y'])
row = next(df_iter.iterrows())[1]
print(row['x'].dtype)
print(df_iter['x'].dtype)
@@ -1140,7 +1138,7 @@ This will return a Series, indexed like the existing Series.
.. ipython:: python
# datetime
- s = Series(date_range('20130101 09:10:12',periods=4))
+ s = pd.Series(pd.date_range('20130101 09:10:12',periods=4))
s
s.dt.hour
s.dt.second
@@ -1171,7 +1169,7 @@ The ``.dt`` accessor works for period and timedelta dtypes.
.. ipython:: python
# period
- s = Series(period_range('20130101',periods=4,freq='D'))
+ s = pd.Series(pd.period_range('20130101', periods=4,freq='D'))
s
s.dt.year
s.dt.day
@@ -1179,7 +1177,7 @@ The ``.dt`` accessor works for period and timedelta dtypes.
.. ipython:: python
# timedelta
- s = Series(timedelta_range('1 day 00:00:05',periods=4,freq='s'))
+ s = pd.Series(pd.timedelta_range('1 day 00:00:05',periods=4,freq='s'))
s
s.dt.days
s.dt.seconds
@@ -1200,7 +1198,7 @@ built-in string methods. For example:
.. ipython:: python
- s = Series(['A', 'B', 'C', 'Aaba', 'Baca', np.nan, 'CABA', 'dog', 'cat'])
+ s = pd.Series(['A', 'B', 'C', 'Aaba', 'Baca', np.nan, 'CABA', 'dog', 'cat'])
s.str.lower()
Powerful pattern-matching methods are provided as well, but note that
@@ -1234,7 +1232,7 @@ determine the sort order:
.. ipython:: python
- df1 = DataFrame({'one':[2,1,1,1],'two':[1,3,2,4],'three':[5,4,3,2]})
+ df1 = pd.DataFrame({'one':[2,1,1,1],'two':[1,3,2,4],'three':[5,4,3,2]})
df1.sort_index(by='two')
The ``by`` argument can take a list of column names, e.g.:
@@ -1265,12 +1263,12 @@ Series has the :meth:`~Series.searchsorted` method, which works similar to
.. ipython:: python
- ser = Series([1, 2, 3])
+ ser = pd.Series([1, 2, 3])
ser.searchsorted([0, 3])
ser.searchsorted([0, 4])
ser.searchsorted([1, 3], side='right')
ser.searchsorted([1, 3], side='left')
- ser = Series([3, 1, 2])
+ ser = pd.Series([3, 1, 2])
ser.searchsorted([0, 3], sorter=np.argsort(ser))
.. _basics.nsorted:
@@ -1286,7 +1284,7 @@ faster than sorting the entire Series and calling ``head(n)`` on the result.
.. ipython:: python
- s = Series(np.random.permutation(10))
+ s = pd.Series(np.random.permutation(10))
s
s.order()
s.nsmallest(3)
@@ -1303,7 +1301,7 @@ all levels to ``by``.
.. ipython:: python
- df1.columns = MultiIndex.from_tuples([('a','one'),('a','two'),('b','three')])
+ df1.columns = pd.MultiIndex.from_tuples([('a','one'),('a','two'),('b','three')])
df1.sort_index(by=('a','two'))
@@ -1336,13 +1334,13 @@ attribute for DataFrames returns a Series with the data type of each column.
.. ipython:: python
- dft = DataFrame(dict( A = np.random.rand(3),
- B = 1,
- C = 'foo',
- D = Timestamp('20010102'),
- E = Series([1.0]*3).astype('float32'),
- F = False,
- G = Series([1]*3,dtype='int8')))
+ dft = pd.DataFrame(dict(A = np.random.rand(3),
+ B = 1,
+ C = 'foo',
+ D = pd.Timestamp('20010102'),
+ E = pd.Series([1.0]*3).astype('float32'),
+ F = False,
+ G = pd.Series([1]*3,dtype='int8')))
dft
dft.dtypes
@@ -1359,10 +1357,10 @@ general).
.. ipython:: python
# these ints are coerced to floats
- Series([1, 2, 3, 4, 5, 6.])
+ pd.Series([1, 2, 3, 4, 5, 6.])
# string data forces an ``object`` dtype
- Series([1, 2, 3, 6., 'foo'])
+ pd.Series([1, 2, 3, 6., 'foo'])
The method :meth:`~DataFrame.get_dtype_counts` will return the number of columns of
each type in a ``DataFrame``:
@@ -1378,12 +1376,12 @@ different numeric dtypes will **NOT** be combined. The following example will gi
.. ipython:: python
- df1 = DataFrame(randn(8, 1), columns = ['A'], dtype = 'float32')
+ df1 = pd.DataFrame(np.random.randn(8, 1), columns=['A'], dtype='float32')
df1
df1.dtypes
- df2 = DataFrame(dict( A = Series(randn(8),dtype='float16'),
- B = Series(randn(8)),
- C = Series(np.array(randn(8),dtype='uint8')) ))
+ df2 = pd.DataFrame(dict( A = pd.Series(np.random.randn(8), dtype='float16'),
+ B = pd.Series(np.random.randn(8)),
+ C = pd.Series(np.array(np.random.randn(8), dtype='uint8')) ))
df2
df2.dtypes
@@ -1395,16 +1393,16 @@ By default integer types are ``int64`` and float types are ``float64``,
.. ipython:: python
- DataFrame([1, 2], columns=['a']).dtypes
- DataFrame({'a': [1, 2]}).dtypes
- DataFrame({'a': 1 }, index=list(range(2))).dtypes
+ pd.DataFrame([1, 2], columns=['a']).dtypes
+ pd.DataFrame({'a': [1, 2]}).dtypes
+ pd.DataFrame({'a': 1 }, index=list(range(2))).dtypes
Numpy, however will choose *platform-dependent* types when creating arrays.
The following **WILL** result in ``int32`` on 32-bit platform.
.. ipython:: python
- frame = DataFrame(np.array([1, 2]))
+ frame = pd.DataFrame(np.array([1, 2]))
upcasting
@@ -1473,9 +1471,10 @@ but occasionally has non-dates intermixed and you want to represent as missing.
.. ipython:: python
- s = Series([datetime(2001,1,1,0,0),
- 'foo', 1.0, 1, Timestamp('20010104'),
- '20010105'],dtype='O')
+ import datetime
+ s = pd.Series([datetime.datetime(2001,1,1,0,0),
+ 'foo', 1.0, 1, pd.Timestamp('20010104'),
+ '20010105'], dtype='O')
s
s.convert_objects(convert_dates='coerce')
@@ -1527,14 +1526,14 @@ dtypes:
.. ipython:: python
- df = DataFrame({'string': list('abc'),
- 'int64': list(range(1, 4)),
- 'uint8': np.arange(3, 6).astype('u1'),
- 'float64': np.arange(4.0, 7.0),
- 'bool1': [True, False, True],
- 'bool2': [False, True, False],
- 'dates': pd.date_range('now', periods=3).values,
- 'category': pd.Categorical(list("ABC"))})
+ df = pd.DataFrame({'string': list('abc'),
+ 'int64': list(range(1, 4)),
+ 'uint8': np.arange(3, 6).astype('u1'),
+ 'float64': np.arange(4.0, 7.0),
+ 'bool1': [True, False, True],
+ 'bool2': [False, True, False],
+ 'dates': pd.date_range('now', periods=3).values,
+ 'category': pd.Series(list("ABC")).astype('category')})
df['tdeltas'] = df.dates.diff()
df['uint64'] = np.arange(3, 6).astype('u8')
df['other_dates'] = pd.date_range('20130101', periods=3).values
diff --git a/doc/source/categorical.rst b/doc/source/categorical.rst
index 11e7fb0fd4117..85fab1367114e 100644
--- a/doc/source/categorical.rst
+++ b/doc/source/categorical.rst
@@ -6,14 +6,10 @@
:suppress:
import numpy as np
- import random
- import os
- np.random.seed(123456)
- from pandas import options
- from pandas import *
import pandas as pd
+ np.random.seed(123456)
np.set_printoptions(precision=4, suppress=True)
- options.display.max_rows=15
+ pd.options.display.max_rows = 15
****************
@@ -65,14 +61,14 @@ By specifying ``dtype="category"`` when constructing a `Series`:
.. ipython:: python
- s = Series(["a","b","c","a"], dtype="category")
+ s = pd.Series(["a","b","c","a"], dtype="category")
s
By converting an existing `Series` or column to a ``category`` dtype:
.. ipython:: python
- df = DataFrame({"A":["a","b","c","a"]})
+ df = pd.DataFrame({"A":["a","b","c","a"]})
df["B"] = df["A"].astype('category')
df
@@ -80,7 +76,7 @@ By using some special functions:
.. ipython:: python
- df = DataFrame({'value': np.random.randint(0, 100, 20)})
+ df = pd.DataFrame({'value': np.random.randint(0, 100, 20)})
labels = [ "{0} - {1}".format(i, i + 9) for i in range(0, 100, 10) ]
df['group'] = pd.cut(df.value, range(0, 105, 10), right=False, labels=labels)
@@ -92,11 +88,11 @@ By passing a :class:`pandas.Categorical` object to a `Series` or assigning it to
.. ipython:: python
- raw_cat = Categorical(["a","b","c","a"], categories=["b","c","d"],
+ raw_cat = pd.Categorical(["a","b","c","a"], categories=["b","c","d"],
ordered=False)
- s = Series(raw_cat)
+ s = pd.Series(raw_cat)
s
- df = DataFrame({"A":["a","b","c","a"]})
+ df = pd.DataFrame({"A":["a","b","c","a"]})
df["B"] = raw_cat
df
@@ -104,7 +100,7 @@ You can also specify differently ordered categories or make the resulting data o
.. ipython:: python
- s = Series(["a","b","c","a"])
+ s = pd.Series(["a","b","c","a"])
s_cat = s.astype("category", categories=["b","c","d"], ordered=False)
s_cat
@@ -129,7 +125,7 @@ To get back to the original Series or `numpy` array, use ``Series.astype(origina
.. ipython:: python
- s = Series(["a","b","c","a"])
+ s = pd.Series(["a","b","c","a"])
s
s2 = s.astype('category')
s2
@@ -143,7 +139,7 @@ constructor to save the factorize step during normal constructor mode:
.. ipython:: python
splitter = np.random.choice([0,1], 5, p=[0.5,0.5])
- s = Series(Categorical.from_codes(splitter, categories=["train", "test"]))
+ s = pd.Series(pd.Categorical.from_codes(splitter, categories=["train", "test"]))
Description
-----------
@@ -153,8 +149,8 @@ Using ``.describe()`` on categorical data will produce similar output to a `Seri
.. ipython:: python
- cat = Categorical(["a","c","c",np.nan], categories=["b","a","c",np.nan] )
- df = DataFrame({"cat":cat, "s":["a","c","c",np.nan]})
+ cat = pd.Categorical(["a","c","c",np.nan], categories=["b","a","c",np.nan] )
+ df = pd.DataFrame({"cat":cat, "s":["a","c","c",np.nan]})
df.describe()
df["cat"].describe()
@@ -168,7 +164,7 @@ passed in values.
.. ipython:: python
- s = Series(["a","b","c","a"], dtype="category")
+ s = pd.Series(["a","b","c","a"], dtype="category")
s.cat.categories
s.cat.ordered
@@ -176,7 +172,7 @@ It's also possible to pass in the categories in a specific order:
.. ipython:: python
- s = Series(Categorical(["a","b","c","a"], categories=["c","b","a"]))
+ s = pd.Series(pd.Categorical(["a","b","c","a"], categories=["c","b","a"]))
s.cat.categories
s.cat.ordered
@@ -194,7 +190,7 @@ by using the :func:`Categorical.rename_categories` method:
.. ipython:: python
- s = Series(["a","b","c","a"], dtype="category")
+ s = pd.Series(["a","b","c","a"], dtype="category")
s
s.cat.categories = ["Group %s" % g for g in s.cat.categories]
s
@@ -247,7 +243,7 @@ Removing unused categories can also be done:
.. ipython:: python
- s = Series(Categorical(["a","b","a"], categories=["a","b","c","d"]))
+ s = pd.Series(pd.Categorical(["a","b","a"], categories=["a","b","c","d"]))
s
s.cat.remove_unused_categories()
@@ -259,7 +255,7 @@ or simply set the categories to a predefined scale, use :func:`Categorical.set_c
.. ipython:: python
- s = Series(["one","two","four", "-"], dtype="category")
+ s = pd.Series(["one","two","four", "-"], dtype="category")
s
s = s.cat.set_categories(["one","two","three","four"])
s
@@ -283,9 +279,9 @@ meaning and certain operations are possible. If the categorical is unordered, ``
.. ipython:: python
- s = Series(Categorical(["a","b","c","a"], ordered=False))
+ s = pd.Series(pd.Categorical(["a","b","c","a"], ordered=False))
s.sort()
- s = Series(["a","b","c","a"]).astype('category', ordered=True)
+ s = pd.Series(["a","b","c","a"]).astype('category', ordered=True)
s.sort()
s
s.min(), s.max()
@@ -303,7 +299,7 @@ This is even true for strings and numeric data:
.. ipython:: python
- s = Series([1,2,3,1], dtype="category")
+ s = pd.Series([1,2,3,1], dtype="category")
s = s.cat.set_categories([2,3,1], ordered=True)
s
s.sort()
@@ -321,7 +317,7 @@ necessarily make the sort order the same as the categories order.
.. ipython:: python
- s = Series([1,2,3,1], dtype="category")
+ s = pd.Series([1,2,3,1], dtype="category")
s = s.cat.reorder_categories([2,3,1], ordered=True)
s
s.sort()
@@ -351,8 +347,8 @@ The ordering of the categorical is determined by the ``categories`` of that colu
.. ipython:: python
- dfs = DataFrame({'A' : Categorical(list('bbeebbaa'), categories=['e','a','b'], ordered=True),
- 'B' : [1,2,1,2,2,1,2,1] })
+ dfs = pd.DataFrame({'A' : pd.Categorical(list('bbeebbaa'), categories=['e','a','b'], ordered=True),
+ 'B' : [1,2,1,2,2,1,2,1] })
dfs.sort(['A', 'B'])
Reordering the ``categories`` changes a future sort.
@@ -385,9 +381,9 @@ categories or a categorical with any list-like object, will raise a TypeError.
.. ipython:: python
- cat = Series([1,2,3]).astype("category", categories=[3,2,1], ordered=True)
- cat_base = Series([2,2,2]).astype("category", categories=[3,2,1], ordered=True)
- cat_base2 = Series([2,2,2]).astype("category", ordered=True)
+ cat = pd.Series([1,2,3]).astype("category", categories=[3,2,1], ordered=True)
+ cat_base = pd.Series([2,2,2]).astype("category", categories=[3,2,1], ordered=True)
+ cat_base2 = pd.Series([2,2,2]).astype("category", ordered=True)
cat
cat_base
@@ -443,19 +439,19 @@ present in the data:
.. ipython:: python
- s = Series(Categorical(["a","b","c","c"], categories=["c","a","b","d"]))
+ s = pd.Series(pd.Categorical(["a","b","c","c"], categories=["c","a","b","d"]))
s.value_counts()
Groupby will also show "unused" categories:
.. ipython:: python
- cats = Categorical(["a","b","b","b","c","c","c"], categories=["a","b","c","d"])
- df = DataFrame({"cats":cats,"values":[1,2,2,2,3,4,5]})
+ cats = pd.Categorical(["a","b","b","b","c","c","c"], categories=["a","b","c","d"])
+ df = pd.DataFrame({"cats":cats,"values":[1,2,2,2,3,4,5]})
df.groupby("cats").mean()
- cats2 = Categorical(["a","a","b","b"], categories=["a","b","c"])
- df2 = DataFrame({"cats":cats2,"B":["c","d","c","d"], "values":[1,2,3,4]})
+ cats2 = pd.Categorical(["a","a","b","b"], categories=["a","b","c"])
+ df2 = pd.DataFrame({"cats":cats2,"B":["c","d","c","d"], "values":[1,2,3,4]})
df2.groupby(["cats","B"]).mean()
@@ -463,8 +459,8 @@ Pivot tables:
.. ipython:: python
- raw_cat = Categorical(["a","a","b","b"], categories=["a","b","c"])
- df = DataFrame({"A":raw_cat,"B":["c","d","c","d"], "values":[1,2,3,4]})
+ raw_cat = pd.Categorical(["a","a","b","b"], categories=["a","b","c"])
+ df = pd.DataFrame({"A":raw_cat,"B":["c","d","c","d"], "values":[1,2,3,4]})
pd.pivot_table(df, values='values', index=['A', 'B'])
Data munging
@@ -482,10 +478,10 @@ the ``category`` dtype is preserved.
.. ipython:: python
- idx = Index(["h","i","j","k","l","m","n",])
- cats = Series(["a","b","b","b","c","c","c"], dtype="category", index=idx)
+ idx = pd.Index(["h","i","j","k","l","m","n",])
+ cats = pd.Series(["a","b","b","b","c","c","c"], dtype="category", index=idx)
values= [1,2,2,2,3,4,5]
- df = DataFrame({"cats":cats,"values":values}, index=idx)
+ df = pd.DataFrame({"cats":cats,"values":values}, index=idx)
df.iloc[2:4,:]
df.iloc[2:4,:].dtypes
df.loc["h":"j","cats"]
@@ -527,10 +523,10 @@ Setting values in a categorical column (or `Series`) works as long as the value
.. ipython:: python
- idx = Index(["h","i","j","k","l","m","n"])
- cats = Categorical(["a","a","a","a","a","a","a"], categories=["a","b"])
+ idx = pd.Index(["h","i","j","k","l","m","n"])
+ cats = pd.Categorical(["a","a","a","a","a","a","a"], categories=["a","b"])
values = [1,1,1,1,1,1,1]
- df = DataFrame({"cats":cats,"values":values}, index=idx)
+ df = pd.DataFrame({"cats":cats,"values":values}, index=idx)
df.iloc[2:4,:] = [["b",2],["b",2]]
df
@@ -543,10 +539,10 @@ Setting values by assigning categorical data will also check that the `categorie
.. ipython:: python
- df.loc["j":"k","cats"] = Categorical(["a","a"], categories=["a","b"])
+ df.loc["j":"k","cats"] = pd.Categorical(["a","a"], categories=["a","b"])
df
try:
- df.loc["j":"k","cats"] = Categorical(["b","b"], categories=["a","b","c"])
+ df.loc["j":"k","cats"] = pd.Categorical(["b","b"], categories=["a","b","c"])
except ValueError as e:
print("ValueError: " + str(e))
@@ -554,9 +550,9 @@ Assigning a `Categorical` to parts of a column of other types will use the value
.. ipython:: python
- df = DataFrame({"a":[1,1,1,1,1], "b":["a","a","a","a","a"]})
- df.loc[1:2,"a"] = Categorical(["b","b"], categories=["a","b"])
- df.loc[2:3,"b"] = Categorical(["b","b"], categories=["a","b"])
+ df = pd.DataFrame({"a":[1,1,1,1,1], "b":["a","a","a","a","a"]})
+ df.loc[1:2,"a"] = pd.Categorical(["b","b"], categories=["a","b"])
+ df.loc[2:3,"b"] = pd.Categorical(["b","b"], categories=["a","b"])
df
df.dtypes
@@ -569,9 +565,9 @@ but the categories of these categoricals need to be the same:
.. ipython:: python
- cat = Series(["a","b"], dtype="category")
+ cat = pd.Series(["a","b"], dtype="category")
vals = [1,2]
- df = DataFrame({"cats":cat, "vals":vals})
+ df = pd.DataFrame({"cats":cat, "vals":vals})
res = pd.concat([df,df])
res
res.dtypes
@@ -611,12 +607,12 @@ relevant columns back to `category` and assign the right categories and categori
.. ipython:: python
- s = Series(Categorical(['a', 'b', 'b', 'a', 'a', 'd']))
+ s = pd.Series(pd.Categorical(['a', 'b', 'b', 'a', 'a', 'd']))
# rename the categories
s.cat.categories = ["very good", "good", "bad"]
# reorder the categories and add missing categories
s = s.cat.set_categories(["very bad", "bad", "medium", "good", "very good"])
- df = DataFrame({"cats":s, "vals":[1,2,3,4,5,6]})
+ df = pd.DataFrame({"cats":s, "vals":[1,2,3,4,5,6]})
csv = StringIO()
df.to_csv(csv)
df2 = pd.read_csv(StringIO(csv.getvalue()))
@@ -643,10 +639,10 @@ available ("missing value") or `np.nan` is a valid category.
.. ipython:: python
- s = Series(["a","b",np.nan,"a"], dtype="category")
+ s = pd.Series(["a","b",np.nan,"a"], dtype="category")
# only two categories
s
- s2 = Series(["a","b","c","a"], dtype="category")
+ s2 = pd.Series(["a","b","c","a"], dtype="category")
s2.cat.categories = [1,2,np.nan]
# three categories, np.nan included
s2
@@ -660,11 +656,11 @@ available ("missing value") or `np.nan` is a valid category.
.. ipython:: python
- c = Series(["a","b",np.nan], dtype="category")
+ c = pd.Series(["a","b",np.nan], dtype="category")
c.cat.set_categories(["a","b",np.nan], inplace=True)
# will be inserted as a NA category:
c[0] = np.nan
- s = Series(c)
+ s = pd.Series(c)
s
pd.isnull(s)
s.fillna("a")
@@ -697,7 +693,7 @@ an ``object`` dtype is a constant times the length of the data.
.. ipython:: python
- s = Series(['foo','bar']*1000)
+ s = pd.Series(['foo','bar']*1000)
# object dtype
s.nbytes
@@ -712,7 +708,7 @@ an ``object`` dtype is a constant times the length of the data.
.. ipython:: python
- s = Series(['foo%04d' % i for i in range(2000)])
+ s = pd.Series(['foo%04d' % i for i in range(2000)])
# object dtype
s.nbytes
@@ -734,7 +730,7 @@ will work with the current pandas version, resulting in subtle bugs:
.. code-block:: python
- >>> cat = Categorical([1,2], [1,2,3])
+ >>> cat = pd.Categorical([1,2], [1,2,3])
>>> # old version
>>> cat.get_values()
array([2, 3], dtype=int64)
@@ -762,7 +758,7 @@ object and not as a low-level `numpy` array dtype. This leads to some problems.
except TypeError as e:
print("TypeError: " + str(e))
- dtype = Categorical(["a"]).dtype
+ dtype = pd.Categorical(["a"]).dtype
try:
np.dtype(dtype)
except TypeError as e:
@@ -780,15 +776,15 @@ To check if a Series contains Categorical data, with pandas 0.16 or later, use
.. ipython:: python
- hasattr(Series(['a'], dtype='category'), 'cat')
- hasattr(Series(['a']), 'cat')
+ hasattr(pd.Series(['a'], dtype='category'), 'cat')
+ hasattr(pd.Series(['a']), 'cat')
Using `numpy` functions on a `Series` of type ``category`` should not work as `Categoricals`
are not numeric data (even in the case that ``.categories`` is numeric).
.. ipython:: python
- s = Series(Categorical([1,2,3,4]))
+ s = pd.Series(pd.Categorical([1,2,3,4]))
try:
np.sum(s)
#same with np.log(s),..
@@ -807,9 +803,9 @@ basic type) and applying along columns will also convert to object.
.. ipython:: python
- df = DataFrame({"a":[1,2,3,4],
- "b":["a","b","c","d"],
- "cats":Categorical([1,2,3,2])})
+ df = pd.DataFrame({"a":[1,2,3,4],
+ "b":["a","b","c","d"],
+ "cats":pd.Categorical([1,2,3,2])})
df.apply(lambda row: type(row["cats"]), axis=1)
df.apply(lambda col: col.dtype, axis=0)
@@ -822,10 +818,10 @@ ordering of the categories:
.. ipython:: python
- cats = Categorical([1,2,3,4], categories=[4,2,3,1])
+ cats = pd.Categorical([1,2,3,4], categories=[4,2,3,1])
strings = ["a","b","c","d"]
values = [4,2,3,1]
- df = DataFrame({"strings":strings, "values":values}, index=cats)
+ df = pd.DataFrame({"strings":strings, "values":values}, index=cats)
df.index
# This should sort by categories but does not as there is no CategoricalIndex!
df.sort_index()
@@ -843,12 +839,12 @@ means that changes to the `Series` will in most cases change the original `Categ
.. ipython:: python
- cat = Categorical([1,2,3,10], categories=[1,2,3,4,10])
- s = Series(cat, name="cat")
+ cat = pd.Categorical([1,2,3,10], categories=[1,2,3,4,10])
+ s = pd.Series(cat, name="cat")
cat
s.iloc[0:2] = 10
cat
- df = DataFrame(s)
+ df = pd.DataFrame(s)
df["cat"].cat.categories = [1,2,3,4,5]
cat
@@ -856,8 +852,8 @@ Use ``copy=True`` to prevent such a behaviour or simply don't reuse `Categorical
.. ipython:: python
- cat = Categorical([1,2,3,10], categories=[1,2,3,4,10])
- s = Series(cat, name="cat", copy=True)
+ cat = pd.Categorical([1,2,3,10], categories=[1,2,3,4,10])
+ s = pd.Series(cat, name="cat", copy=True)
cat
s.iloc[0:2] = 10
cat
diff --git a/doc/source/computation.rst b/doc/source/computation.rst
index 4621d7bd9b216..dfb9fab19bf31 100644
--- a/doc/source/computation.rst
+++ b/doc/source/computation.rst
@@ -258,7 +258,7 @@ These functions can be applied to ndarrays or Series objects:
ts.plot(style='k--')
@savefig rolling_mean_ex.png
- rolling_mean(ts, 60).plot(style='k')
+ pd.rolling_mean(ts, 60).plot(style='k')
They can also be applied to DataFrame objects. This is really just syntactic
sugar for applying the moving window operator to all of the DataFrame's columns:
@@ -275,7 +275,7 @@ sugar for applying the moving window operator to all of the DataFrame's columns:
df = df.cumsum()
@savefig rolling_mean_frame.png
- rolling_sum(df, 60).plot(subplots=True)
+ pd.rolling_sum(df, 60).plot(subplots=True)
The ``rolling_apply`` function takes an extra ``func`` argument and performs
generic rolling computations. The ``func`` argument should be a single function
@@ -286,7 +286,7 @@ compute the mean absolute deviation on a rolling basis:
mad = lambda x: np.fabs(x - x.mean()).mean()
@savefig rolling_apply_ex.png
- rolling_apply(ts, 60, mad).plot(style='k')
+ pd.rolling_apply(ts, 60, mad).plot(style='k')
The ``rolling_window`` function performs a generic rolling window computation
on the input data. The weights used in the window are specified by the ``win_type``
@@ -311,21 +311,21 @@ keyword. The list of recognized types are:
ser = pd.Series(np.random.randn(10), index=pd.date_range('1/1/2000', periods=10))
- rolling_window(ser, 5, 'triang')
+ pd.rolling_window(ser, 5, 'triang')
Note that the ``boxcar`` window is equivalent to ``rolling_mean``.
.. ipython:: python
- rolling_window(ser, 5, 'boxcar')
+ pd.rolling_window(ser, 5, 'boxcar')
- rolling_mean(ser, 5)
+ pd.rolling_mean(ser, 5)
For some windowing functions, additional parameters must be specified:
.. ipython:: python
- rolling_window(ser, 5, 'gaussian', std=0.1)
+ pd.rolling_window(ser, 5, 'gaussian', std=0.1)
By default the labels are set to the right edge of the window, but a
``center`` keyword is available so the labels can be set at the center.
@@ -333,11 +333,11 @@ This keyword is available in other rolling functions as well.
.. ipython:: python
- rolling_window(ser, 5, 'boxcar')
+ pd.rolling_window(ser, 5, 'boxcar')
- rolling_window(ser, 5, 'boxcar', center=True)
+ pd.rolling_window(ser, 5, 'boxcar', center=True)
- rolling_mean(ser, 5, center=True)
+ pd.rolling_mean(ser, 5, center=True)
.. _stats.moments.normalization:
@@ -376,7 +376,7 @@ For example:
.. ipython:: python
df2 = df[:20]
- rolling_corr(df2, df2['B'], window=5)
+ pd.rolling_corr(df2, df2['B'], window=5)
.. _stats.moments.corr_pairwise:
@@ -401,12 +401,12 @@ can even be omitted:
.. ipython:: python
- covs = rolling_cov(df[['B','C','D']], df[['A','B','C']], 50, pairwise=True)
+ covs = pd.rolling_cov(df[['B','C','D']], df[['A','B','C']], 50, pairwise=True)
covs[df.index[-50]]
.. ipython:: python
- correls = rolling_corr(df, 50)
+ correls = pd.rolling_corr(df, 50)
correls[df.index[-50]]
.. note::
@@ -440,9 +440,9 @@ they are implemented in pandas such that the following two calls are equivalent:
.. ipython:: python
- rolling_mean(df, window=len(df), min_periods=1)[:5]
+ pd.rolling_mean(df, window=len(df), min_periods=1)[:5]
- expanding_mean(df)[:5]
+ pd.expanding_mean(df)[:5]
Like the ``rolling_`` functions, the following methods are included in the
``pandas`` namespace or can be located in ``pandas.stats.moments``.
@@ -501,7 +501,7 @@ relative impact of an individual data point. As an example, here is the
ts.plot(style='k--')
@savefig expanding_mean_frame.png
- expanding_mean(ts).plot(style='k')
+ pd.expanding_mean(ts).plot(style='k')
.. _stats.moments.exponentially_weighted:
@@ -583,7 +583,7 @@ Here is an example for a univariate time series:
ts.plot(style='k--')
@savefig ewma_ex.png
- ewma(ts, span=20).plot(style='k')
+ pd.ewma(ts, span=20).plot(style='k')
All the EW functions have a ``min_periods`` argument, which has the same
meaning it does for all the ``expanding_`` and ``rolling_`` functions:
| Further work on #9886
| https://api.github.com/repos/pandas-dev/pandas/pulls/10136 | 2015-05-14T15:53:07Z | 2015-05-19T21:21:48Z | 2015-05-19T21:21:48Z | 2015-06-02T19:26:11Z |
(WIP) PERF: improve .str perf for all-string values (about 2x-) | diff --git a/pandas/core/strings.py b/pandas/core/strings.py
index 8da43c18b989f..6bffeebf00d9a 100644
--- a/pandas/core/strings.py
+++ b/pandas/core/strings.py
@@ -116,12 +116,12 @@ def _length_check(others):
return n
-def _na_map(f, arr, na_result=np.nan, dtype=object):
+def _na_map(f, arr, na_result=np.nan, dtype=object, np_f=None):
# should really _check_ for NA
- return _map(f, arr, na_mask=True, na_value=na_result, dtype=dtype)
+ return _map(f, arr, na_mask=True, na_value=na_result, dtype=dtype, np_f=np_f)
-def _map(f, arr, na_mask=False, na_value=np.nan, dtype=object):
+def _map(f, arr, na_mask=False, na_value=np.nan, dtype=object, np_f=None):
from pandas.core.series import Series
if not len(arr):
@@ -131,6 +131,14 @@ def _map(f, arr, na_mask=False, na_value=np.nan, dtype=object):
arr = arr.values
if not isinstance(arr, np.ndarray):
arr = np.asarray(arr, dtype=object)
+
+ # short path for all-string array
+ if np_f is not None and lib.is_string_array(arr):
+ try:
+ return np_f(arr.astype(unicode))
+ except Exception:
+ pass
+
if na_mask:
mask = isnull(arr)
try:
@@ -686,14 +694,17 @@ def str_pad(arr, width, side='left', fillchar=' '):
if side == 'left':
f = lambda x: x.rjust(width, fillchar)
+ np_f = lambda x: np.core.defchararray.ljust(x, width, fillchar)
elif side == 'right':
f = lambda x: x.ljust(width, fillchar)
+ np_f = lambda x: np.core.defchararray.rjust(x, width, fillchar)
elif side == 'both':
f = lambda x: x.center(width, fillchar)
+ np_f = lambda x: np.core.defchararray.lower(x, width, fillchar)
else: # pragma: no cover
raise ValueError('Invalid side')
- return _na_map(f, arr)
+ return _na_map(f, arr, np_f=np_f)
def str_split(arr, pat=None, n=None):
@@ -720,17 +731,21 @@ def str_split(arr, pat=None, n=None):
if n is None or n == 0:
n = -1
f = lambda x: x.split(pat, n)
+ np_f = lambda x: np.core.defchararray.split(x, pat, n)
else:
if len(pat) == 1:
if n is None or n == 0:
n = -1
f = lambda x: x.split(pat, n)
+ np_f = lambda x: np.core.defchararray.split(x, pat, n)
else:
if n is None or n == -1:
n = 0
regex = re.compile(pat)
f = lambda x: regex.split(x, maxsplit=n)
- res = _na_map(f, arr)
+ # numpy doesn't support regex
+ np_f = None
+ res = _na_map(f, arr, np_f=np_f)
return res
@@ -946,7 +961,8 @@ def str_decode(arr, encoding, errors="strict"):
decoded : Series/Index of objects
"""
f = lambda x: x.decode(encoding, errors)
- return _na_map(f, arr)
+ np_f = lambda x: np.core.defchararray.decode(x, errors)
+ return _na_map(f, arr, np_f=np_f)
def str_encode(arr, encoding, errors="strict"):
@@ -964,12 +980,13 @@ def str_encode(arr, encoding, errors="strict"):
encoded : Series/Index of objects
"""
f = lambda x: x.encode(encoding, errors)
- return _na_map(f, arr)
+ np_f = lambda x: np.core.defchararray.encode(x, errors)
+ return _na_map(f, arr, np_f=np_f)
-def _noarg_wrapper(f, docstring=None, **kargs):
+def _noarg_wrapper(f, docstring=None, np_f=None, **kargs):
def wrapper(self):
- result = _na_map(f, self.series, **kargs)
+ result = _na_map(f, self.series, np_f=np_f, **kargs)
return self._wrap_result(result)
wrapper.__name__ = f.__name__
@@ -1443,7 +1460,8 @@ def rindex(self, sub, start=0, end=None):
_shared_docs['swapcase'] = dict(type='be swapcased', method='swapcase')
lower = _noarg_wrapper(lambda x: x.lower(),
docstring=_shared_docs['casemethods'] %
- _shared_docs['lower'])
+ _shared_docs['lower'],
+ np_f=np.core.defchararray.lower)
upper = _noarg_wrapper(lambda x: x.upper(),
docstring=_shared_docs['casemethods'] %
_shared_docs['upper'])
@@ -1452,7 +1470,8 @@ def rindex(self, sub, start=0, end=None):
_shared_docs['title'])
capitalize = _noarg_wrapper(lambda x: x.capitalize(),
docstring=_shared_docs['casemethods'] %
- _shared_docs['capitalize'])
+ _shared_docs['capitalize'],
+ np_f=np.core.defchararray.capitalize)
swapcase = _noarg_wrapper(lambda x: x.swapcase(),
docstring=_shared_docs['casemethods'] %
_shared_docs['swapcase'])
| Related to #10081. Make a short path using numpy's string funcs when all the target values are strings. Otherwise, use current path.
Followings are current comparison results:
```
import pandas as pd
import numpy as np
import string
import random
np.random.seed(1)
s = [''.join([random.choice(string.ascii_letters + string.digits) for i in range(3)]) for i in range(1000000)]
# s_str uses short path
s_str = pd.Series(s)
# set object
s[-1] = 1
# s_obj uses current path
s_obj = pd.Series(s)
```
```
%timeit s_str.str.lower()
#1 loops, best of 3: 696 ms per loop
%timeit s_obj.str.lower()
#1 loops, best of 3: 1.46 s per loop
%timeit s_str.str.split('a')
#1 loops, best of 3: 1.55 s per loop
%timeit s_obj.str.split('a')
#1 loops, best of 3: 3.52 s per loop
```
The logic has an overhead to check whether target values are all-string using `lib.is_string_array`. But this should be speed-up in most cases because it takes relatively shorter time than string ops, and (I believe) values should be all-string in most cases.
```
%timeit pd.lib.is_string_array(s_str.values)
#10 loops, best of 3: 21.9 ms per loop
```
If it looks OK, I'll work on all the funcs which is supported by numpy.
- [ ] Add all numpy funcs
- http://docs.scipy.org/doc/numpy/reference/routines.char.html
- [ ] Add tests to check numpy results for all-string values are identical as current results.
- [ ] Add vbench (both for all-string and object-included)
| https://api.github.com/repos/pandas-dev/pandas/pulls/10135 | 2015-05-14T14:53:02Z | 2015-05-14T15:55:15Z | null | 2023-05-11T01:12:58Z |
BUG: Strings with exponent but no decimal point parsed as integers in python csv engine | diff --git a/doc/source/whatsnew/v0.16.2.txt b/doc/source/whatsnew/v0.16.2.txt
index f1c5b0c854055..a3eb19d92d48a 100644
--- a/doc/source/whatsnew/v0.16.2.txt
+++ b/doc/source/whatsnew/v0.16.2.txt
@@ -77,6 +77,8 @@ Bug Fixes
- Bug in `plot` not defaulting to matplotlib `axes.grid` setting (:issue:`9792`)
+- Bug causing strings containing an exponent but no decimal to be parsed as ints instead of floats in python csv parser. (:issue:`9565`)
+
- Bug in ``Series.align`` resets ``name`` when ``fill_value`` is specified (:issue:`10067`)
- Bug in ``SparseSeries.abs`` resets ``name`` (:issue:`10241`)
diff --git a/pandas/io/tests/test_parsers.py b/pandas/io/tests/test_parsers.py
index 7d52c6ad4cb3b..88bf3bc90324f 100755
--- a/pandas/io/tests/test_parsers.py
+++ b/pandas/io/tests/test_parsers.py
@@ -35,7 +35,7 @@
from numpy.testing.decorators import slow
from numpy.testing import assert_array_equal
-from pandas.parser import OverflowError, CParserError
+import pandas.parser
class ParserTests(object):
@@ -1648,7 +1648,7 @@ def test_read_table_buglet_4x_multiindex(self):
# Temporarily copied to TestPythonParser.
# Here test that CParserError is raised:
- with tm.assertRaises(CParserError):
+ with tm.assertRaises(pandas.parser.CParserError):
text = """ A B C D E
one two three four
a b 10.0032 5 -0.5109 -2.3358 -0.4645 0.05076 0.3640
@@ -2293,6 +2293,46 @@ def test_chunk_begins_with_newline_whitespace(self):
result = self.read_csv(StringIO(data), header=None)
self.assertEqual(len(result), 2)
+ def test_float_parser(self):
+ # GH 9565
+ data = '45e-1,4.5,45.,inf,-inf'
+ result = self.read_csv(StringIO(data), header=None)
+ expected = pd.DataFrame([[float(s) for s in data.split(',')]])
+ tm.assert_frame_equal(result, expected)
+
+ def test_int64_overflow(self):
+ data = """ID
+00013007854817840016671868
+00013007854817840016749251
+00013007854817840016754630
+00013007854817840016781876
+00013007854817840017028824
+00013007854817840017963235
+00013007854817840018860166"""
+
+ result = self.read_csv(StringIO(data))
+ self.assertTrue(result['ID'].dtype == object)
+
+ self.assertRaises((OverflowError, pandas.parser.OverflowError),
+ self.read_csv, StringIO(data),
+ converters={'ID' : np.int64})
+
+ # Just inside int64 range: parse as integer
+ i_max = np.iinfo(np.int64).max
+ i_min = np.iinfo(np.int64).min
+ for x in [i_max, i_min]:
+ result = pd.read_csv(StringIO(str(x)), header=None)
+ expected = pd.DataFrame([x])
+ tm.assert_frame_equal(result, expected)
+
+ # Just outside int64 range: parse as string
+ too_big = i_max + 1
+ too_small = i_min - 1
+ for x in [too_big, too_small]:
+ result = pd.read_csv(StringIO(str(x)), header=None)
+ expected = pd.DataFrame([str(x)])
+ tm.assert_frame_equal(result, expected)
+
class TestPythonParser(ParserTests, tm.TestCase):
def test_negative_skipfooter_raises(self):
@@ -3567,22 +3607,6 @@ def test_disable_bool_parsing(self):
result = read_csv(StringIO(data), dtype=object, na_filter=False)
self.assertEqual(result['B'][2], '')
- def test_int64_overflow(self):
- data = """ID
-00013007854817840016671868
-00013007854817840016749251
-00013007854817840016754630
-00013007854817840016781876
-00013007854817840017028824
-00013007854817840017963235
-00013007854817840018860166"""
-
- result = read_csv(StringIO(data))
- self.assertTrue(result['ID'].dtype == object)
-
- self.assertRaises(OverflowError, read_csv, StringIO(data),
- dtype='i8')
-
def test_euro_decimal_format(self):
data = """Id;Number1;Number2;Text1;Text2;Number3
1;1521,1541;187101,9543;ABC;poi;4,738797819
diff --git a/pandas/src/inference.pyx b/pandas/src/inference.pyx
index 55d5e37fc19ee..9ee5a753af567 100644
--- a/pandas/src/inference.pyx
+++ b/pandas/src/inference.pyx
@@ -514,11 +514,10 @@ def is_period_array(ndarray[object] values):
cdef extern from "parse_helper.h":
- inline int floatify(object, double *result) except -1
-
-cdef double fINT64_MAX = <double> INT64_MAX
-cdef double fINT64_MIN = <double> INT64_MIN
+ inline int floatify(object, double *result, int *maybe_int) except -1
+cdef int64_t iINT64_MAX = <int64_t> INT64_MAX
+cdef int64_t iINT64_MIN = <int64_t> INT64_MIN
def maybe_convert_numeric(object[:] values, set na_values,
bint convert_empty=True, bint coerce_numeric=False):
@@ -527,7 +526,7 @@ def maybe_convert_numeric(object[:] values, set na_values,
convert to proper dtype array
'''
cdef:
- int status
+ int status, maybe_int
Py_ssize_t i, n = values.size
ndarray[float64_t] floats = np.empty(n, dtype='f8')
ndarray[complex128_t] complexes = np.empty(n, dtype='c16')
@@ -569,18 +568,16 @@ def maybe_convert_numeric(object[:] values, set na_values,
seen_complex = True
else:
try:
- status = floatify(val, &fval)
+ status = floatify(val, &fval, &maybe_int)
floats[i] = fval
if not seen_float:
- if '.' in val or fval == INF or fval == NEGINF:
- seen_float = True
- elif 'inf' in val: # special case to handle +/-inf
- seen_float = True
- elif fval < fINT64_MAX and fval > fINT64_MIN:
- try:
- ints[i] = int(val)
- except ValueError:
- ints[i] = <int64_t> fval
+ if maybe_int:
+ as_int = int(val)
+
+ if as_int <= iINT64_MAX and as_int >= iINT64_MIN:
+ ints[i] = as_int
+ else:
+ raise ValueError('integer out of range')
else:
seen_float = True
except:
diff --git a/pandas/src/parse_helper.h b/pandas/src/parse_helper.h
index 763cbc03a9cbe..2769f67fcf521 100644
--- a/pandas/src/parse_helper.h
+++ b/pandas/src/parse_helper.h
@@ -2,13 +2,13 @@
#include <float.h>
static double xstrtod(const char *p, char **q, char decimal, char sci,
- int skip_trailing);
+ int skip_trailing, int *maybe_int);
-int to_double(char *item, double *p_value, char sci, char decimal)
+int to_double(char *item, double *p_value, char sci, char decimal, int *maybe_int)
{
char *p_end;
- *p_value = xstrtod(item, &p_end, decimal, sci, 1);
+ *p_value = xstrtod(item, &p_end, decimal, sci, 1, maybe_int);
return (errno == 0) && (!*p_end);
}
@@ -18,7 +18,7 @@ int to_double(char *item, double *p_value, char sci, char decimal)
#define PyBytes_AS_STRING PyString_AS_STRING
#endif
-int floatify(PyObject* str, double *result) {
+int floatify(PyObject* str, double *result, int *maybe_int) {
int status;
char *data;
PyObject* tmp = NULL;
@@ -35,14 +35,16 @@ int floatify(PyObject* str, double *result) {
return -1;
}
- status = to_double(data, result, sci, dec);
+ status = to_double(data, result, sci, dec, maybe_int);
if (!status) {
/* handle inf/-inf */
if (0 == strcmp(data, "-inf")) {
*result = -HUGE_VAL;
+ *maybe_int = 0;
} else if (0 == strcmp(data, "inf")) {
*result = HUGE_VAL;
+ *maybe_int = 0;
} else {
PyErr_SetString(PyExc_ValueError, "Unable to parse string");
Py_XDECREF(tmp);
@@ -117,7 +119,7 @@ PANDAS_INLINE void uppercase(char *p) {
static double xstrtod(const char *str, char **endptr, char decimal,
- char sci, int skip_trailing)
+ char sci, int skip_trailing, int *maybe_int)
{
double number;
int exponent;
@@ -129,6 +131,7 @@ static double xstrtod(const char *str, char **endptr, char decimal,
int num_decimals;
errno = 0;
+ *maybe_int = 1;
// Skip leading whitespace
while (isspace(*p)) p++;
@@ -157,6 +160,7 @@ static double xstrtod(const char *str, char **endptr, char decimal,
// Process decimal part
if (*p == decimal)
{
+ *maybe_int = 0;
p++;
while (isdigit(*p))
@@ -182,6 +186,8 @@ static double xstrtod(const char *str, char **endptr, char decimal,
// Process an exponent string
if (toupper(*p) == toupper(sci))
{
+ *maybe_int = 0;
+
// Handle optional sign
negative = 0;
switch (*++p)
| Fixes GH #9565. I also made the handling of out-of-range integers consistent with the C engine: parse as a string rather than a double.
| https://api.github.com/repos/pandas-dev/pandas/pulls/10133 | 2015-05-14T12:57:00Z | 2015-06-09T10:49:18Z | null | 2015-06-10T13:40:52Z |
BUG: get_group fails when multi-grouping with a categorical | diff --git a/doc/source/whatsnew/v0.16.2.txt b/doc/source/whatsnew/v0.16.2.txt
index f1c5b0c854055..f5c9d15de65f6 100644
--- a/doc/source/whatsnew/v0.16.2.txt
+++ b/doc/source/whatsnew/v0.16.2.txt
@@ -68,7 +68,9 @@ Bug Fixes
- Bug in getting timezone data with ``dateutil`` on various platforms ( :issue:`9059`, :issue:`8639`, :issue:`9663`, :issue:`10121`)
- Bug in display datetimes with mixed frequencies uniformly; display 'ms' datetimes to the proper precision. (:issue:`10170`)
-- Bung in ``Series`` arithmetic methods may incorrectly hold names (:issue:`10068`)
+- Bug in ``Series`` arithmetic methods may incorrectly hold names (:issue:`10068`)
+
+- Bug in ``GroupBy.get_group`` when grouping on multiple keys, one of which is categorical. (:issue:`10132`)
- Bug in ``DatetimeIndex`` and ``TimedeltaIndex`` names are lost after timedelta arithmetics ( :issue:`9926`)
diff --git a/pandas/core/index.py b/pandas/core/index.py
index 2bd96fcec2e42..1483ca9a47b46 100644
--- a/pandas/core/index.py
+++ b/pandas/core/index.py
@@ -2964,6 +2964,10 @@ def values(self):
""" return the underlying data, which is a Categorical """
return self._data
+ def get_values(self):
+ """ return the underlying data as an ndarray """
+ return self._data.get_values()
+
@property
def codes(self):
return self._data.codes
diff --git a/pandas/tests/test_groupby.py b/pandas/tests/test_groupby.py
index 0789e20df3945..a13922acfb3f0 100644
--- a/pandas/tests/test_groupby.py
+++ b/pandas/tests/test_groupby.py
@@ -5140,6 +5140,13 @@ def test_groupby_categorical_two_columns(self):
"ints": [1,2,1,2,1,2]}).set_index(["cat","ints"])
tm.assert_frame_equal(res, exp)
+ # GH 10132
+ for key in [('a', 1), ('b', 2), ('b', 1), ('a', 2)]:
+ c, i = key
+ result = groups_double_key.get_group(key)
+ expected = test[(test.cat == c) & (test.ints == i)]
+ assert_frame_equal(result, expected)
+
d = {'C1': [3, 3, 4, 5], 'C2': [1, 2, 3, 4], 'C3': [10, 100, 200, 34]}
test = pd.DataFrame(d)
values = pd.cut(test['C1'], [1, 2, 3, 6])
| Example:
``` .python
>>> df = pd.DataFrame({'a' : pd.Categorical('xyxy'), 'b' : 1, 'c' : 2})
>>> df.groupby(['a', 'b']).get_group(('x', 1))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/evanpw/Workspace/pandas/pandas/core/groupby.py", line 601, in get_group
inds = self._get_index(name)
File "/home/evanpw/Workspace/pandas/pandas/core/groupby.py", line 429, in _get_index
sample = next(iter(self.indices))
File "/home/evanpw/Workspace/pandas/pandas/core/groupby.py", line 414, in indices
return self.grouper.indices
File "pandas/src/properties.pyx", line 34, in pandas.lib.cache_readonly.__get__ (pandas/lib.c:41912)
File "/home/evanpw/Workspace/pandas/pandas/core/groupby.py", line 1305, in indices
return _get_indices_dict(label_list, keys)
File "/home/evanpw/Workspace/pandas/pandas/core/groupby.py", line 3762, in _get_indices_dict
return lib.indices_fast(sorter, group_index, keys, sorted_labels)
File "pandas/lib.pyx", line 1385, in pandas.lib.indices_fast (pandas/lib.c:23843)
TypeError: Cannot convert Categorical to numpy.ndarray
```
The problem is that `Grouping.group_index` is a CategoricalIndex, so calling `get_values()` gives you a `Categorical`, which needs one more application of `get_values()` to get an `ndarray`
| https://api.github.com/repos/pandas-dev/pandas/pulls/10132 | 2015-05-14T10:42:15Z | 2015-06-05T22:03:42Z | 2015-06-05T22:03:42Z | 2015-09-19T00:38:07Z |
BUG: fix Series.plot label setting | diff --git a/doc/source/whatsnew/v0.17.0.txt b/doc/source/whatsnew/v0.17.0.txt
index b835733db6f00..f74bd70abb3a8 100644
--- a/doc/source/whatsnew/v0.17.0.txt
+++ b/doc/source/whatsnew/v0.17.0.txt
@@ -72,3 +72,7 @@ Bug Fixes
- Bug in ``DatetimeIndex`` and ``TimedeltaIndex`` names are lost after timedelta arithmetics ( :issue:`9926`)
+
+- Bug in `Series.plot(label="LABEL")` not correctly setting the label (:issue:`10119`)
+
+
diff --git a/pandas/tests/test_graphics.py b/pandas/tests/test_graphics.py
index 33c88b0e3b4b7..4c9d5a9207dd7 100644
--- a/pandas/tests/test_graphics.py
+++ b/pandas/tests/test_graphics.py
@@ -553,6 +553,29 @@ def test_ts_area_lim(self):
self.assertEqual(xmin, line[0])
self.assertEqual(xmax, line[-1])
+ def test_label(self):
+ s = Series([1, 2])
+ ax = s.plot(label='LABEL', legend=True)
+ self._check_legend_labels(ax, labels=['LABEL'])
+ self.plt.close()
+ ax = s.plot(legend=True)
+ self._check_legend_labels(ax, labels=['None'])
+ self.plt.close()
+ # get name from index
+ s.name = 'NAME'
+ ax = s.plot(legend=True)
+ self._check_legend_labels(ax, labels=['NAME'])
+ self.plt.close()
+ # override the default
+ ax = s.plot(legend=True, label='LABEL')
+ self._check_legend_labels(ax, labels=['LABEL'])
+ self.plt.close()
+ # Add lebel info, but don't draw
+ ax = s.plot(legend=False, label='LABEL')
+ self.assertEqual(ax.get_legend(), None) # Hasn't been drawn
+ ax.legend() # draw it
+ self._check_legend_labels(ax, labels=['LABEL'])
+
def test_line_area_nan_series(self):
values = [1, 2, np.nan, 3]
s = Series(values)
diff --git a/pandas/tools/plotting.py b/pandas/tools/plotting.py
index f92f398d9be94..04dd4d3395684 100644
--- a/pandas/tools/plotting.py
+++ b/pandas/tools/plotting.py
@@ -999,7 +999,7 @@ def _compute_plot_data(self):
data = self.data
if isinstance(data, Series):
- label = self.kwds.pop('label', None)
+ label = self.label
if label is None and data.name is None:
label = 'None'
data = data.to_frame(name=label)
| Closes https://github.com/pydata/pandas/issues/10119, a regression in 0.16.1
Basically `Series.plot(label='foo')` isn't actually setting the label.
I want to look at one more thing. With this fix you'd need
``` python
s.plot(label='foo', legend=True
```
to get the legend to actually show up. I can't remember what the old behavior was. At least for seaborn, setting a label implies that the legend should be drawn (e.g. `sns.kdeplot(s, label='foo')`)
| https://api.github.com/repos/pandas-dev/pandas/pulls/10131 | 2015-05-14T02:56:38Z | 2015-05-19T12:27:19Z | 2015-05-19T12:27:19Z | 2015-08-18T12:44:40Z |
CLN: clean up unused imports | diff --git a/pandas/core/base.py b/pandas/core/base.py
index 2f171cdd6adf3..540b900844a9e 100644
--- a/pandas/core/base.py
+++ b/pandas/core/base.py
@@ -1,13 +1,10 @@
"""
Base and utility classes for pandas objects.
"""
-import datetime
-
from pandas import compat
import numpy as np
from pandas.core import common as com
import pandas.core.nanops as nanops
-import pandas.tslib as tslib
import pandas.lib as lib
from pandas.util.decorators import Appender, cache_readonly
from pandas.core.strings import StringMethods
diff --git a/pandas/core/categorical.py b/pandas/core/categorical.py
index 97368baffd40b..b0fbce55bbf34 100644
--- a/pandas/core/categorical.py
+++ b/pandas/core/categorical.py
@@ -18,7 +18,7 @@
_possibly_infer_to_datetimelike, get_dtype_kinds,
is_list_like, is_sequence, is_null_slice, is_bool,
_ensure_platform_int, _ensure_object, _ensure_int64,
- _coerce_indexer_dtype, _values_from_object, take_1d)
+ _coerce_indexer_dtype, take_1d)
from pandas.util.terminal import get_terminal_size
from pandas.core.config import get_option
diff --git a/pandas/core/frame.py b/pandas/core/frame.py
index 7cce560baa1fc..21cabdbe03951 100644
--- a/pandas/core/frame.py
+++ b/pandas/core/frame.py
@@ -26,8 +26,9 @@
from pandas.core.common import (isnull, notnull, PandasError, _try_sort,
_default_index, _maybe_upcast, is_sequence,
_infer_dtype_from_scalar, _values_from_object,
- is_list_like, _get_dtype, _maybe_box_datetimelike,
- is_categorical_dtype, is_object_dtype, _possibly_infer_to_datetimelike)
+ is_list_like, _maybe_box_datetimelike,
+ is_categorical_dtype, is_object_dtype,
+ _possibly_infer_to_datetimelike)
from pandas.core.generic import NDFrame, _shared_docs
from pandas.core.index import Index, MultiIndex, _ensure_index
from pandas.core.indexing import (maybe_droplevels,
diff --git a/pandas/core/generic.py b/pandas/core/generic.py
index 4fb08a7b7e107..a560dd4c00be7 100644
--- a/pandas/core/generic.py
+++ b/pandas/core/generic.py
@@ -17,7 +17,7 @@
import pandas.core.common as com
import pandas.core.datetools as datetools
from pandas import compat
-from pandas.compat import map, zip, lrange, string_types, isidentifier, lmap
+from pandas.compat import map, zip, lrange, string_types, isidentifier
from pandas.core.common import (isnull, notnull, is_list_like,
_values_from_object, _maybe_promote,
_maybe_box_datetimelike, ABCSeries,
diff --git a/pandas/core/groupby.py b/pandas/core/groupby.py
index 1f76d80c34a90..ac2d4d57cd2b2 100644
--- a/pandas/core/groupby.py
+++ b/pandas/core/groupby.py
@@ -14,7 +14,7 @@
from pandas.core.categorical import Categorical
from pandas.core.frame import DataFrame
from pandas.core.generic import NDFrame
-from pandas.core.index import Index, MultiIndex, CategoricalIndex, _ensure_index, _union_indexes
+from pandas.core.index import Index, MultiIndex, CategoricalIndex, _ensure_index
from pandas.core.internals import BlockManager, make_block
from pandas.core.series import Series
from pandas.core.panel import Panel
diff --git a/pandas/core/index.py b/pandas/core/index.py
index 21f1fed2cd6da..de30fee4009f4 100644
--- a/pandas/core/index.py
+++ b/pandas/core/index.py
@@ -8,7 +8,6 @@
from pandas import compat
import numpy as np
-from math import ceil
from sys import getsizeof
import pandas.tslib as tslib
import pandas.lib as lib
diff --git a/pandas/core/indexing.py b/pandas/core/indexing.py
index 7c373b0a2b01d..e0f06e22c431b 100644
--- a/pandas/core/indexing.py
+++ b/pandas/core/indexing.py
@@ -1,7 +1,6 @@
# pylint: disable=W0223
-from datetime import datetime
-from pandas.core.index import Index, MultiIndex, _ensure_index
+from pandas.core.index import Index, MultiIndex
from pandas.compat import range, zip
import pandas.compat as compat
import pandas.core.common as com
@@ -10,8 +9,6 @@
is_null_slice,
ABCSeries, ABCDataFrame, ABCPanel, is_float,
_values_from_object, _infer_fill_value, is_integer)
-import pandas.lib as lib
-
import numpy as np
# the supported indexers
diff --git a/pandas/core/nanops.py b/pandas/core/nanops.py
index 4121dd8e89bee..e921a9d562bc1 100644
--- a/pandas/core/nanops.py
+++ b/pandas/core/nanops.py
@@ -1,7 +1,5 @@
-import sys
import itertools
import functools
-
import numpy as np
try:
@@ -10,7 +8,6 @@
except ImportError: # pragma: no cover
_USE_BOTTLENECK = False
-import pandas.core.common as com
import pandas.hashtable as _hash
from pandas import compat, lib, algos, tslib
from pandas.compat import builtins
diff --git a/pandas/core/panel.py b/pandas/core/panel.py
index 2cd2412cfac66..1215efe3a4db6 100644
--- a/pandas/core/panel.py
+++ b/pandas/core/panel.py
@@ -6,7 +6,6 @@
from pandas.compat import (map, zip, range, lrange, lmap, u, OrderedDict,
OrderedDefaultdict)
from pandas import compat
-import sys
import warnings
import numpy as np
from pandas.core.common import (PandasError, _try_sort, _default_index,
@@ -27,7 +26,6 @@
deprecate_kwarg)
import pandas.core.common as com
import pandas.core.ops as ops
-import pandas.core.nanops as nanops
import pandas.computation.expressions as expressions
from pandas import lib
diff --git a/pandas/core/panelnd.py b/pandas/core/panelnd.py
index d021cb2d59ecf..35e6412efc760 100644
--- a/pandas/core/panelnd.py
+++ b/pandas/core/panelnd.py
@@ -1,6 +1,5 @@
""" Factory methods to create N-D panels """
-import pandas.lib as lib
from pandas.compat import zip
import pandas.compat as compat
diff --git a/pandas/core/reshape.py b/pandas/core/reshape.py
index 9a812ec71b9a2..3225b4aa33ac2 100644
--- a/pandas/core/reshape.py
+++ b/pandas/core/reshape.py
@@ -14,8 +14,7 @@
from pandas._sparse import IntIndex
from pandas.core.categorical import Categorical
-from pandas.core.common import (notnull, _ensure_platform_int, _maybe_promote,
- isnull)
+from pandas.core.common import notnull, _ensure_platform_int, _maybe_promote
from pandas.core.groupby import get_group_index, _compress_group_index
import pandas.core.common as com
diff --git a/pandas/core/series.py b/pandas/core/series.py
index 95b6a6aa1e7dd..8ef9adb1d24a4 100644
--- a/pandas/core/series.py
+++ b/pandas/core/series.py
@@ -19,8 +19,8 @@
is_list_like, _values_from_object,
_possibly_cast_to_datetime, _possibly_castable,
_possibly_convert_platform, _try_sort,
- ABCSparseArray, _maybe_match_name, _coerce_to_dtype,
- _ensure_object, SettingWithCopyError,
+ ABCSparseArray, _maybe_match_name,
+ _coerce_to_dtype, SettingWithCopyError,
_maybe_box_datetimelike, ABCDataFrame)
from pandas.core.index import (Index, MultiIndex, InvalidIndexError,
_ensure_index)
diff --git a/pandas/util/decorators.py b/pandas/util/decorators.py
index d839437a6fe33..9cd538511e946 100644
--- a/pandas/util/decorators.py
+++ b/pandas/util/decorators.py
@@ -26,7 +26,7 @@ def deprecate_kwarg(old_arg_name, new_arg_name, mapping=None):
Name of prefered argument in function
mapping : dict or callable
If mapping is present, use it to translate old arguments to
- new arguments. A callable must do its own value checking;
+ new arguments. A callable must do its own value checking;
values not found in a dict will be forwarded unchanged.
Examples
@@ -45,7 +45,7 @@ def deprecate_kwarg(old_arg_name, new_arg_name, mapping=None):
should raise warning
>>> f(cols='should error', columns="can't pass do both")
TypeError: Can only specify 'cols' or 'columns', not both
- >>> @deprecate_kwarg('old', 'new', {'yes': True, 'no', False})
+ >>> @deprecate_kwarg('old', 'new', {'yes': True, 'no': False})
... def f(new=False):
... print('yes!' if new else 'no!')
...
| https://api.github.com/repos/pandas-dev/pandas/pulls/10130 | 2015-05-14T02:26:40Z | 2015-05-14T11:52:08Z | 2015-05-14T11:52:08Z | 2015-06-02T19:26:11Z | |
BUG: Filter/transform fail in some cases when multi-grouping with a datetime-like key | diff --git a/doc/source/whatsnew/v0.17.0.txt b/doc/source/whatsnew/v0.17.0.txt
index aa8241e3cc272..18bcb87fc6c71 100644
--- a/doc/source/whatsnew/v0.17.0.txt
+++ b/doc/source/whatsnew/v0.17.0.txt
@@ -390,7 +390,7 @@ Bug Fixes
- Bug in ``pd.get_dummies`` with `sparse=True` not returning ``SparseDataFrame`` (:issue:`10531`)
- Bug in ``Index`` subtypes (such as ``PeriodIndex``) not returning their own type for ``.drop`` and ``.insert`` methods (:issue:`10620`)
-
+- Bug in ``filter`` (regression from 0.16.0) and ``transform`` when grouping on multiple keys, one of which is datetime-like (:issue:`10114`)
diff --git a/pandas/core/groupby.py b/pandas/core/groupby.py
index 2ed5774bdbec6..15c5429f81e88 100644
--- a/pandas/core/groupby.py
+++ b/pandas/core/groupby.py
@@ -422,46 +422,55 @@ def indices(self):
""" dict {group name -> group indices} """
return self.grouper.indices
- def _get_index(self, name):
- """ safe get index, translate keys for datelike to underlying repr """
+ def _get_indices(self, names):
+ """ safe get multiple indices, translate keys for datelike to underlying repr """
- def convert(key, s):
+ def get_converter(s):
# possibly convert to they actual key types
# in the indices, could be a Timestamp or a np.datetime64
-
if isinstance(s, (Timestamp,datetime.datetime)):
- return Timestamp(key)
+ return lambda key: Timestamp(key)
elif isinstance(s, np.datetime64):
- return Timestamp(key).asm8
- return key
+ return lambda key: Timestamp(key).asm8
+ else:
+ return lambda key: key
+
+ if len(names) == 0:
+ return []
if len(self.indices) > 0:
- sample = next(iter(self.indices))
+ index_sample = next(iter(self.indices))
else:
- sample = None # Dummy sample
+ index_sample = None # Dummy sample
- if isinstance(sample, tuple):
- if not isinstance(name, tuple):
+ name_sample = names[0]
+ if isinstance(index_sample, tuple):
+ if not isinstance(name_sample, tuple):
msg = ("must supply a tuple to get_group with multiple"
" grouping keys")
raise ValueError(msg)
- if not len(name) == len(sample):
+ if not len(name_sample) == len(index_sample):
try:
# If the original grouper was a tuple
- return self.indices[name]
+ return [self.indices[name] for name in names]
except KeyError:
# turns out it wasn't a tuple
msg = ("must supply a a same-length tuple to get_group"
" with multiple grouping keys")
raise ValueError(msg)
- name = tuple([ convert(n, k) for n, k in zip(name,sample) ])
+ converters = [get_converter(s) for s in index_sample]
+ names = [tuple([f(n) for f, n in zip(converters, name)]) for name in names]
else:
+ converter = get_converter(index_sample)
+ names = [converter(name) for name in names]
- name = convert(name, sample)
+ return [self.indices.get(name, []) for name in names]
- return self.indices[name]
+ def _get_index(self, name):
+ """ safe get index, translate keys for datelike to underlying repr """
+ return self._get_indices([name])[0]
@property
def name(self):
@@ -507,7 +516,7 @@ def _set_result_index_ordered(self, result):
# shortcut of we have an already ordered grouper
if not self.grouper.is_monotonic:
- index = Index(np.concatenate([ indices.get(v, []) for v in self.grouper.result_index]))
+ index = Index(np.concatenate(self._get_indices(self.grouper.result_index)))
result.index = index
result = result.sort_index()
@@ -612,6 +621,9 @@ def get_group(self, name, obj=None):
obj = self._selected_obj
inds = self._get_index(name)
+ if not len(inds):
+ raise KeyError(name)
+
return obj.take(inds, axis=self.axis, convert=False)
def __iter__(self):
@@ -2457,9 +2469,6 @@ def transform(self, func, *args, **kwargs):
wrapper = lambda x: func(x, *args, **kwargs)
for i, (name, group) in enumerate(self):
- if name not in self.indices:
- continue
-
object.__setattr__(group, 'name', name)
res = wrapper(group)
@@ -2474,7 +2483,7 @@ def transform(self, func, *args, **kwargs):
except:
pass
- indexer = self.indices[name]
+ indexer = self._get_index(name)
result[indexer] = res
result = _possibly_downcast_to_dtype(result, dtype)
@@ -2528,11 +2537,8 @@ def true_and_notnull(x, *args, **kwargs):
return b and notnull(b)
try:
- indices = []
- for name, group in self:
- if true_and_notnull(group) and name in self.indices:
- indices.append(self.indices[name])
-
+ indices = [self._get_index(name) for name, group in self
+ if true_and_notnull(group)]
except ValueError:
raise TypeError("the filter must return a boolean result")
except TypeError:
@@ -3060,8 +3066,8 @@ def transform(self, func, *args, **kwargs):
results = np.empty_like(obj.values, result.values.dtype)
indices = self.indices
for (name, group), (i, row) in zip(self, result.iterrows()):
- if name in indices:
- indexer = indices[name]
+ indexer = self._get_index(name)
+ if len(indexer) > 0:
results[indexer] = np.tile(row.values,len(indexer)).reshape(len(indexer),-1)
counts = self.size().fillna(0).values
@@ -3162,8 +3168,8 @@ def filter(self, func, dropna=True, *args, **kwargs):
# interpret the result of the filter
if is_bool(res) or (lib.isscalar(res) and isnull(res)):
- if res and notnull(res) and name in self.indices:
- indices.append(self.indices[name])
+ if res and notnull(res):
+ indices.append(self._get_index(name))
else:
# non scalars aren't allowed
raise TypeError("filter function returned a %s, "
diff --git a/pandas/tests/test_groupby.py b/pandas/tests/test_groupby.py
index c0b5bcd55d873..651dc285e3f50 100644
--- a/pandas/tests/test_groupby.py
+++ b/pandas/tests/test_groupby.py
@@ -4477,6 +4477,32 @@ def test_filter_maintains_ordering(self):
expected = s.iloc[[1, 2, 4, 7]]
assert_series_equal(actual, expected)
+ def test_filter_multiple_timestamp(self):
+ # GH 10114
+ df = DataFrame({'A' : np.arange(5),
+ 'B' : ['foo','bar','foo','bar','bar'],
+ 'C' : Timestamp('20130101') })
+
+ grouped = df.groupby(['B', 'C'])
+
+ result = grouped['A'].filter(lambda x: True)
+ assert_series_equal(df['A'], result)
+
+ result = grouped['A'].transform(len)
+ expected = Series([2, 3, 2, 3, 3], name='A')
+ assert_series_equal(result, expected)
+
+ result = grouped.filter(lambda x: True)
+ assert_frame_equal(df, result)
+
+ result = grouped.transform('sum')
+ expected = DataFrame({'A' : [2, 8, 2, 8, 8]})
+ assert_frame_equal(result, expected)
+
+ result = grouped.transform(len)
+ expected = DataFrame({'A' : [2, 3, 2, 3, 3]})
+ assert_frame_equal(result, expected)
+
def test_filter_and_transform_with_non_unique_int_index(self):
# GH4620
index = [1, 1, 1, 2, 1, 1, 0, 1]
| Fixes GH #10114, and a related problem in transform which was already present in 0.16.0
| https://api.github.com/repos/pandas-dev/pandas/pulls/10124 | 2015-05-13T11:58:09Z | 2015-07-30T16:09:29Z | 2015-07-30T16:09:29Z | 2015-07-30T17:14:50Z |
parsing latitude and longitude in wb.get_countries | diff --git a/pandas/io/wb.py b/pandas/io/wb.py
index 7a9443c4b9ac6..c381f2df1cc54 100644
--- a/pandas/io/wb.py
+++ b/pandas/io/wb.py
@@ -213,6 +213,9 @@ def _get_data(indicator="NY.GNS.ICTR.GN.ZS", country='US',
def get_countries():
'''Query information about countries
+
+ Provides information such as:
+ country code, region, income level, capital city, latitude and longitude
'''
url = 'http://api.worldbank.org/countries/?per_page=1000&format=json'
with urlopen(url) as response:
@@ -222,6 +225,8 @@ def get_countries():
data.adminregion = [x['value'] for x in data.adminregion]
data.incomeLevel = [x['value'] for x in data.incomeLevel]
data.lendingType = [x['value'] for x in data.lendingType]
+ data.latitude = [float(x) if x != "" else np.nan for x in data.latitude]
+ data.longitude = [float(x) if x != "" else np.nan for x in data.longitude]
data.region = [x['value'] for x in data.region]
data = data.rename(columns={'id': 'iso3c', 'iso2Code': 'iso2c'})
return data
| World Bank provides latitude and longitude as strings (and an empty string as a missing value). It's inconvenient so, I parse it to floats. Additionally, I added some description to the `wb.get_countries` function.
| https://api.github.com/repos/pandas-dev/pandas/pulls/10122 | 2015-05-13T09:54:14Z | 2015-05-13T10:10:48Z | null | 2015-05-13T10:23:43Z |
BUG: drop_duplicates drops name(s). | diff --git a/.gitignore b/.gitignore
index e8b557d68ac39..627ccf4112ff5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -41,6 +41,7 @@ doc/_build
dist
# Egg metadata
*.egg-info
+.eggs
# tox testing tool
.tox
# rope
diff --git a/doc/source/whatsnew/v0.17.0.txt b/doc/source/whatsnew/v0.17.0.txt
index cc044bc35a707..9c81787e19f22 100644
--- a/doc/source/whatsnew/v0.17.0.txt
+++ b/doc/source/whatsnew/v0.17.0.txt
@@ -65,6 +65,6 @@ Bug Fixes
- Bug in ``Timestamp``'s' ``microsecond``, ``quarter``, ``dayofyear``, ``week`` and ``daysinmonth`` properties return ``np.int`` type, not built-in ``int``. (:issue:`10050`)
- Bug in ``NaT`` raises ``AttributeError`` when accessing to ``daysinmonth``, ``dayofweek`` properties. (:issue:`10096`)
-
+- Bug in ``drop_duplicates`` dropping name(s) (:issue:`10115`)
diff --git a/pandas/core/index.py b/pandas/core/index.py
index 21f1fed2cd6da..5f762466ad2b4 100644
--- a/pandas/core/index.py
+++ b/pandas/core/index.py
@@ -2580,7 +2580,10 @@ def drop(self, labels, errors='raise'):
@Appender(_shared_docs['drop_duplicates'] % _index_doc_kwargs)
def drop_duplicates(self, take_last=False):
result = super(Index, self).drop_duplicates(take_last=take_last)
- return self._constructor(result)
+ if self.name is not None:
+ return self._constructor(result, name=self.name)
+ else:
+ return self._constructor(result, names=self.names)
@Appender(_shared_docs['duplicated'] % _index_doc_kwargs)
def duplicated(self, take_last=False):
diff --git a/pandas/tests/test_index.py b/pandas/tests/test_index.py
index 444aa2a0bab1e..b2632092ba038 100644
--- a/pandas/tests/test_index.py
+++ b/pandas/tests/test_index.py
@@ -4151,6 +4151,17 @@ def test_droplevel_multiple(self):
expected = index[:2].droplevel(2).droplevel(0)
self.assertTrue(dropped.equals(expected))
+ def test_drop_duplicates_names(self):
+ # GH 10115
+ for idx in [Index([3, 4, 5, 3]),
+ Index([3, 4, 5, 3], name='Num'),
+ MultiIndex.from_tuples([('A', 1), ('A', 2)]),
+ MultiIndex.from_tuples([('A', 1), ('A', 2)], names=[None, None]),
+ MultiIndex.from_tuples([('A', 1), ('A', 2)], names=[None, 'Num']),
+ MultiIndex.from_tuples([('A', 1), ('A', 2)], names=['Upper', 'Num']),
+ ]:
+ self.assertEqual(idx.drop_duplicates().names, idx.names)
+
def test_insert(self):
# key contained in all levels
new_index = self.index.insert(0, ('bar', 'two'))
| Closes #10115.
| https://api.github.com/repos/pandas-dev/pandas/pulls/10116 | 2015-05-12T21:05:54Z | 2015-06-23T14:11:23Z | null | 2015-08-07T00:15:40Z |
CLN: cleanup hashtable.pyx | diff --git a/pandas/hashtable.pyx b/pandas/hashtable.pyx
index 8bdcfb44242ff..c4cd788216018 100644
--- a/pandas/hashtable.pyx
+++ b/pandas/hashtable.pyx
@@ -211,7 +211,6 @@ cdef class StringHashTable(HashTable):
def unique(self, ndarray[object] values):
cdef:
Py_ssize_t i, n = len(values)
- Py_ssize_t idx, count = 0
int ret = 0
object val
char *buf
@@ -223,12 +222,9 @@ cdef class StringHashTable(HashTable):
buf = util.get_c_string(val)
k = kh_get_str(self.table, buf)
if k == self.table.n_buckets:
- k = kh_put_str(self.table, buf, &ret)
- # print 'putting %s, %s' % (val, count)
- count += 1
+ kh_put_str(self.table, buf, &ret)
uniques.append(val)
- # return None
return uniques.to_array()
def factorize(self, ndarray[object] values):
@@ -258,7 +254,6 @@ cdef class StringHashTable(HashTable):
labels[i] = count
count += 1
- # return None
return reverse, labels
cdef class Int32HashTable(HashTable):
@@ -319,7 +314,6 @@ cdef class Int32HashTable(HashTable):
def lookup(self, ndarray[int32_t] values):
cdef:
Py_ssize_t i, n = len(values)
- int ret = 0
int32_t val
khiter_t k
ndarray[int32_t] locs = np.empty(n, dtype=np.int64)
@@ -357,7 +351,6 @@ cdef class Int32HashTable(HashTable):
labels[i] = count
count += 1
- # return None
return reverse, labels
cdef class Int64HashTable: #(HashTable):
@@ -518,7 +511,6 @@ cdef class Int64HashTable: #(HashTable):
def unique(self, ndarray[int64_t] values):
cdef:
Py_ssize_t i, n = len(values)
- Py_ssize_t idx, count = 0
int ret = 0
ndarray result
int64_t val
@@ -529,9 +521,8 @@ cdef class Int64HashTable: #(HashTable):
val = values[i]
k = kh_get_int64(self.table, val)
if k == self.table.n_buckets:
- k = kh_put_int64(self.table, val, &ret)
+ kh_put_int64(self.table, val, &ret)
uniques.append(val)
- count += 1
result = uniques.to_array()
@@ -644,7 +635,6 @@ cdef class Float64HashTable(HashTable):
def unique(self, ndarray[float64_t] values):
cdef:
Py_ssize_t i, n = len(values)
- Py_ssize_t idx, count = 0
int ret = 0
float64_t val
khiter_t k
@@ -657,9 +647,8 @@ cdef class Float64HashTable(HashTable):
if val == val:
k = kh_get_float64(self.table, val)
if k == self.table.n_buckets:
- k = kh_put_float64(self.table, val, &ret)
+ kh_put_float64(self.table, val, &ret)
uniques.append(val)
- count += 1
elif not seen_na:
seen_na = 1
uniques.append(ONAN)
@@ -786,7 +775,6 @@ cdef class PyObjectHashTable(HashTable):
def unique(self, ndarray[object] values):
cdef:
Py_ssize_t i, n = len(values)
- Py_ssize_t idx, count = 0
int ret = 0
object val
ndarray result
@@ -800,7 +788,7 @@ cdef class PyObjectHashTable(HashTable):
if not _checknan(val):
k = kh_get_pymap(self.table, <PyObject*>val)
if k == self.table.n_buckets:
- k = kh_put_pymap(self.table, <PyObject*>val, &ret)
+ kh_put_pymap(self.table, <PyObject*>val, &ret)
uniques.append(val)
elif not seen_na:
seen_na = 1
@@ -918,7 +906,7 @@ cdef class Int64Factorizer:
cdef build_count_table_int64(ndarray[int64_t] values, kh_int64_t *table):
cdef:
- int k
+ khiter_t k
Py_ssize_t i, n = len(values)
int ret = 0
@@ -938,7 +926,6 @@ cpdef value_count_int64(ndarray[int64_t] values):
cdef:
Py_ssize_t i
kh_int64_t *table
- int ret = 0
int k
table = kh_init_int64()
@@ -961,7 +948,7 @@ cdef build_count_table_object(ndarray[object] values,
ndarray[uint8_t, cast=True] mask,
kh_pymap_t *table):
cdef:
- int k
+ khiter_t k
Py_ssize_t i, n = len(values)
int ret = 0
@@ -983,7 +970,7 @@ cdef build_count_table_object(ndarray[object] values,
cpdef value_count_object(ndarray[object] values,
ndarray[uint8_t, cast=True] mask):
cdef:
- Py_ssize_t i = len(values)
+ Py_ssize_t i
kh_pymap_t *table
int k
@@ -1008,9 +995,7 @@ def mode_object(ndarray[object] values, ndarray[uint8_t, cast=True] mask):
int count, max_count = 2
int j = -1 # so you can do +=
int k
- Py_ssize_t i, n = len(values)
kh_pymap_t *table
- int ret = 0
table = kh_init_pymap()
build_count_table_object(values, mask, table)
@@ -1036,11 +1021,10 @@ def mode_object(ndarray[object] values, ndarray[uint8_t, cast=True] mask):
def mode_int64(ndarray[int64_t] values):
cdef:
- int val, max_val = 2
+ int count, max_count = 2
int j = -1 # so you can do +=
int k
kh_int64_t *table
- list uniques = []
table = kh_init_int64()
@@ -1049,12 +1033,12 @@ def mode_int64(ndarray[int64_t] values):
modes = np.empty(table.n_buckets, dtype=np.int64)
for k in range(table.n_buckets):
if kh_exist_int64(table, k):
- val = table.vals[k]
+ count = table.vals[k]
- if val == max_val:
+ if count == max_count:
j += 1
- elif val > max_val:
- max_val = val
+ elif count > max_count:
+ max_count = count
j = 0
else:
continue
| mostly remove unused stuff
| https://api.github.com/repos/pandas-dev/pandas/pulls/10111 | 2015-05-12T12:34:22Z | 2015-05-13T12:28:09Z | 2015-05-13T12:28:09Z | 2015-06-02T19:26:11Z |
ENH: support .strftime for datetimelikes (closes #10086) | diff --git a/doc/source/api.rst b/doc/source/api.rst
index 76e03ce70342f..731cf3d136a8a 100644
--- a/doc/source/api.rst
+++ b/doc/source/api.rst
@@ -509,6 +509,7 @@ These can be accessed like ``Series.dt.<property>``.
Series.dt.tz_localize
Series.dt.tz_convert
Series.dt.normalize
+ Series.dt.strftime
**Timedelta Properties**
diff --git a/doc/source/basics.rst b/doc/source/basics.rst
index aae931a4b8319..eb71a8845a6df 100644
--- a/doc/source/basics.rst
+++ b/doc/source/basics.rst
@@ -1248,13 +1248,13 @@ For instance,
~~~~~~~~~~~~
``Series`` has an accessor to succinctly return datetime like properties for the
-*values* of the Series, if its a datetime/period like Series.
+*values* of the Series, if it is a datetime/period like Series.
This will return a Series, indexed like the existing Series.
.. ipython:: python
# datetime
- s = pd.Series(pd.date_range('20130101 09:10:12',periods=4))
+ s = pd.Series(pd.date_range('20130101 09:10:12', periods=4))
s
s.dt.hour
s.dt.second
@@ -1280,12 +1280,29 @@ You can also chain these types of operations:
s.dt.tz_localize('UTC').dt.tz_convert('US/Eastern')
+You can also format datetime values as strings with :meth:`Series.dt.strftime` which
+supports the same format as the standard :meth:`~datetime.datetime.strftime`.
+
+.. ipython:: python
+
+ # DatetimeIndex
+ s = pd.Series(pd.date_range('20130101', periods=4))
+ s
+ s.dt.strftime('%Y/%m/%d')
+
+.. ipython:: python
+
+ # PeriodIndex
+ s = pd.Series(pd.period_range('20130101', periods=4))
+ s
+ s.dt.strftime('%Y/%m/%d')
+
The ``.dt`` accessor works for period and timedelta dtypes.
.. ipython:: python
# period
- s = pd.Series(pd.period_range('20130101', periods=4,freq='D'))
+ s = pd.Series(pd.period_range('20130101', periods=4, freq='D'))
s
s.dt.year
s.dt.day
@@ -1293,7 +1310,7 @@ The ``.dt`` accessor works for period and timedelta dtypes.
.. ipython:: python
# timedelta
- s = pd.Series(pd.timedelta_range('1 day 00:00:05',periods=4,freq='s'))
+ s = pd.Series(pd.timedelta_range('1 day 00:00:05', periods=4, freq='s'))
s
s.dt.days
s.dt.seconds
diff --git a/doc/source/whatsnew/v0.17.0.txt b/doc/source/whatsnew/v0.17.0.txt
index fe5e7371bddf6..c19aaaf16a5a5 100644
--- a/doc/source/whatsnew/v0.17.0.txt
+++ b/doc/source/whatsnew/v0.17.0.txt
@@ -18,6 +18,7 @@ Highlights include:
previously this would return the original input, see :ref:`here <whatsnew_0170.api_breaking.to_datetime>`
- The default for ``dropna`` in ``HDFStore`` has changed to ``False``, to store by default all rows even
if they are all ``NaN``, see :ref:`here <whatsnew_0170.api_breaking.hdf_dropna>`
+ - Support .strftime for datetime-likes, see :ref:`here <whatsnew_0170.strftime>`
- Development installed versions of pandas will now have ``PEP440`` compliant version strings (:issue:`9518`)
Check the :ref:`API Changes <whatsnew_0170.api>` and :ref:`deprecations <whatsnew_0170.deprecations>` before updating.
@@ -60,6 +61,29 @@ Releasing of the GIL could benefit an application that uses threads for user int
.. _dask: https://dask.readthedocs.org/en/latest/
.. _QT: https://wiki.python.org/moin/PyQt
+.. _whatsnew_0170.strftime:
+
+Support strftime for Datetimelikes
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+We are now supporting a ``.strftime`` method for datetime-likes (:issue:`10110`). Examples:
+
+ .. ipython:: python
+
+ # DatetimeIndex
+ s = pd.Series(pd.date_range('20130101', periods=4))
+ s
+ s.dt.strftime('%Y/%m/%d')
+
+ .. ipython:: python
+
+ # PeriodIndex
+ s = pd.Series(pd.period_range('20130101', periods=4))
+ s
+ s.dt.strftime('%Y/%m/%d')
+
+The string format is as the python standard library and details can be found `here <https://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior>`_
+
.. _whatsnew_0170.enhancements.other:
Other enhancements
diff --git a/pandas/tests/test_series.py b/pandas/tests/test_series.py
index 4beba4ee3751c..59baf810fffc5 100644
--- a/pandas/tests/test_series.py
+++ b/pandas/tests/test_series.py
@@ -83,9 +83,10 @@ def test_dt_namespace_accessor(self):
ok_for_base = ['year','month','day','hour','minute','second','weekofyear','week','dayofweek','weekday','dayofyear','quarter','freq','days_in_month','daysinmonth']
ok_for_period = ok_for_base + ['qyear']
+ ok_for_period_methods = ['strftime']
ok_for_dt = ok_for_base + ['date','time','microsecond','nanosecond', 'is_month_start', 'is_month_end', 'is_quarter_start',
'is_quarter_end', 'is_year_start', 'is_year_end', 'tz']
- ok_for_dt_methods = ['to_period','to_pydatetime','tz_localize','tz_convert', 'normalize']
+ ok_for_dt_methods = ['to_period','to_pydatetime','tz_localize','tz_convert', 'normalize', 'strftime']
ok_for_td = ['days','seconds','microseconds','nanoseconds']
ok_for_td_methods = ['components','to_pytimedelta']
@@ -111,13 +112,12 @@ def compare(s, name):
Series(date_range('20130101',periods=5,freq='s')),
Series(date_range('20130101 00:00:00',periods=5,freq='ms'))]:
for prop in ok_for_dt:
-
# we test freq below
if prop != 'freq':
compare(s, prop)
for prop in ok_for_dt_methods:
- getattr(s.dt,prop)
+ getattr(s.dt, prop)
result = s.dt.to_pydatetime()
self.assertIsInstance(result,np.ndarray)
@@ -142,13 +142,12 @@ def compare(s, name):
Series(timedelta_range('1 day 01:23:45',periods=5,freq='s')),
Series(timedelta_range('2 days 01:23:45.012345',periods=5,freq='ms'))]:
for prop in ok_for_td:
-
# we test freq below
if prop != 'freq':
compare(s, prop)
for prop in ok_for_td_methods:
- getattr(s.dt,prop)
+ getattr(s.dt, prop)
result = s.dt.components
self.assertIsInstance(result,DataFrame)
@@ -171,13 +170,14 @@ def compare(s, name):
# periodindex
for s in [Series(period_range('20130101',periods=5,freq='D'))]:
-
for prop in ok_for_period:
-
# we test freq below
if prop != 'freq':
compare(s, prop)
+ for prop in ok_for_period_methods:
+ getattr(s.dt, prop)
+
freq_result = s.dt.freq
self.assertEqual(freq_result, PeriodIndex(s.values).freq)
@@ -192,7 +192,7 @@ def get_dir(s):
s = Series(period_range('20130101',periods=5,freq='D').asobject)
results = get_dir(s)
- tm.assert_almost_equal(results,list(sorted(set(ok_for_period))))
+ tm.assert_almost_equal(results, list(sorted(set(ok_for_period + ok_for_period_methods))))
# no setting allowed
s = Series(date_range('20130101',periods=5,freq='D'))
@@ -205,6 +205,62 @@ def f():
s.dt.hour[0] = 5
self.assertRaises(com.SettingWithCopyError, f)
+ def test_strftime(self):
+ # GH 10086
+ s = Series(date_range('20130101', periods=5))
+ result = s.dt.strftime('%Y/%m/%d')
+ expected = Series(['2013/01/01', '2013/01/02', '2013/01/03', '2013/01/04', '2013/01/05'])
+ tm.assert_series_equal(result, expected)
+
+ s = Series(date_range('2015-02-03 11:22:33.4567', periods=5))
+ result = s.dt.strftime('%Y/%m/%d %H-%M-%S')
+ expected = Series(['2015/02/03 11-22-33', '2015/02/04 11-22-33', '2015/02/05 11-22-33',
+ '2015/02/06 11-22-33', '2015/02/07 11-22-33'])
+ tm.assert_series_equal(result, expected)
+
+ s = Series(period_range('20130101', periods=5))
+ result = s.dt.strftime('%Y/%m/%d')
+ expected = Series(['2013/01/01', '2013/01/02', '2013/01/03', '2013/01/04', '2013/01/05'])
+ tm.assert_series_equal(result, expected)
+
+ s = Series(period_range('2015-02-03 11:22:33.4567', periods=5, freq='s'))
+ result = s.dt.strftime('%Y/%m/%d %H-%M-%S')
+ expected = Series(['2015/02/03 11-22-33', '2015/02/03 11-22-34', '2015/02/03 11-22-35',
+ '2015/02/03 11-22-36', '2015/02/03 11-22-37'])
+ tm.assert_series_equal(result, expected)
+
+ s = Series(date_range('20130101', periods=5))
+ s.iloc[0] = pd.NaT
+ result = s.dt.strftime('%Y/%m/%d')
+ expected = Series(['NaT', '2013/01/02', '2013/01/03', '2013/01/04', '2013/01/05'])
+ tm.assert_series_equal(result, expected)
+
+ datetime_index = date_range('20150301', periods=5)
+ result = datetime_index.strftime("%Y/%m/%d")
+ expected = np.array(['2015/03/01', '2015/03/02', '2015/03/03', '2015/03/04', '2015/03/05'], dtype=object)
+ self.assert_numpy_array_equal(result, expected)
+
+ period_index = period_range('20150301', periods=5)
+ result = period_index.strftime("%Y/%m/%d")
+ expected = np.array(['2015/03/01', '2015/03/02', '2015/03/03', '2015/03/04', '2015/03/05'], dtype=object)
+ self.assert_numpy_array_equal(result, expected)
+
+ s = Series([datetime(2013, 1, 1, 2, 32, 59), datetime(2013, 1, 2, 14, 32, 1)])
+ result = s.dt.strftime('%Y-%m-%d %H:%M:%S')
+ expected = Series(["2013-01-01 02:32:59", "2013-01-02 14:32:01"])
+ tm.assert_series_equal(result, expected)
+
+ s = Series(period_range('20130101', periods=4, freq='H'))
+ result = s.dt.strftime('%Y/%m/%d %H:%M:%S')
+ expected = Series(["2013/01/01 00:00:00", "2013/01/01 01:00:00",
+ "2013/01/01 02:00:00", "2013/01/01 03:00:00"])
+
+ s = Series(period_range('20130101', periods=4, freq='L'))
+ result = s.dt.strftime('%Y/%m/%d %H:%M:%S.%l')
+ expected = Series(["2013/01/01 00:00:00.000", "2013/01/01 00:00:00.001",
+ "2013/01/01 00:00:00.002", "2013/01/01 00:00:00.003"])
+ tm.assert_series_equal(result, expected)
+
def test_valid_dt_with_missing_values(self):
from datetime import date, time
diff --git a/pandas/tseries/base.py b/pandas/tseries/base.py
index ae869ce9bd794..b3d10a80e0b50 100644
--- a/pandas/tseries/base.py
+++ b/pandas/tseries/base.py
@@ -17,6 +17,29 @@
import pandas.algos as _algos
+
+class DatelikeOps(object):
+ """ common ops for DatetimeIndex/PeriodIndex, but not TimedeltaIndex """
+
+ def strftime(self, date_format):
+ """
+ Return an array of formatted strings specified by date_format, which
+ supports the same string format as the python standard library. Details
+ of the string format can be found in the `python string format doc
+ <https://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior>`__
+
+ Parameters
+ ----------
+ date_format : str
+ date format string (e.g. "%Y-%m-%d")
+
+ Returns
+ -------
+ ndarray of formatted strings
+ """
+ return np.asarray(self.format(date_format=date_format))
+
+
class DatetimeIndexOpsMixin(object):
""" common ops mixin to support a unified inteface datetimelike Index """
diff --git a/pandas/tseries/common.py b/pandas/tseries/common.py
index c273906ef3d05..a4d5939d386ae 100644
--- a/pandas/tseries/common.py
+++ b/pandas/tseries/common.py
@@ -125,7 +125,7 @@ def to_pydatetime(self):
accessors=DatetimeIndex._datetimelike_ops,
typ='property')
DatetimeProperties._add_delegate_accessors(delegate=DatetimeIndex,
- accessors=["to_period","tz_localize","tz_convert","normalize"],
+ accessors=["to_period","tz_localize","tz_convert","normalize","strftime"],
typ='method')
class TimedeltaProperties(Properties):
@@ -181,6 +181,9 @@ class PeriodProperties(Properties):
PeriodProperties._add_delegate_accessors(delegate=PeriodIndex,
accessors=PeriodIndex._datetimelike_ops,
typ='property')
+PeriodProperties._add_delegate_accessors(delegate=PeriodIndex,
+ accessors=["strftime"],
+ typ='method')
class CombinedDatetimelikeProperties(DatetimeProperties, TimedeltaProperties):
diff --git a/pandas/tseries/index.py b/pandas/tseries/index.py
index ec60edb6a78d6..8ee6a1bc64e4e 100644
--- a/pandas/tseries/index.py
+++ b/pandas/tseries/index.py
@@ -13,7 +13,7 @@
from pandas.tseries.frequencies import (
to_offset, get_period_alias,
Resolution)
-from pandas.tseries.base import DatetimeIndexOpsMixin
+from pandas.tseries.base import DatelikeOps, DatetimeIndexOpsMixin
from pandas.tseries.offsets import DateOffset, generate_range, Tick, CDay
from pandas.tseries.tools import parse_time_string, normalize_date
from pandas.util.decorators import cache_readonly, deprecate_kwarg
@@ -117,7 +117,7 @@ def _new_DatetimeIndex(cls, d):
result.tz = tz
return result
-class DatetimeIndex(DatetimeIndexOpsMixin, Int64Index):
+class DatetimeIndex(DatelikeOps, DatetimeIndexOpsMixin, Int64Index):
"""
Immutable ndarray of datetime64 data, represented internally as int64, and
which can be boxed to Timestamp objects that are subclasses of datetime and
diff --git a/pandas/tseries/period.py b/pandas/tseries/period.py
index 242d9a7757556..6413ce9cd5a03 100644
--- a/pandas/tseries/period.py
+++ b/pandas/tseries/period.py
@@ -4,7 +4,7 @@
import pandas.tseries.frequencies as frequencies
from pandas.tseries.frequencies import get_freq_code as _gfc
from pandas.tseries.index import DatetimeIndex, Int64Index, Index
-from pandas.tseries.base import DatetimeIndexOpsMixin
+from pandas.tseries.base import DatelikeOps, DatetimeIndexOpsMixin
from pandas.tseries.tools import parse_time_string
import pandas.tseries.offsets as offsets
@@ -92,7 +92,7 @@ def wrapper(self, other):
return wrapper
-class PeriodIndex(DatetimeIndexOpsMixin, Int64Index):
+class PeriodIndex(DatelikeOps, DatetimeIndexOpsMixin, Int64Index):
"""
Immutable ndarray holding ordinal values indicating regular periods in
time such as particular years, quarters, months, etc. A value of 1 is the
@@ -737,14 +737,18 @@ def __getitem__(self, key):
return PeriodIndex(result, name=self.name, freq=self.freq)
- def _format_native_types(self, na_rep=u('NaT'), **kwargs):
+ def _format_native_types(self, na_rep=u('NaT'), date_format=None, **kwargs):
values = np.array(list(self), dtype=object)
mask = isnull(self.values)
values[mask] = na_rep
-
imask = ~mask
- values[imask] = np.array([u('%s') % dt for dt in values[imask]])
+
+ if date_format:
+ formatter = lambda dt: dt.strftime(date_format)
+ else:
+ formatter = lambda dt: u('%s') % dt
+ values[imask] = np.array([formatter(dt) for dt in values[imask]])
return values
def __array_finalize__(self, obj):
diff --git a/pandas/tseries/tests/test_timeseries.py b/pandas/tseries/tests/test_timeseries.py
index 26acbb2073ab8..2bf763b023bef 100644
--- a/pandas/tseries/tests/test_timeseries.py
+++ b/pandas/tseries/tests/test_timeseries.py
@@ -2365,7 +2365,7 @@ def test_map(self):
f = lambda x: x.strftime('%Y%m%d')
result = rng.map(f)
exp = [f(x) for x in rng]
- self.assert_numpy_array_equal(result, exp)
+ tm.assert_almost_equal(result, exp)
def test_iteration_preserves_tz(self):
| closes #10086
| https://api.github.com/repos/pandas-dev/pandas/pulls/10110 | 2015-05-12T06:42:39Z | 2015-08-03T12:40:55Z | 2015-08-03T12:40:55Z | 2015-08-03T12:45:00Z |
BUG: categorical doesn't handle display.width of None in Python 3 (GH10087) | diff --git a/doc/source/whatsnew/v0.17.0.txt b/doc/source/whatsnew/v0.17.0.txt
index 0184acce7a46b..9bf478831ea01 100644
--- a/doc/source/whatsnew/v0.17.0.txt
+++ b/doc/source/whatsnew/v0.17.0.txt
@@ -57,3 +57,5 @@ Performance Improvements
Bug Fixes
~~~~~~~~~
+
+- Bug in ``Categorical`` repr with ``display.width`` of ``None`` in Python 3 (:issue:`10087`)
diff --git a/pandas/core/categorical.py b/pandas/core/categorical.py
index 97368baffd40b..ffb3c429d250b 100644
--- a/pandas/core/categorical.py
+++ b/pandas/core/categorical.py
@@ -1310,8 +1310,7 @@ def _repr_categories_info(self):
levheader = "Categories (%d, %s): " % (len(self.categories),
self.categories.dtype)
width, height = get_terminal_size()
- max_width = (width if get_option("display.width") == 0
- else get_option("display.width"))
+ max_width = get_option("display.width") or width
if com.in_ipython_frontend():
# 0 = no breaks
max_width = 0
diff --git a/pandas/tests/test_categorical.py b/pandas/tests/test_categorical.py
index c03fd93f6173f..21b64378cfc24 100755
--- a/pandas/tests/test_categorical.py
+++ b/pandas/tests/test_categorical.py
@@ -521,6 +521,15 @@ def test_empty_print(self):
expected = ("[], Categories (0, object): []")
self.assertEqual(expected, repr(factor))
+ def test_print_none_width(self):
+ # GH10087
+ a = pd.Series(pd.Categorical([1,2,3,4], name="a"))
+ exp = u("0 1\n1 2\n2 3\n3 4\n" +
+ "Name: a, dtype: category\nCategories (4, int64): [1, 2, 3, 4]")
+
+ with option_context("display.width", None):
+ self.assertEqual(exp, repr(a))
+
def test_periodindex(self):
idx1 = PeriodIndex(['2014-01', '2014-01', '2014-02', '2014-02',
'2014-03', '2014-03'], freq='M')
| closes #10087
I think this is fairly straightforward, however I am not sure if the prior code comparing `display.width` to 0 was correct... is `display.width` ever supposed to be set to 0? It looks suspiciously similar to a snippet from `Series.__unicode__()`, but that is looking at `display.max_rows`. Maybe it was brought over incorrectly?
If it should just be a simple comparison to None, not 0 as it was before, just let me know and I'll amend this.
| https://api.github.com/repos/pandas-dev/pandas/pulls/10108 | 2015-05-11T22:15:45Z | 2015-05-12T10:47:23Z | 2015-05-12T10:47:23Z | 2015-06-02T19:26:11Z |
DOC: improve binary operator docs (fixes #10093) | diff --git a/pandas/core/ops.py b/pandas/core/ops.py
index a4c9bff3dd97f..0b62eb1e53ddb 100644
--- a/pandas/core/ops.py
+++ b/pandas/core/ops.py
@@ -213,7 +213,7 @@ def add_flex_arithmetic_methods(cls, flex_arith_method, radd_func=None,
Parameters
----------
- flex_arith_method : function (optional)
+ flex_arith_method : function
factory for special arithmetic methods, with op string:
f(op, name, str_rep, default_axis=None, fill_zeros=None, **eval_kwargs)
radd_func : function (optional)
@@ -703,12 +703,35 @@ def _radd_compat(left, right):
return output
+_op_descriptions = {'add': {'op': '+', 'desc': 'Addition', 'reversed': False, 'reverse': 'radd'},
+ 'sub': {'op': '-', 'desc': 'Subtraction', 'reversed': False, 'reverse': 'rsub'},
+ 'mul': {'op': '*', 'desc': 'Multiplication', 'reversed': False, 'reverse': 'rmul'},
+ 'mod': {'op': '%', 'desc': 'Modulo', 'reversed': False, 'reverse': 'rmod'},
+ 'pow': {'op': '**', 'desc': 'Exponential power', 'reversed': False, 'reverse': 'rpow'},
+ 'truediv': {'op': '/', 'desc': 'Floating division', 'reversed': False, 'reverse': 'rtruediv'},
+ 'floordiv': {'op': '//', 'desc': 'Integer division', 'reversed': False, 'reverse': 'rfloordiv'}}
+
+_op_names = list(_op_descriptions.keys())
+for k in _op_names:
+ reverse_op = _op_descriptions[k]['reverse']
+ _op_descriptions[reverse_op] = _op_descriptions[k].copy()
+ _op_descriptions[reverse_op]['reversed'] = True
+ _op_descriptions[reverse_op]['reverse'] = k
def _flex_method_SERIES(op, name, str_rep, default_axis=None,
fill_zeros=None, **eval_kwargs):
+ op_name = name.replace('__', '')
+ op_desc = _op_descriptions[op_name]
+ if op_desc['reversed']:
+ equiv = 'other ' + op_desc['op'] + ' series'
+ else:
+ equiv = 'series ' + op_desc['op'] + ' other'
+
doc = """
- Binary operator %s with support to substitute a fill_value for missing data
- in one of the inputs
+ %s of series and other, element-wise (binary operator `%s`).
+
+ Equivalent to ``%s``, but with support to substitute a fill_value for
+ missing data in one of the inputs.
Parameters
----------
@@ -723,7 +746,11 @@ def _flex_method_SERIES(op, name, str_rep, default_axis=None,
Returns
-------
result : Series
- """ % name
+
+ See also
+ --------
+ Series.%s
+ """ % (op_desc['desc'], op_name, equiv, op_desc['reverse'])
@Appender(doc)
def flex_wrapper(self, other, level=None, fill_value=None, axis=0):
@@ -813,7 +840,48 @@ def na_op(x, y):
return result
- @Appender(_arith_doc_FRAME % name)
+ if name in _op_descriptions:
+ op_name = name.replace('__', '')
+ op_desc = _op_descriptions[op_name]
+ if op_desc['reversed']:
+ equiv = 'other ' + op_desc['op'] + ' dataframe'
+ else:
+ equiv = 'dataframe ' + op_desc['op'] + ' other'
+
+ doc = """
+ %s of dataframe and other, element-wise (binary operator `%s`).
+
+ Equivalent to ``%s``, but with support to substitute a fill_value for
+ missing data in one of the inputs.
+
+ Parameters
+ ----------
+ other : Series, DataFrame, or constant
+ axis : {0, 1, 'index', 'columns'}
+ For Series input, axis to match Series index on
+ fill_value : None or float value, default None
+ Fill missing (NaN) values with this value. If both DataFrame locations are
+ missing, the result will be missing
+ level : int or name
+ Broadcast across a level, matching Index values on the
+ passed MultiIndex level
+
+ Notes
+ -----
+ Mismatched indices will be unioned together
+
+ Returns
+ -------
+ result : DataFrame
+
+ See also
+ --------
+ DataFrame.%s
+ """ % (op_desc['desc'], op_name, equiv, op_desc['reverse'])
+ else:
+ doc = _arith_doc_FRAME % name
+
+ @Appender(doc)
def f(self, other, axis=default_axis, level=None, fill_value=None):
if isinstance(other, pd.DataFrame): # Another DataFrame
return self._combine_frame(other, na_op, fill_value, level)
diff --git a/pandas/core/panel.py b/pandas/core/panel.py
index 1215efe3a4db6..778f6a22e558c 100644
--- a/pandas/core/panel.py
+++ b/pandas/core/panel.py
@@ -28,6 +28,8 @@
import pandas.core.ops as ops
import pandas.computation.expressions as expressions
from pandas import lib
+from pandas.core.ops import _op_descriptions
+
_shared_doc_kwargs = dict(
axes='items, major_axis, minor_axis',
@@ -1435,7 +1437,7 @@ def _add_aggregate_operations(cls, use_numexpr=True):
----------
other : %s or %s""" % (cls._constructor_sliced.__name__, cls.__name__) + """
axis : {""" + ', '.join(cls._AXIS_ORDERS) + "}" + """
-Axis to broadcast over
+ Axis to broadcast over
Returns
-------
@@ -1457,8 +1459,36 @@ def na_op(x, y):
result = com._fill_zeros(result, x, y, name, fill_zeros)
return result
- @Substitution(name)
- @Appender(_agg_doc)
+ if name in _op_descriptions:
+ op_name = name.replace('__', '')
+ op_desc = _op_descriptions[op_name]
+ if op_desc['reversed']:
+ equiv = 'other ' + op_desc['op'] + ' panel'
+ else:
+ equiv = 'panel ' + op_desc['op'] + ' other'
+
+ _op_doc = """
+ %%s of series and other, element-wise (binary operator `%%s`).
+ Equivalent to ``%%s``.
+
+ Parameters
+ ----------
+ other : %s or %s""" % (cls._constructor_sliced.__name__, cls.__name__) + """
+ axis : {""" + ', '.join(cls._AXIS_ORDERS) + "}" + """
+ Axis to broadcast over
+
+ Returns
+ -------
+ """ + cls.__name__ + """
+
+ See also
+ --------
+ """ + cls.__name__ + ".%s\n"
+ doc = _op_doc % (op_desc['desc'], op_name, equiv, op_desc['reverse'])
+ else:
+ doc = _agg_doc % name
+
+ @Appender(doc)
def f(self, other, axis=0):
return self._combine(other, na_op, axis=axis)
f.__name__ = name
diff --git a/pandas/tests/test_base.py b/pandas/tests/test_base.py
index b91c46377267a..e9526f9fad1ac 100644
--- a/pandas/tests/test_base.py
+++ b/pandas/tests/test_base.py
@@ -244,6 +244,26 @@ def check_ops_properties(self, props, filter=None, ignore_failures=False):
else:
self.assertRaises(AttributeError, lambda : getattr(o,op))
+ def test_binary_ops_docs(self):
+ from pandas import DataFrame, Panel
+ op_map = {'add': '+',
+ 'sub': '-',
+ 'mul': '*',
+ 'mod': '%',
+ 'pow': '**',
+ 'truediv': '/',
+ 'floordiv': '//'}
+ for op_name in ['add', 'sub', 'mul', 'mod', 'pow', 'truediv', 'floordiv']:
+ for klass in [Series, DataFrame, Panel]:
+ operand1 = klass.__name__.lower()
+ operand2 = 'other'
+ op = op_map[op_name]
+ expected_str = ' '.join([operand1, op, operand2])
+ self.assertTrue(expected_str in getattr(klass, op_name).__doc__)
+
+ # reverse version of the binary ops
+ expected_str = ' '.join([operand2, op, operand1])
+ self.assertTrue(expected_str in getattr(klass, 'r' + op_name).__doc__)
class TestIndexOps(Ops):
| fixes #10093
@jorisvandenbossche this covers `Series`, `DataFrame` and `Panel`, please take a look
| https://api.github.com/repos/pandas-dev/pandas/pulls/10107 | 2015-05-11T19:44:11Z | 2015-05-16T14:52:56Z | 2015-05-16T14:52:56Z | 2015-06-02T19:26:11Z |
support both sqlalchemy engines and connections | diff --git a/ci/requirements-2.7.txt b/ci/requirements-2.7.txt
index 0d515f300f5a7..951c8798bef15 100644
--- a/ci/requirements-2.7.txt
+++ b/ci/requirements-2.7.txt
@@ -17,7 +17,7 @@ boto=2.36.0
bottleneck=0.8.0
psycopg2=2.5.2
patsy
-pymysql=0.6.1
+pymysql=0.6.3
html5lib=1.0b2
beautiful-soup=4.2.1
httplib2=0.8
diff --git a/doc/source/io.rst b/doc/source/io.rst
index 185deb4b9cae8..7a4318fb02cfc 100644
--- a/doc/source/io.rst
+++ b/doc/source/io.rst
@@ -3555,9 +3555,16 @@ below and the SQLAlchemy `documentation <http://docs.sqlalchemy.org/en/rel_0_9/c
.. ipython:: python
from sqlalchemy import create_engine
- # Create your connection.
+ # Create your engine.
engine = create_engine('sqlite:///:memory:')
+If you want to manage your own connections you can pass one of those instead:
+
+.. ipython:: python
+
+ with engine.connect() as conn, conn.begin():
+ data = pd.read_sql_table('data', conn)
+
Writing DataFrames
~~~~~~~~~~~~~~~~~~
diff --git a/doc/source/whatsnew/v0.17.0.txt b/doc/source/whatsnew/v0.17.0.txt
index cd41c4fc82146..da16734dc873b 100644
--- a/doc/source/whatsnew/v0.17.0.txt
+++ b/doc/source/whatsnew/v0.17.0.txt
@@ -26,6 +26,7 @@ Check the :ref:`API Changes <whatsnew_0170.api>` and :ref:`deprecations <whatsne
New features
~~~~~~~~~~~~
+- SQL io functions now accept a SQLAlchemy connectable. (:issue:`7877`)
.. _whatsnew_0170.enhancements.other:
diff --git a/pandas/io/sql.py b/pandas/io/sql.py
index 8d8768c08fe02..ef8360f0ff459 100644
--- a/pandas/io/sql.py
+++ b/pandas/io/sql.py
@@ -38,7 +38,7 @@ class DatabaseError(IOError):
_SQLALCHEMY_INSTALLED = None
-def _is_sqlalchemy_engine(con):
+def _is_sqlalchemy_connectable(con):
global _SQLALCHEMY_INSTALLED
if _SQLALCHEMY_INSTALLED is None:
try:
@@ -62,7 +62,7 @@ def compile_big_int_sqlite(type_, compiler, **kw):
if _SQLALCHEMY_INSTALLED:
import sqlalchemy
- return isinstance(con, sqlalchemy.engine.Engine)
+ return isinstance(con, sqlalchemy.engine.Connectable)
else:
return False
@@ -139,7 +139,7 @@ def execute(sql, con, cur=None, params=None):
----------
sql : string
Query to be executed
- con : SQLAlchemy engine or sqlite3 DBAPI2 connection
+ con : SQLAlchemy connectable(engine/connection) or sqlite3 DBAPI2 connection
Using SQLAlchemy makes it possible to use any DB supported by that
library.
If a DBAPI2 object, only sqlite3 is supported.
@@ -282,14 +282,14 @@ def read_sql_table(table_name, con, schema=None, index_col=None,
chunksize=None):
"""Read SQL database table into a DataFrame.
- Given a table name and an SQLAlchemy engine, returns a DataFrame.
+ Given a table name and an SQLAlchemy connectable, returns a DataFrame.
This function does not support DBAPI connections.
Parameters
----------
table_name : string
Name of SQL table in database
- con : SQLAlchemy engine
+ con : SQLAlchemy connectable
Sqlite DBAPI connection mode not supported
schema : string, default None
Name of SQL schema in database to query (if database flavor
@@ -328,9 +328,9 @@ def read_sql_table(table_name, con, schema=None, index_col=None,
read_sql
"""
- if not _is_sqlalchemy_engine(con):
+ if not _is_sqlalchemy_connectable(con):
raise NotImplementedError("read_sql_table only supported for "
- "SQLAlchemy engines.")
+ "SQLAlchemy connectable.")
import sqlalchemy
from sqlalchemy.schema import MetaData
meta = MetaData(con, schema=schema)
@@ -362,7 +362,7 @@ def read_sql_query(sql, con, index_col=None, coerce_float=True, params=None,
----------
sql : string
SQL query to be executed
- con : SQLAlchemy engine or sqlite3 DBAPI2 connection
+ con : SQLAlchemy connectable(engine/connection) or sqlite3 DBAPI2 connection
Using SQLAlchemy makes it possible to use any DB supported by that
library.
If a DBAPI2 object, only sqlite3 is supported.
@@ -420,7 +420,7 @@ def read_sql(sql, con, index_col=None, coerce_float=True, params=None,
----------
sql : string
SQL query to be executed or database table name.
- con : SQLAlchemy engine or DBAPI2 connection (fallback mode)
+ con : SQLAlchemy connectable(engine/connection) or DBAPI2 connection (fallback mode)
Using SQLAlchemy makes it possible to use any DB supported by that
library.
If a DBAPI2 object, only sqlite3 is supported.
@@ -504,14 +504,14 @@ def to_sql(frame, name, con, flavor='sqlite', schema=None, if_exists='fail',
frame : DataFrame
name : string
Name of SQL table
- con : SQLAlchemy engine or sqlite3 DBAPI2 connection
+ con : SQLAlchemy connectable(engine/connection) or sqlite3 DBAPI2 connection
Using SQLAlchemy makes it possible to use any DB supported by that
library.
If a DBAPI2 object, only sqlite3 is supported.
flavor : {'sqlite', 'mysql'}, default 'sqlite'
- The flavor of SQL to use. Ignored when using SQLAlchemy engine.
+ The flavor of SQL to use. Ignored when using SQLAlchemy connectable.
'mysql' is deprecated and will be removed in future versions, but it
- will be further supported through SQLAlchemy engines.
+ will be further supported through SQLAlchemy connectables.
schema : string, default None
Name of SQL schema in database to write to (if database flavor
supports this). If None, use default schema (default).
@@ -557,14 +557,14 @@ def has_table(table_name, con, flavor='sqlite', schema=None):
----------
table_name: string
Name of SQL table
- con: SQLAlchemy engine or sqlite3 DBAPI2 connection
+ con: SQLAlchemy connectable(engine/connection) or sqlite3 DBAPI2 connection
Using SQLAlchemy makes it possible to use any DB supported by that
library.
If a DBAPI2 object, only sqlite3 is supported.
flavor: {'sqlite', 'mysql'}, default 'sqlite'
- The flavor of SQL to use. Ignored when using SQLAlchemy engine.
+ The flavor of SQL to use. Ignored when using SQLAlchemy connectable.
'mysql' is deprecated and will be removed in future versions, but it
- will be further supported through SQLAlchemy engines.
+ will be further supported through SQLAlchemy connectables.
schema : string, default None
Name of SQL schema in database to write to (if database flavor supports
this). If None, use default schema (default).
@@ -581,7 +581,7 @@ def has_table(table_name, con, flavor='sqlite', schema=None):
_MYSQL_WARNING = ("The 'mysql' flavor with DBAPI connection is deprecated "
"and will be removed in future versions. "
- "MySQL will be further supported with SQLAlchemy engines.")
+ "MySQL will be further supported with SQLAlchemy connectables.")
def pandasSQL_builder(con, flavor=None, schema=None, meta=None,
@@ -592,7 +592,7 @@ def pandasSQL_builder(con, flavor=None, schema=None, meta=None,
"""
# When support for DBAPI connections is removed,
# is_cursor should not be necessary.
- if _is_sqlalchemy_engine(con):
+ if _is_sqlalchemy_connectable(con):
return SQLDatabase(con, schema=schema, meta=meta)
else:
if flavor == 'mysql':
@@ -637,7 +637,7 @@ def exists(self):
def sql_schema(self):
from sqlalchemy.schema import CreateTable
- return str(CreateTable(self.table).compile(self.pd_sql.engine))
+ return str(CreateTable(self.table).compile(self.pd_sql.connectable))
def _execute_create(self):
# Inserting table into database, add to MetaData object
@@ -982,11 +982,11 @@ class PandasSQL(PandasObject):
"""
def read_sql(self, *args, **kwargs):
- raise ValueError("PandasSQL must be created with an SQLAlchemy engine"
+ raise ValueError("PandasSQL must be created with an SQLAlchemy connectable"
" or connection+sql flavor")
def to_sql(self, *args, **kwargs):
- raise ValueError("PandasSQL must be created with an SQLAlchemy engine"
+ raise ValueError("PandasSQL must be created with an SQLAlchemy connectable"
" or connection+sql flavor")
@@ -997,8 +997,8 @@ class SQLDatabase(PandasSQL):
Parameters
----------
- engine : SQLAlchemy engine
- Engine to connect with the database. Using SQLAlchemy makes it
+ engine : SQLAlchemy connectable
+ Connectable to connect with the database. Using SQLAlchemy makes it
possible to use any DB supported by that library.
schema : string, default None
Name of SQL schema in database to write to (if database flavor
@@ -1011,19 +1011,24 @@ class SQLDatabase(PandasSQL):
"""
def __init__(self, engine, schema=None, meta=None):
- self.engine = engine
+ self.connectable = engine
if not meta:
from sqlalchemy.schema import MetaData
- meta = MetaData(self.engine, schema=schema)
+ meta = MetaData(self.connectable, schema=schema)
self.meta = meta
+ @contextmanager
def run_transaction(self):
- return self.engine.begin()
+ with self.connectable.begin() as tx:
+ if hasattr(tx, 'execute'):
+ yield tx
+ else:
+ yield self.connectable
def execute(self, *args, **kwargs):
- """Simple passthrough to SQLAlchemy engine"""
- return self.engine.execute(*args, **kwargs)
+ """Simple passthrough to SQLAlchemy connectable"""
+ return self.connectable.execute(*args, **kwargs)
def read_table(self, table_name, index_col=None, coerce_float=True,
parse_dates=None, columns=None, schema=None,
@@ -1191,7 +1196,13 @@ def to_sql(self, frame, name, if_exists='fail', index=True,
table.create()
table.insert(chunksize)
# check for potentially case sensitivity issues (GH7815)
- if name not in self.engine.table_names(schema=schema or self.meta.schema):
+ engine = self.connectable.engine
+ with self.connectable.connect() as conn:
+ table_names = engine.table_names(
+ schema=schema or self.meta.schema,
+ connection=conn,
+ )
+ if name not in table_names:
warnings.warn("The provided table name '{0}' is not found exactly "
"as such in the database after writing the table, "
"possibly due to case sensitivity issues. Consider "
@@ -1202,7 +1213,11 @@ def tables(self):
return self.meta.tables
def has_table(self, name, schema=None):
- return self.engine.has_table(name, schema or self.meta.schema)
+ return self.connectable.run_callable(
+ self.connectable.dialect.has_table,
+ name,
+ schema or self.meta.schema,
+ )
def get_table(self, table_name, schema=None):
schema = schema or self.meta.schema
@@ -1221,7 +1236,7 @@ def get_table(self, table_name, schema=None):
def drop_table(self, table_name, schema=None):
schema = schema or self.meta.schema
- if self.engine.has_table(table_name, schema):
+ if self.has_table(table_name, schema):
self.meta.reflect(only=[table_name], schema=schema)
self.get_table(table_name, schema).drop()
self.meta.clear()
@@ -1610,12 +1625,12 @@ def get_schema(frame, name, flavor='sqlite', keys=None, con=None, dtype=None):
name : string
name of SQL table
flavor : {'sqlite', 'mysql'}, default 'sqlite'
- The flavor of SQL to use. Ignored when using SQLAlchemy engine.
+ The flavor of SQL to use. Ignored when using SQLAlchemy connectable.
'mysql' is deprecated and will be removed in future versions, but it
will be further supported through SQLAlchemy engines.
keys : string or sequence
columns to use a primary key
- con: an open SQL database connection object or an SQLAlchemy engine
+ con: an open SQL database connection object or a SQLAlchemy connectable
Using SQLAlchemy makes it possible to use any DB supported by that
library.
If a DBAPI2 object, only sqlite3 is supported.
@@ -1673,8 +1688,8 @@ def write_frame(frame, name, con, flavor='sqlite', if_exists='fail', **kwargs):
- With ``to_sql`` the index is written to the sql database by default. To
keep the behaviour this function you need to specify ``index=False``.
- - The new ``to_sql`` function supports sqlalchemy engines to work with
- different sql flavors.
+ - The new ``to_sql`` function supports sqlalchemy connectables to work
+ with different sql flavors.
See also
--------
diff --git a/pandas/io/tests/test_sql.py b/pandas/io/tests/test_sql.py
index d8bc3c61f68f0..ba951c7cb513d 100644
--- a/pandas/io/tests/test_sql.py
+++ b/pandas/io/tests/test_sql.py
@@ -9,7 +9,8 @@
- `TestSQLiteFallbackApi`: test the public API with a sqlite DBAPI connection
- Tests for the different SQL flavors (flavor specific type conversions)
- Tests for the sqlalchemy mode: `_TestSQLAlchemy` is the base class with
- common methods, the different tested flavors (sqlite3, MySQL, PostgreSQL)
+ common methods, `_TestSQLAlchemyConn` tests the API with a SQLAlchemy
+ Connection object. The different tested flavors (sqlite3, MySQL, PostgreSQL)
derive from the base class
- Tests for the fallback mode (`TestSQLiteFallback` and `TestMySQLLegacy`)
@@ -43,6 +44,8 @@
import sqlalchemy
import sqlalchemy.schema
import sqlalchemy.sql.sqltypes as sqltypes
+ from sqlalchemy.ext import declarative
+ from sqlalchemy.orm import session as sa_session
SQLALCHEMY_INSTALLED = True
except ImportError:
SQLALCHEMY_INSTALLED = False
@@ -867,6 +870,31 @@ def test_sqlalchemy_type_mapping(self):
self.assertTrue(isinstance(table.table.c['time'].type, sqltypes.DateTime))
+class _EngineToConnMixin(object):
+ """
+ A mixin that causes setup_connect to create a conn rather than an engine.
+ """
+
+ def setUp(self):
+ super(_EngineToConnMixin, self).setUp()
+ engine = self.conn
+ conn = engine.connect()
+ self.__tx = conn.begin()
+ self.pandasSQL = sql.SQLDatabase(conn)
+ self.__engine = engine
+ self.conn = conn
+
+ def tearDown(self):
+ self.__tx.rollback()
+ self.conn.close()
+ self.conn = self.__engine
+ self.pandasSQL = sql.SQLDatabase(self.__engine)
+
+
+class TestSQLApiConn(_EngineToConnMixin, TestSQLApi):
+ pass
+
+
class TestSQLiteFallbackApi(_TestSQLApi):
"""
Test the public sqlite connection fallback API
@@ -1003,9 +1031,6 @@ def setup_connect(self):
except sqlalchemy.exc.OperationalError:
raise nose.SkipTest("Can't connect to {0} server".format(self.flavor))
- def tearDown(self):
- raise NotImplementedError()
-
def test_aread_sql(self):
self._read_sql_iris()
@@ -1359,9 +1384,58 @@ def test_double_precision(self):
self.assertTrue(isinstance(col_dict['i32'].type, sqltypes.Integer))
self.assertTrue(isinstance(col_dict['i64'].type, sqltypes.BigInteger))
+ def test_connectable_issue_example(self):
+ # This tests the example raised in issue
+ # https://github.com/pydata/pandas/issues/10104
+
+ def foo(connection):
+ query = 'SELECT test_foo_data FROM test_foo_data'
+ return sql.read_sql_query(query, con=connection)
+
+ def bar(connection, data):
+ data.to_sql(name='test_foo_data', con=connection, if_exists='append')
+
+ def main(connectable):
+ with connectable.connect() as conn:
+ with conn.begin():
+ foo_data = conn.run_callable(foo)
+ conn.run_callable(bar, foo_data)
+
+ DataFrame({'test_foo_data': [0, 1, 2]}).to_sql('test_foo_data', self.conn)
+ main(self.conn)
+
+ def test_temporary_table(self):
+ test_data = u'Hello, World!'
+ expected = DataFrame({'spam': [test_data]})
+ Base = declarative.declarative_base()
+
+ class Temporary(Base):
+ __tablename__ = 'temp_test'
+ __table_args__ = {'prefixes': ['TEMPORARY']}
+ id = sqlalchemy.Column(sqlalchemy.Integer, primary_key=True)
+ spam = sqlalchemy.Column(sqlalchemy.Unicode(30), nullable=False)
+
+ Session = sa_session.sessionmaker(bind=self.conn)
+ session = Session()
+ with session.transaction:
+ conn = session.connection()
+ Temporary.__table__.create(conn)
+ session.add(Temporary(spam=test_data))
+ session.flush()
+ df = sql.read_sql_query(
+ sql=sqlalchemy.select([Temporary.spam]),
+ con=conn,
+ )
+
+ tm.assert_frame_equal(df, expected)
+
+
+class _TestSQLAlchemyConn(_EngineToConnMixin, _TestSQLAlchemy):
+ def test_transactions(self):
+ raise nose.SkipTest("Nested transactions rollbacks don't work with Pandas")
-class TestSQLiteAlchemy(_TestSQLAlchemy):
+class _TestSQLiteAlchemy(object):
"""
Test the sqlalchemy backend against an in-memory sqlite database.
@@ -1378,8 +1452,8 @@ def setup_driver(cls):
cls.driver = None
def tearDown(self):
+ super(_TestSQLiteAlchemy, self).tearDown()
# in memory so tables should not be removed explicitly
- pass
def test_default_type_conversion(self):
df = sql.read_sql_table("types_test_data", self.conn)
@@ -1417,7 +1491,7 @@ def test_bigint_warning(self):
self.assertEqual(len(w), 0, "Warning triggered for other table")
-class TestMySQLAlchemy(_TestSQLAlchemy):
+class _TestMySQLAlchemy(object):
"""
Test the sqlalchemy backend against an MySQL database.
@@ -1438,6 +1512,7 @@ def setup_driver(cls):
raise nose.SkipTest('pymysql not installed')
def tearDown(self):
+ super(_TestMySQLAlchemy, self).tearDown()
c = self.conn.execute('SHOW TABLES')
for table in c.fetchall():
self.conn.execute('DROP TABLE %s' % table[0])
@@ -1491,7 +1566,7 @@ def test_read_procedure(self):
tm.assert_frame_equal(df, res2)
-class TestPostgreSQLAlchemy(_TestSQLAlchemy):
+class _TestPostgreSQLAlchemy(object):
"""
Test the sqlalchemy backend against an PostgreSQL database.
@@ -1512,6 +1587,7 @@ def setup_driver(cls):
raise nose.SkipTest('psycopg2 not installed')
def tearDown(self):
+ super(_TestPostgreSQLAlchemy, self).tearDown()
c = self.conn.execute(
"SELECT table_name FROM information_schema.tables"
" WHERE table_schema = 'public'")
@@ -1563,15 +1639,18 @@ def test_schema_support(self):
## specifying schema in user-provided meta
- engine2 = self.connect()
- meta = sqlalchemy.MetaData(engine2, schema='other')
- pdsql = sql.SQLDatabase(engine2, meta=meta)
- pdsql.to_sql(df, 'test_schema_other2', index=False)
- pdsql.to_sql(df, 'test_schema_other2', index=False, if_exists='replace')
- pdsql.to_sql(df, 'test_schema_other2', index=False, if_exists='append')
- res1 = sql.read_sql_table('test_schema_other2', self.conn, schema='other')
- res2 = pdsql.read_table('test_schema_other2')
- tm.assert_frame_equal(res1, res2)
+ # The schema won't be applied on another Connection
+ # because of transactional schemas
+ if isinstance(self.conn, sqlalchemy.engine.Engine):
+ engine2 = self.connect()
+ meta = sqlalchemy.MetaData(engine2, schema='other')
+ pdsql = sql.SQLDatabase(engine2, meta=meta)
+ pdsql.to_sql(df, 'test_schema_other2', index=False)
+ pdsql.to_sql(df, 'test_schema_other2', index=False, if_exists='replace')
+ pdsql.to_sql(df, 'test_schema_other2', index=False, if_exists='append')
+ res1 = sql.read_sql_table('test_schema_other2', self.conn, schema='other')
+ res2 = pdsql.read_table('test_schema_other2')
+ tm.assert_frame_equal(res1, res2)
def test_datetime_with_time_zone(self):
# Test to see if we read the date column with timezones that
@@ -1587,6 +1666,31 @@ def test_datetime_with_time_zone(self):
# "2000-06-01 00:00:00-07:00" should convert to "2000-06-01 07:00:00"
self.assertEqual(df.DateColWithTz[1], Timestamp('2000-06-01 07:00:00'))
+
+class TestMySQLAlchemy(_TestMySQLAlchemy, _TestSQLAlchemy):
+ pass
+
+
+class TestMySQLAlchemyConn(_TestMySQLAlchemy, _TestSQLAlchemyConn):
+ pass
+
+
+class TestPostgreSQLAlchemy(_TestPostgreSQLAlchemy, _TestSQLAlchemy):
+ pass
+
+
+class TestPostgreSQLAlchemyConn(_TestPostgreSQLAlchemy, _TestSQLAlchemyConn):
+ pass
+
+
+class TestSQLiteAlchemy(_TestSQLiteAlchemy, _TestSQLAlchemy):
+ pass
+
+
+class TestSQLiteAlchemyConn(_TestSQLiteAlchemy, _TestSQLAlchemyConn):
+ pass
+
+
#------------------------------------------------------------------------------
#--- Test Sqlite / MySQL fallback
| Fixes #7877
| https://api.github.com/repos/pandas-dev/pandas/pulls/10105 | 2015-05-11T15:35:25Z | 2015-07-03T17:44:56Z | 2015-07-03T17:44:56Z | 2015-07-03T20:44:15Z |
ENH: add expand kw to str.get_dummies | diff --git a/pandas/core/strings.py b/pandas/core/strings.py
index a8907ac192707..08f7d1b6481f4 100644
--- a/pandas/core/strings.py
+++ b/pandas/core/strings.py
@@ -424,17 +424,21 @@ def str_extract(arr, pat, flags=0):
Pattern or regular expression
flags : int, default 0 (no flags)
re module flags, e.g. re.IGNORECASE
+ expand : None or bool, default None
+ * If None, return Series/Index (one group) or DataFrame/MultiIndex (multiple groups)
+ * If True, return DataFrame/MultiIndex expanding dimensionality.
+ * If False, return Series/Index.
Returns
-------
- extracted groups : Series (one group) or DataFrame (multiple groups)
+ extracted groups : Series/Index or DataFrame/MultiIndex of objects
Note that dtype of the result is always object, even when no match is
found and the result is a Series or DataFrame containing only NaN
values.
Examples
--------
- A pattern with one group will return a Series. Non-matches will be NaN.
+ A pattern with one group returns a Series. Non-matches will be NaN.
>>> Series(['a1', 'b2', 'c3']).str.extract('[ab](\d)')
0 1
@@ -466,11 +470,14 @@ def str_extract(arr, pat, flags=0):
1 b 2
2 NaN NaN
- """
- from pandas.core.series import Series
- from pandas.core.frame import DataFrame
- from pandas.core.index import Index
+ Or you can specify ``expand=False`` to return Series.
+ >>> pd.Series(['a1', 'b2', 'c3']).str.extract('([ab])?(\d)', expand=False)
+ 0 [a, 1]
+ 1 [b, 2]
+ 2 [nan, 3]
+ Name: [0, 1], dtype: object
+ """
regex = re.compile(pat, flags=flags)
# just to be safe, check this
if regex.groups == 0:
@@ -490,18 +497,9 @@ def f(x):
result = np.array([f(val)[0] for val in arr], dtype=object)
name = _get_single_group_name(regex)
else:
- if isinstance(arr, Index):
- raise ValueError("only one regex group is supported with Index")
- name = None
names = dict(zip(regex.groupindex.values(), regex.groupindex.keys()))
- columns = [names.get(1 + i, i) for i in range(regex.groups)]
- if arr.empty:
- result = DataFrame(columns=columns, dtype=object)
- else:
- result = DataFrame([f(val) for val in arr],
- columns=columns,
- index=arr.index,
- dtype=object)
+ name = [names.get(1 + i, i) for i in range(regex.groups)]
+ result = np.array([f(val) for val in arr], dtype=object)
return result, name
@@ -514,10 +512,13 @@ def str_get_dummies(arr, sep='|'):
----------
sep : string, default "|"
String to split on.
+ expand : bool, default True
+ * If True, return DataFrame/MultiIndex expanding dimensionality.
+ * If False, return Series/Index.
Returns
-------
- dummies : DataFrame
+ dummies : Series/Index or DataFrame/MultiIndex of objects
Examples
--------
@@ -537,14 +538,7 @@ def str_get_dummies(arr, sep='|'):
--------
pandas.get_dummies
"""
- from pandas.core.frame import DataFrame
from pandas.core.index import Index
-
- # GH9980, Index.str does not support get_dummies() as it returns a frame
- if isinstance(arr, Index):
- raise TypeError("get_dummies is not supported for string methods on Index")
-
- # TODO remove this hack?
arr = arr.fillna('')
try:
arr = sep + arr + sep
@@ -561,7 +555,7 @@ def str_get_dummies(arr, sep='|'):
for i, t in enumerate(tags):
pat = sep + t + sep
dummies[:, i] = lib.map_infer(arr.values, lambda x: pat in x)
- return DataFrame(dummies, arr.index, tags)
+ return dummies, tags
def str_join(arr, sep):
@@ -1081,7 +1075,10 @@ def __iter__(self):
i += 1
g = self.get(i)
- def _wrap_result(self, result, use_codes=True, name=None):
+ def _wrap_result(self, result, use_codes=True, name=None, expand=False):
+
+ if not isinstance(expand, bool):
+ raise ValueError("expand must be True or False")
# for category, we do the stuff on the categories, so blow it up
# to the full series again
@@ -1095,39 +1092,11 @@ def _wrap_result(self, result, use_codes=True, name=None):
# can be merged to _wrap_result_expand in v0.17
from pandas.core.series import Series
from pandas.core.frame import DataFrame
- from pandas.core.index import Index
+ from pandas.core.index import Index, MultiIndex
- if not hasattr(result, 'ndim'):
- return result
name = name or getattr(result, 'name', None) or self._orig.name
- if result.ndim == 1:
- if isinstance(self._orig, Index):
- # if result is a boolean np.array, return the np.array
- # instead of wrapping it into a boolean Index (GH 8875)
- if is_bool_dtype(result):
- return result
- return Index(result, name=name)
- return Series(result, index=self._orig.index, name=name)
- else:
- assert result.ndim < 3
- return DataFrame(result, index=self._orig.index)
-
- def _wrap_result_expand(self, result, expand=False):
- if not isinstance(expand, bool):
- raise ValueError("expand must be True or False")
-
- # for category, we do the stuff on the categories, so blow it up
- # to the full series again
- if self._is_categorical:
- result = take_1d(result, self._orig.cat.codes)
-
- from pandas.core.index import Index, MultiIndex
- if not hasattr(result, 'ndim'):
- return result
-
if isinstance(self._orig, Index):
- name = getattr(result, 'name', None)
# if result is a boolean np.array, return the np.array
# instead of wrapping it into a boolean Index (GH 8875)
if hasattr(result, 'dtype') and is_bool_dtype(result):
@@ -1137,7 +1106,7 @@ def _wrap_result_expand(self, result, expand=False):
result = list(result)
return MultiIndex.from_tuples(result, names=name)
else:
- return Index(result, name=name)
+ return Index(result, name=name, tupleize_cols=False)
else:
index = self._orig.index
if expand:
@@ -1148,9 +1117,11 @@ def cons_row(x):
return [ x ]
cons = self._orig._constructor_expanddim
data = [cons_row(x) for x in result]
- return cons(data, index=index)
+ return cons(data, index=index, columns=name,
+ dtype=result.dtype)
else:
- name = getattr(result, 'name', None)
+ if result.ndim > 1:
+ result = list(result)
cons = self._orig._constructor
return cons(result, name=name, index=index)
@@ -1158,20 +1129,22 @@ def cons_row(x):
def cat(self, others=None, sep=None, na_rep=None):
data = self._orig if self._is_categorical else self._data
result = str_cat(data, others=others, sep=sep, na_rep=na_rep)
+ if not hasattr(result, 'ndim'):
+ # str_cat may results in np.nan or str
+ return result
return self._wrap_result(result, use_codes=(not self._is_categorical))
-
@deprecate_kwarg('return_type', 'expand',
mapping={'series': False, 'frame': True})
@copy(str_split)
def split(self, pat=None, n=-1, expand=False):
result = str_split(self._data, pat, n=n)
- return self._wrap_result_expand(result, expand=expand)
+ return self._wrap_result(result, expand=expand)
@copy(str_rsplit)
def rsplit(self, pat=None, n=-1, expand=False):
result = str_rsplit(self._data, pat, n=n)
- return self._wrap_result_expand(result, expand=expand)
+ return self._wrap_result(result, expand=expand)
_shared_docs['str_partition'] = ("""
Split the string at the %(side)s occurrence of `sep`, and return 3 elements
@@ -1222,7 +1195,7 @@ def rsplit(self, pat=None, n=-1, expand=False):
def partition(self, pat=' ', expand=True):
f = lambda x: x.partition(pat)
result = _na_map(f, self._data)
- return self._wrap_result_expand(result, expand=expand)
+ return self._wrap_result(result, expand=expand)
@Appender(_shared_docs['str_partition'] % {'side': 'last',
'return': '3 elements containing two empty strings, followed by the string itself',
@@ -1230,7 +1203,7 @@ def partition(self, pat=' ', expand=True):
def rpartition(self, pat=' ', expand=True):
f = lambda x: x.rpartition(pat)
result = _na_map(f, self._data)
- return self._wrap_result_expand(result, expand=expand)
+ return self._wrap_result(result, expand=expand)
@copy(str_get)
def get(self, i):
@@ -1371,12 +1344,13 @@ def wrap(self, width, **kwargs):
return self._wrap_result(result)
@copy(str_get_dummies)
- def get_dummies(self, sep='|'):
+ def get_dummies(self, sep='|', expand=True):
# we need to cast to Series of strings as only that has all
# methods available for making the dummies...
data = self._orig.astype(str) if self._is_categorical else self._data
- result = str_get_dummies(data, sep)
- return self._wrap_result(result, use_codes=(not self._is_categorical))
+ result, name = str_get_dummies(data, sep)
+ return self._wrap_result(result, use_codes=(not self._is_categorical),
+ name=name, expand=expand)
@copy(str_translate)
def translate(self, table, deletechars=None):
@@ -1389,9 +1363,18 @@ def translate(self, table, deletechars=None):
findall = _pat_wrapper(str_findall, flags=True)
@copy(str_extract)
- def extract(self, pat, flags=0):
- result, name = str_extract(self._data, pat, flags=flags)
- return self._wrap_result(result, name=name)
+ def extract(self, pat, flags=0, expand=None):
+ result, name = str_extract(self._orig, pat, flags=flags)
+ if expand is None and hasattr(result, 'ndim'):
+ # to be compat with previous behavior
+ if len(result) == 0:
+ # for empty input
+ expand = True if isinstance(name, list) else False
+ elif result.ndim > 1:
+ expand = True
+ else:
+ expand = False
+ return self._wrap_result(result, name=name, use_codes=False, expand=expand)
_shared_docs['find'] = ("""
Return %(side)s indexes in each strings in the Series/Index
diff --git a/pandas/tests/test_categorical.py b/pandas/tests/test_categorical.py
index e98c98fdec8b3..8d8d1e6d456c0 100755
--- a/pandas/tests/test_categorical.py
+++ b/pandas/tests/test_categorical.py
@@ -3714,6 +3714,7 @@ def test_str_accessor_api_for_categorical(self):
for func, args, kwargs in func_defs:
+ print(func, args, kwargs, c)
res = getattr(c.str, func)(*args, **kwargs)
exp = getattr(s.str, func)(*args, **kwargs)
diff --git a/pandas/tests/test_strings.py b/pandas/tests/test_strings.py
index 0013a6579718a..b43d637c3c4c5 100644
--- a/pandas/tests/test_strings.py
+++ b/pandas/tests/test_strings.py
@@ -522,15 +522,24 @@ def test_extract(self):
exp = DataFrame([['BAD__', 'BAD'], er, er])
tm.assert_frame_equal(result, exp)
+ result = values.str.extract('.*(BAD[_]+).*(BAD)', expand=False)
+ exp = Series([['BAD__', 'BAD'], er, er], name=[0, 1])
+ tm.assert_series_equal(result, exp)
+
# mixed
mixed = Series(['aBAD_BAD', NA, 'BAD_b_BAD', True, datetime.today(),
'foo', None, 1, 2.])
- rs = Series(mixed).str.extract('.*(BAD[_]+).*(BAD)')
+ rs = mixed.str.extract('.*(BAD[_]+).*(BAD)')
exp = DataFrame([['BAD_', 'BAD'], er, ['BAD_', 'BAD'], er, er,
er, er, er, er])
tm.assert_frame_equal(rs, exp)
+ rs = mixed.str.extract('.*(BAD[_]+).*(BAD)', expand=False)
+ exp = Series([['BAD_', 'BAD'], er, ['BAD_', 'BAD'], er, er,
+ er, er, er, er], name=[0, 1])
+ tm.assert_series_equal(rs, exp)
+
# unicode
values = Series([u('fooBAD__barBAD'), NA, u('foo')])
@@ -538,12 +547,25 @@ def test_extract(self):
exp = DataFrame([[u('BAD__'), u('BAD')], er, er])
tm.assert_frame_equal(result, exp)
- # GH9980
- # Index only works with one regex group since
- # multi-group would expand to a frame
+ result = values.str.extract('.*(BAD[_]+).*(BAD)', expand=False)
+ exp = Series([[u('BAD__'), u('BAD')], er, er], name=[0, 1])
+ tm.assert_series_equal(result, exp)
+
idx = Index(['A1', 'A2', 'A3', 'A4', 'B5'])
- with tm.assertRaisesRegexp(ValueError, "supported"):
- idx.str.extract('([AB])([123])')
+ result = idx.str.extract('([AB])([123])')
+ exp = MultiIndex.from_tuples([('A', '1'), ('A', '2'), ('A', '3'),
+ (NA, NA), (NA, NA)], names=[0, 1])
+ tm.assert_index_equal(result, exp)
+
+ # check warning to return single Series
+ s = Series(['A1', 'A2'])
+ result = s.str.extract(r'(A)\d')
+ tm.assert_series_equal(result, Series(['A', 'A']))
+
+ # expand=True results in DataFrame
+ s = Series(['A1', 'A2'])
+ result = s.str.extract(r'(A)\d', expand=True)
+ tm.assert_frame_equal(result, DataFrame(['A', 'A']))
# these should work for both Series and Index
for klass in [Series, Index]:
@@ -635,6 +657,110 @@ def check_index(index):
tm.makeDateIndex, tm.makePeriodIndex ]:
check_index(index())
+ def test_extract_index(self):
+ values = Index(['fooBAD__barBAD', NA, 'foo'])
+ er = [NA, NA] # empty row
+
+ result = values.str.extract('.*(BAD[_]+).*(BAD)')
+ exp = MultiIndex.from_tuples([['BAD__', 'BAD'], er, er], names=[0, 1])
+ tm.assert_index_equal(result, exp)
+
+ # mixed
+ mixed = Index(['aBAD_BAD', NA, 'BAD_b_BAD', True, datetime.today(),
+ 'foo', None, 1, 2.])
+
+ rs = mixed.str.extract('.*(BAD[_]+).*(BAD)')
+ exp = MultiIndex.from_tuples([['BAD_', 'BAD'], er, ['BAD_', 'BAD'], er, er,
+ er, er, er, er], names=[0, 1])
+ tm.assert_index_equal(rs, exp)
+
+ # unicode
+ values = Index([u('fooBAD__barBAD'), NA, u('foo')])
+
+ result = values.str.extract('.*(BAD[_]+).*(BAD)')
+ exp = MultiIndex.from_tuples([[u('BAD__'), u('BAD')], er, er], names=[0, 1])
+ tm.assert_index_equal(result, exp)
+
+ s = Index(['A1', 'B2', 'C3'])
+ # one group, no matches
+ result = s.str.extract('(_)')
+ exp = Index([NA, NA, NA], dtype=object)
+ tm.assert_index_equal(result, exp)
+
+ # two groups, no matches
+ result = s.str.extract('(_)(_)')
+ exp = MultiIndex.from_tuples([[NA, NA], [NA, NA], [NA, NA]],
+ names=[0, 1])
+ tm.assert_index_equal(result, exp)
+
+ # one group, some matches
+ result = s.str.extract('([AB])[123]')
+ exp = Index(['A', 'B', NA])
+ tm.assert_index_equal(result, exp)
+ self.assertTrue(result.nlevels, 1)
+
+ # two groups, some matches
+ result = s.str.extract('([AB])([123])')
+ exp = MultiIndex.from_tuples([['A', '1'], ['B', '2'], [NA, NA]], names=[0, 1])
+ tm.assert_index_equal(result, exp)
+ self.assertTrue(result.nlevels, 2)
+
+ result = s.str.extract('([ABC])([123])', expand=False)
+ exp = Index(np.array([['A', '1'], ['B', '2'], ['C', '3']]),
+ dtype=object, name=[0, 1])
+ tm.assert_index_equal(result, exp)
+ self.assertTrue(result.nlevels, 1)
+
+ # one named group
+ result = s.str.extract('(?P<letter>[AB])')
+ exp = Index(['A', 'B', NA], name='letter')
+ tm.assert_index_equal(result, exp)
+
+ # two named groups
+ result = s.str.extract('(?P<letter>[AB])(?P<number>[123])')
+ exp = MultiIndex.from_tuples([['A', '1'], ['B', '2'], [NA, NA]],
+ names=['letter', 'number'])
+ tm.assert_index_equal(result, exp)
+ self.assertTrue(result.nlevels, 2)
+
+ result = s.str.extract('(?P<letter>[ABC])(?P<number>[123])', expand=False)
+ exp = Index(np.array([['A', '1'], ['B', '2'], ['C', '3']]),
+ dtype=object, name=['letter', 'number'])
+ tm.assert_index_equal(result, exp)
+ self.assertTrue(result.nlevels, 1)
+
+ # mix named and unnamed groups
+ result = s.str.extract('([AB])(?P<number>[123])')
+ exp = MultiIndex.from_tuples([['A', '1'], ['B', '2'], [NA, NA]],
+ names=[0, 'number'])
+ tm.assert_index_equal(result, exp)
+ self.assertTrue(result.nlevels, 2)
+
+ # one normal group, one non-capturing group
+ result = s.str.extract('([AB])(?:[123])')
+ exp = Index(['A', 'B', NA])
+ tm.assert_index_equal(result, exp)
+ self.assertTrue(result.nlevels, 1)
+
+ # two normal groups, one non-capturing group
+ result = Index(['A11', 'B22', 'C33']).str.extract('([AB])([123])(?:[123])')
+ exp = MultiIndex.from_tuples([['A', '1'], ['B', '2'], [NA, NA]], names=[0, 1])
+ tm.assert_index_equal(result, exp)
+
+ # one optional group followed by one normal group
+ result = Index(['A1', 'B2', '3']).str.extract('(?P<letter>[AB])?(?P<number>[123])')
+ exp = MultiIndex.from_tuples([['A', '1'], ['B', '2'], [NA, '3']],
+ names=['letter', 'number'])
+ tm.assert_index_equal(result, exp)
+ self.assertTrue(result.nlevels, 2)
+
+ # one normal group followed by one optional group
+ result = Index(['A1', 'B2', 'C']).str.extract('(?P<letter>[ABC])(?P<number>[123])?')
+ exp = MultiIndex.from_tuples([['A', '1'], ['B', '2'], ['C', NA]],
+ names=['letter', 'number'])
+ tm.assert_index_equal(result, exp)
+ self.assertTrue(result.nlevels, 2)
+
def test_extract_single_series_name_is_preserved(self):
s = Series(['a3', 'b3', 'c2'], name='bob')
r = s.str.extract(r'(?P<sue>[a-z])')
@@ -777,11 +903,30 @@ def test_get_dummies(self):
columns=list('7ab'))
tm.assert_frame_equal(result, expected)
- # GH9980
- # Index.str does not support get_dummies() as it returns a frame
- with tm.assertRaisesRegexp(TypeError, "not supported"):
- idx = Index(['a|b', 'a|c', 'b|c'])
- idx.str.get_dummies('|')
+ idx = Index(['a|b', 'a|c', 'b|c'])
+ result = idx.str.get_dummies('|')
+ expected = MultiIndex.from_tuples([(1, 1, 0), (1, 0, 1), (0, 1, 1)],
+ names=['a', 'b', 'c'])
+ tm.assert_index_equal(result, expected)
+
+ def test_get_dummies_without_expand(self):
+ s = Series(['a|b', 'a|c', np.nan])
+ result = s.str.get_dummies('|', expand=False)
+ expected = Series([[1, 1, 0], [1, 0, 1], [0, 0, 0]], name=['a', 'b', 'c'])
+ tm.assert_series_equal(result, expected)
+
+ s = Series(['a;b', 'a', 7])
+ result = s.str.get_dummies(';', expand=False)
+ expected = Series([[0, 1, 1], [0, 1, 0], [1, 0, 0]],
+ name=list('7ab'))
+ tm.assert_series_equal(result, expected)
+
+ idx = Index(['a|b', 'a|c', 'b|c'])
+ result = idx.str.get_dummies('|', expand=False)
+ expected = Index(np.array([(1, 1, 0), (1, 0, 1), (0, 1, 1)]),
+ name=['a', 'b', 'c'])
+ tm.assert_index_equal(result, expected)
+ self.assertEqual(result.nlevels, 1)
def test_join(self):
values = Series(['a_b_c', 'c_d_e', np.nan, 'f_g_h'])
| Ref: #10008.
Though this still under work (needs #10089 to simplify `get_dummies` flow), would like to discuss followings.
~~#### `.str.extract` note: overlaps with #11386~~
~~Currently it returns `Series` for a single group and `DataFrame` for multiples. To support `expand` kw, we have to choose :~~
~~1. Add `expand` option keeping existing behavior with warning for future change to `extract=True` (current impl).~~
~~2. Add `expand` option keeping existing behavior. Standardize `extract=None` (or other option) to select returning dimensionality automatically.~~
~~3. Add `expand` option with default `True` (or `False`). This breaks the API.~~
~~4. Make `Index.str.extract` return `MultiIndex` in multiple group case without adding `expand` option.~~
#### `.str.get_dummies`
1. Add `expand` kw with default `True`. Currently this always returns `DataFrame` (and raises `TypeError` in `Index`). This doesn't break an API (current impl).
2. Make `Index.str.get_dummies` return `MultiIndex` without adding `expand` option.
CC @mortada
| https://api.github.com/repos/pandas-dev/pandas/pulls/10103 | 2015-05-11T14:50:19Z | 2016-04-11T12:54:39Z | null | 2016-04-12T22:37:11Z |
v0.16.1 docs | diff --git a/doc/source/basics.rst b/doc/source/basics.rst
index 76efdc0553c7d..6c743352a34ae 100644
--- a/doc/source/basics.rst
+++ b/doc/source/basics.rst
@@ -236,7 +236,7 @@ see :ref:`here<indexing.boolean>`
Boolean Reductions
~~~~~~~~~~~~~~~~~~
- You can apply the reductions: :attr:`~DataFrame.empty`, :meth:`~DataFrame.any`,
+You can apply the reductions: :attr:`~DataFrame.empty`, :meth:`~DataFrame.any`,
:meth:`~DataFrame.all`, and :meth:`~DataFrame.bool` to provide a
way to summarize a boolean result.
diff --git a/doc/source/categorical.rst b/doc/source/categorical.rst
index 11e7fb0fd4117..c05d4045e6fcc 100644
--- a/doc/source/categorical.rst
+++ b/doc/source/categorical.rst
@@ -813,12 +813,16 @@ basic type) and applying along columns will also convert to object.
df.apply(lambda row: type(row["cats"]), axis=1)
df.apply(lambda col: col.dtype, axis=0)
-No Categorical Index
-~~~~~~~~~~~~~~~~~~~~
+Categorical Index
+~~~~~~~~~~~~~~~~~
+
+.. versionadded:: 0.16.1
+
+A new ``CategoricalIndex`` index type is introduced in version 0.16.1. See the
+:ref:`advanced indexing docs <indexing.categoricalindex>` for a more detailed
+explanation.
-There is currently no index of type ``category``, so setting the index to categorical column will
-convert the categorical data to a "normal" dtype first and therefore remove any custom
-ordering of the categories:
+Setting the index, will create create a ``CategoricalIndex``
.. ipython:: python
@@ -827,13 +831,12 @@ ordering of the categories:
values = [4,2,3,1]
df = DataFrame({"strings":strings, "values":values}, index=cats)
df.index
- # This should sort by categories but does not as there is no CategoricalIndex!
+ # This now sorts by the categories order
df.sort_index()
-.. note::
- This could change if a `CategoricalIndex` is implemented (see
- https://github.com/pydata/pandas/issues/7629)
-
+In previous versions (<0.16.1) there is no index of type ``category``, so
+setting the index to categorical column will convert the categorical data to a
+"normal" dtype first and therefore remove any custom ordering of the categories.
Side Effects
~~~~~~~~~~~~
diff --git a/doc/source/contributing.rst b/doc/source/contributing.rst
index 1ece60bf704d6..1f58992dba017 100644
--- a/doc/source/contributing.rst
+++ b/doc/source/contributing.rst
@@ -113,10 +113,10 @@ This creates the directory `pandas-yourname` and connects your repository to
the upstream (main project) *pandas* repository.
The testing suite will run automatically on Travis-CI once your Pull Request is
-submitted. However, if you wish to run the test suite on a branch prior to
+submitted. However, if you wish to run the test suite on a branch prior to
submitting the Pull Request, then Travis-CI needs to be hooked up to your
GitHub repository. Instructions are for doing so are `here
-<http://about.travis-ci.org/docs/user/getting-started/>`_.
+<http://about.travis-ci.org/docs/user/getting-started/>`__.
Creating a Branch
-----------------
@@ -219,7 +219,7 @@ To return to you home root environment:
deactivate
See the full ``conda`` docs `here
-<http://conda.pydata.org/docs>`_.
+<http://conda.pydata.org/docs>`__.
At this point you can easily do an *in-place* install, as detailed in the next section.
@@ -372,7 +372,7 @@ If you want to do a full clean build, do::
Starting with 0.13.1 you can tell ``make.py`` to compile only a single section
of the docs, greatly reducing the turn-around time for checking your changes.
You will be prompted to delete `.rst` files that aren't required. This is okay
-since the prior version can be checked out from git, but make sure to
+since the prior version can be checked out from git, but make sure to
not commit the file deletions.
::
@@ -401,7 +401,7 @@ Built Master Branch Documentation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When pull-requests are merged into the pandas *master* branch, the main parts of the documentation are
-also built by Travis-CI. These docs are then hosted `here <http://pandas-docs.github.io/pandas-docs-travis>`_.
+also built by Travis-CI. These docs are then hosted `here <http://pandas-docs.github.io/pandas-docs-travis>`__.
Contributing to the code base
=============================
diff --git a/doc/source/install.rst b/doc/source/install.rst
index 79adab0463588..3aa6b338e3397 100644
--- a/doc/source/install.rst
+++ b/doc/source/install.rst
@@ -35,7 +35,7 @@ pandas at all.
Simply create an account, and have access to pandas from within your brower via
an `IPython Notebook <http://ipython.org/notebook.html>`__ in a few minutes.
-.. _install.anaconda
+.. _install.anaconda:
Installing pandas with Anaconda
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -68,7 +68,7 @@ admin rights to install it, it will install in the user's home directory, and
this also makes it trivial to delete Anaconda at a later date (just delete
that folder).
-.. _install.miniconda
+.. _install.miniconda:
Installing pandas with Miniconda
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/doc/source/text.rst b/doc/source/text.rst
index 810e3e0146f9f..d40445d8490f7 100644
--- a/doc/source/text.rst
+++ b/doc/source/text.rst
@@ -82,11 +82,11 @@ Elements in the split lists can be accessed using ``get`` or ``[]`` notation:
s2.str.split('_').str.get(1)
s2.str.split('_').str[1]
-Easy to expand this to return a DataFrame using ``return_type``.
+Easy to expand this to return a DataFrame using ``expand``.
.. ipython:: python
- s2.str.split('_', return_type='frame')
+ s2.str.split('_', expand=True)
Methods like ``replace`` and ``findall`` take `regular expressions
<https://docs.python.org/2/library/re.html>`__, too:
diff --git a/doc/source/visualization.rst b/doc/source/visualization.rst
index 6dfeeadeb0167..51912b5d6b106 100644
--- a/doc/source/visualization.rst
+++ b/doc/source/visualization.rst
@@ -220,8 +220,8 @@ Histogram can be drawn specifying ``kind='hist'``.
.. ipython:: python
- df4 = pd.DataFrame({'a': randn(1000) + 1, 'b': randn(1000),
- 'c': randn(1000) - 1}, columns=['a', 'b', 'c'])
+ df4 = pd.DataFrame({'a': np.random.randn(1000) + 1, 'b': np.random.randn(1000),
+ 'c': np.random.randn(1000) - 1}, columns=['a', 'b', 'c'])
plt.figure();
diff --git a/doc/source/whatsnew/v0.16.1.txt b/doc/source/whatsnew/v0.16.1.txt
index 5e893f3c4fd73..79a0c48238be7 100755
--- a/doc/source/whatsnew/v0.16.1.txt
+++ b/doc/source/whatsnew/v0.16.1.txt
@@ -31,44 +31,6 @@ Highlights include:
Enhancements
~~~~~~~~~~~~
-- ``BusinessHour`` offset is now supported, which represents business hours starting from 09:00 - 17:00 on ``BusinessDay`` by default. See :ref:`Here <timeseries.businesshour>` for details. (:issue:`7905`)
-
- .. ipython:: python
-
- Timestamp('2014-08-01 09:00') + BusinessHour()
- Timestamp('2014-08-01 07:00') + BusinessHour()
- Timestamp('2014-08-01 16:30') + BusinessHour()
-
-- ``DataFrame.diff`` now takes an ``axis`` parameter that determines the direction of differencing (:issue:`9727`)
-
-- Allow ``clip``, ``clip_lower``, and ``clip_upper`` to accept array-like arguments as thresholds (This is a regression from 0.11.0). These methods now have an ``axis`` parameter which determines how the Series or DataFrame will be aligned with the threshold(s). (:issue:`6966`)
-
-- ``DataFrame.mask()`` and ``Series.mask()`` now support same keywords as ``where`` (:issue:`8801`)
-
-- ``drop`` function can now accept ``errors`` keyword to suppress ``ValueError`` raised when any of label does not exist in the target data. (:issue:`6736`)
-
- .. ipython:: python
-
- df = DataFrame(np.random.randn(3, 3), columns=['A', 'B', 'C'])
- df.drop(['A', 'X'], axis=1, errors='ignore')
-
-- Allow conversion of values with dtype ``datetime64`` or ``timedelta64`` to strings using ``astype(str)`` (:issue:`9757`)
-- ``get_dummies`` function now accepts ``sparse`` keyword. If set to ``True``, the return ``DataFrame`` is sparse, e.g. ``SparseDataFrame``. (:issue:`8823`)
-- ``Period`` now accepts ``datetime64`` as value input. (:issue:`9054`)
-
-- Allow timedelta string conversion when leading zero is missing from time definition, ie `0:00:00` vs `00:00:00`. (:issue:`9570`)
-- Allow ``Panel.shift`` with ``axis='items'`` (:issue:`9890`)
-
-- Trying to write an excel file now raises ``NotImplementedError`` if the ``DataFrame`` has a ``MultiIndex`` instead of writing a broken Excel file. (:issue:`9794`)
-- Allow ``Categorical.add_categories`` to accept ``Series`` or ``np.array``. (:issue:`9927`)
-
-- Add/delete ``str/dt/cat`` accessors dynamically from ``__dir__``. (:issue:`9910`)
-- Add ``normalize`` as a ``dt`` accessor method. (:issue:`10047`)
-
-- ``DataFrame`` and ``Series`` now have ``_constructor_expanddim`` property as overridable constructor for one higher dimensionality data. This should be used only when it is really needed, see :ref:`here <ref-subclassing-pandas>`
-
-- ``pd.lib.infer_dtype`` now returns ``'bytes'`` in Python 3 where appropriate. (:issue:`10032`)
-
.. _whatsnew_0161.enhancements.categoricalindex:
CategoricalIndex
@@ -188,16 +150,6 @@ String Methods Enhancements
:ref:`Continuing from v0.16.0 <whatsnew_0160.enhancements.string>`, the following
enhancements make string operations easier and more consistent with standard python string operations.
-- The following new methods are accesible via ``.str`` accessor to apply the function to each values. (:issue:`9766`, :issue:`9773`, :issue:`10031`, :issue:`10045`, :issue:`10052`)
-
- ================ =============== =============== =============== ================
- .. .. Methods .. ..
- ================ =============== =============== =============== ================
- ``capitalize()`` ``swapcase()`` ``normalize()`` ``partition()`` ``rpartition()``
- ``index()`` ``rindex()`` ``translate()``
- ================ =============== =============== =============== ================
-
-
- Added ``StringMethods`` (``.str`` accessor) to ``Index`` (:issue:`9068`)
@@ -220,6 +172,14 @@ enhancements make string operations easier and more consistent with standard pyt
idx.str.startswith('a')
s[s.index.str.startswith('a')]
+- The following new methods are accesible via ``.str`` accessor to apply the function to each values. (:issue:`9766`, :issue:`9773`, :issue:`10031`, :issue:`10045`, :issue:`10052`)
+
+ ================ =============== =============== =============== ================
+ .. .. Methods .. ..
+ ================ =============== =============== =============== ================
+ ``capitalize()`` ``swapcase()`` ``normalize()`` ``partition()`` ``rpartition()``
+ ``index()`` ``rindex()`` ``translate()``
+ ================ =============== =============== =============== ================
- ``split`` now takes ``expand`` keyword to specify whether to expand dimensionality. ``return_type`` is deprecated. (:issue:`9847`)
@@ -244,14 +204,59 @@ enhancements make string operations easier and more consistent with standard pyt
- Improved ``extract`` and ``get_dummies`` methods for ``Index.str`` (:issue:`9980`)
-.. _whatsnew_0161.api:
-API changes
-~~~~~~~~~~~
+.. _whatsnew_0161.enhancements.other:
+
+Other Enhancements
+^^^^^^^^^^^^^^^^^^
+
+- ``BusinessHour`` offset is now supported, which represents business hours starting from 09:00 - 17:00 on ``BusinessDay`` by default. See :ref:`Here <timeseries.businesshour>` for details. (:issue:`7905`)
+
+ .. ipython:: python
+ from pandas.tseries.offsets import BusinessHour
+ Timestamp('2014-08-01 09:00') + BusinessHour()
+ Timestamp('2014-08-01 07:00') + BusinessHour()
+ Timestamp('2014-08-01 16:30') + BusinessHour()
+- ``DataFrame.diff`` now takes an ``axis`` parameter that determines the direction of differencing (:issue:`9727`)
+- Allow ``clip``, ``clip_lower``, and ``clip_upper`` to accept array-like arguments as thresholds (This is a regression from 0.11.0). These methods now have an ``axis`` parameter which determines how the Series or DataFrame will be aligned with the threshold(s). (:issue:`6966`)
+
+- ``DataFrame.mask()`` and ``Series.mask()`` now support same keywords as ``where`` (:issue:`8801`)
+- ``drop`` function can now accept ``errors`` keyword to suppress ``ValueError`` raised when any of label does not exist in the target data. (:issue:`6736`)
+
+ .. ipython:: python
+
+ df = DataFrame(np.random.randn(3, 3), columns=['A', 'B', 'C'])
+ df.drop(['A', 'X'], axis=1, errors='ignore')
+
+- Add support for separating years and quarters using dashes, for
+ example 2014-Q1. (:issue:`9688`)
+
+- Allow conversion of values with dtype ``datetime64`` or ``timedelta64`` to strings using ``astype(str)`` (:issue:`9757`)
+- ``get_dummies`` function now accepts ``sparse`` keyword. If set to ``True``, the return ``DataFrame`` is sparse, e.g. ``SparseDataFrame``. (:issue:`8823`)
+- ``Period`` now accepts ``datetime64`` as value input. (:issue:`9054`)
+
+- Allow timedelta string conversion when leading zero is missing from time definition, ie `0:00:00` vs `00:00:00`. (:issue:`9570`)
+- Allow ``Panel.shift`` with ``axis='items'`` (:issue:`9890`)
+
+- Trying to write an excel file now raises ``NotImplementedError`` if the ``DataFrame`` has a ``MultiIndex`` instead of writing a broken Excel file. (:issue:`9794`)
+- Allow ``Categorical.add_categories`` to accept ``Series`` or ``np.array``. (:issue:`9927`)
+
+- Add/delete ``str/dt/cat`` accessors dynamically from ``__dir__``. (:issue:`9910`)
+- Add ``normalize`` as a ``dt`` accessor method. (:issue:`10047`)
+
+- ``DataFrame`` and ``Series`` now have ``_constructor_expanddim`` property as overridable constructor for one higher dimensionality data. This should be used only when it is really needed, see :ref:`here <ref-subclassing-pandas>`
+
+- ``pd.lib.infer_dtype`` now returns ``'bytes'`` in Python 3 where appropriate. (:issue:`10032`)
+
+
+.. _whatsnew_0161.api:
+
+API changes
+~~~~~~~~~~~
- When passing in an ax to ``df.plot( ..., ax=ax)``, the `sharex` kwarg will now default to `False`.
The result is that the visibility of xlabels and xticklabels will not anymore be changed. You
@@ -260,16 +265,19 @@ API changes
If pandas creates the subplots itself (e.g. no passed in `ax` kwarg), then the
default is still ``sharex=True`` and the visibility changes are applied.
-
-
-- Add support for separating years and quarters using dashes, for
- example 2014-Q1. (:issue:`9688`)
-
- :meth:`~pandas.DataFrame.assign` now inserts new columns in alphabetical order. Previously
the order was arbitrary. (:issue:`9777`)
- By default, ``read_csv`` and ``read_table`` will now try to infer the compression type based on the file extension. Set ``compression=None`` to restore the previous behavior (no decompression). (:issue:`9770`)
+.. _whatsnew_0161.deprecations:
+
+Deprecations
+^^^^^^^^^^^^
+
+- ``Series.str.split``'s ``return_type`` keyword was removed in favor of ``expand`` (:issue:`9847`)
+
+
.. _whatsnew_0161.index_repr:
Index Representation
@@ -303,25 +311,17 @@ New Behavior
.. ipython:: python
- pd.set_option('display.width',100)
- pd.Index(range(4),name='foo')
- pd.Index(range(25),name='foo')
- pd.Index(range(104),name='foo')
- pd.Index(['datetime', 'sA', 'sB', 'sC', 'flow', 'error', 'temp', 'ref', 'a_bit_a_longer_one']*2)
- pd.CategoricalIndex(['a','bb','ccc','dddd'],ordered=True,name='foobar')
- pd.CategoricalIndex(['a','bb','ccc','dddd']*10,ordered=True,name='foobar')
- pd.CategoricalIndex(['a','bb','ccc','dddd']*100,ordered=True,name='foobar')
- pd.CategoricalIndex(np.arange(1000),ordered=True,name='foobar')
- pd.date_range('20130101',periods=4,name='foo',tz='US/Eastern')
- pd.date_range('20130101',periods=25,name='foo',tz='US/Eastern')
- pd.date_range('20130101',periods=104,name='foo',tz='US/Eastern')
-
-.. _whatsnew_0161.deprecations:
+ pd.set_option('display.width', 80)
+ pd.Index(range(4), name='foo')
+ pd.Index(range(30), name='foo')
+ pd.Index(range(104), name='foo')
+ pd.CategoricalIndex(['a','bb','ccc','dddd'], ordered=True, name='foobar')
+ pd.CategoricalIndex(['a','bb','ccc','dddd']*10, ordered=True, name='foobar')
+ pd.CategoricalIndex(['a','bb','ccc','dddd']*100, ordered=True, name='foobar')
+ pd.date_range('20130101',periods=4, name='foo', tz='US/Eastern')
+ pd.date_range('20130101',periods=25, freq='D')
+ pd.date_range('20130101',periods=104, name='foo', tz='US/Eastern')
-Deprecations
-^^^^^^^^^^^^
-
-- ``Series.str.split``'s ``return_type`` keyword was removed in favor of ``expand`` (:issue:`9847`)
.. _whatsnew_0161.performance:
@@ -333,7 +333,6 @@ Performance Improvements
- Improved the performance of ``pd.lib.max_len_string_array`` by 5-7x (:issue:`10024`)
-
.. _whatsnew_0161.bug_fixes:
Bug Fixes
@@ -361,7 +360,6 @@ Bug Fixes
- Bug where repeated plotting of ``DataFrame`` with a ``DatetimeIndex`` may raise ``TypeError`` (:issue:`9852`)
- Bug in ``setup.py`` that would allow an incompat cython version to build (:issue:`9827`)
- Bug in plotting ``secondary_y`` incorrectly attaches ``right_ax`` property to secondary axes specifying itself recursively. (:issue:`9861`)
-
- Bug in ``Series.quantile`` on empty Series of type ``Datetime`` or ``Timedelta`` (:issue:`9675`)
- Bug in ``where`` causing incorrect results when upcasting was required (:issue:`9731`)
- Bug in ``FloatArrayFormatter`` where decision boundary for displaying "small" floats in decimal format is off by one order of magnitude for a given display.precision (:issue:`9764`)
@@ -372,20 +370,13 @@ Bug Fixes
- Bug in index equality comparisons using ``==`` failing on Index/MultiIndex type incompatibility (:issue:`9785`)
- Bug in which ``SparseDataFrame`` could not take `nan` as a column name (:issue:`8822`)
- Bug in ``to_msgpack`` and ``read_msgpack`` zlib and blosc compression support (:issue:`9783`)
-
- Bug ``GroupBy.size`` doesn't attach index name properly if grouped by ``TimeGrouper`` (:issue:`9925`)
- Bug causing an exception in slice assignments because ``length_of_indexer`` returns wrong results (:issue:`9995`)
- Bug in csv parser causing lines with initial whitespace plus one non-space character to be skipped. (:issue:`9710`)
- Bug in C csv parser causing spurious NaNs when data started with newline followed by whitespace. (:issue:`10022`)
-
- Bug causing elements with a null group to spill into the final group when grouping by a ``Categorical`` (:issue:`9603`)
- Bug where .iloc and .loc behavior is not consistent on empty dataframes (:issue:`9964`)
-
- Bug in invalid attribute access on a ``TimedeltaIndex`` incorrectly raised ``ValueError`` instead of ``AttributeError`` (:issue:`9680`)
-
-
-
-
- Bug in unequal comparisons between categorical data and a scalar, which was not in the categories (e.g. ``Series(Categorical(list("abc"), ordered=True)) > "d"``. This returned ``False`` for all elements, but now raises a ``TypeError``. Equality comparisons also now return ``False`` for ``==`` and ``True`` for ``!=``. (:issue:`9848`)
- Bug in DataFrame ``__setitem__`` when right hand side is a dictionary (:issue:`9874`)
- Bug in ``where`` when dtype is ``datetime64/timedelta64``, but dtype of other is not (:issue:`9804`)
@@ -394,25 +385,13 @@ Bug Fixes
- Bug in ``DataFrame`` constructor when ``columns`` parameter is set, and ``data`` is an empty list (:issue:`9939`)
- Bug in bar plot with ``log=True`` raises ``TypeError`` if all values are less than 1 (:issue:`9905`)
- Bug in horizontal bar plot ignores ``log=True`` (:issue:`9905`)
-
-
-
- Bug in PyTables queries that did not return proper results using the index (:issue:`8265`, :issue:`9676`)
-
-
-
-
- Bug where dividing a dataframe containing values of type ``Decimal`` by another ``Decimal`` would raise. (:issue:`9787`)
- Bug where using DataFrames asfreq would remove the name of the index. (:issue:`9885`)
- Bug causing extra index point when resample BM/BQ (:issue:`9756`)
- Changed caching in ``AbstractHolidayCalendar`` to be at the instance level rather than at the class level as the latter can result in unexpected behaviour. (:issue:`9552`)
-
- Fixed latex output for multi-indexed dataframes (:issue:`9778`)
- Bug causing an exception when setting an empty range using ``DataFrame.loc`` (:issue:`9596`)
-
-
-
-
- Bug in hiding ticklabels with subplots and shared axes when adding a new plot to an existing grid of axes (:issue:`9158`)
- Bug in ``transform`` and ``filter`` when grouping on a categorical variable (:issue:`9921`)
- Bug in ``transform`` when groups are equal in number and dtype to the input index (:issue:`9700`)
diff --git a/pandas/core/strings.py b/pandas/core/strings.py
index 8da43c18b989f..f4ac0166cf44b 100644
--- a/pandas/core/strings.py
+++ b/pandas/core/strings.py
@@ -813,7 +813,7 @@ def str_strip(arr, to_strip=None, side='both'):
def str_wrap(arr, width, **kwargs):
- """
+ r"""
Wrap long strings in the Series/Index to be formatted in
paragraphs with length less than a given width.
| https://api.github.com/repos/pandas-dev/pandas/pulls/10101 | 2015-05-11T09:46:21Z | 2015-05-14T14:52:38Z | 2015-05-14T14:52:38Z | 2015-06-02T19:26:11Z | |
BUG: invalid column names in a HDF5 table format #9057 | diff --git a/doc/source/whatsnew/v0.16.2.txt b/doc/source/whatsnew/v0.16.2.txt
index 627c79f7289b7..25c7e97923082 100644
--- a/doc/source/whatsnew/v0.16.2.txt
+++ b/doc/source/whatsnew/v0.16.2.txt
@@ -92,6 +92,6 @@ Bug Fixes
- Bug in ``SparseSeries`` constructor ignores input data name (:issue:`10258`)
- Bug where infer_freq infers timerule (WOM-5XXX) unsupported by to_offset (:issue:`9425`)
-
+- Bug in ``DataFrame.to_hdf()`` where table format would raise a seemingly unrelated error for invalid (non-string) column names. This is now explicitly forbidden. (:issue:`9057`)
- Bug to handle masking empty ``DataFrame``(:issue:`10126`)
- Bug where MySQL interface could not handle numeric table/column names (:issue:`10255`)
diff --git a/pandas/io/pytables.py b/pandas/io/pytables.py
index 4cbc7aeaa3df7..8948592358636 100644
--- a/pandas/io/pytables.py
+++ b/pandas/io/pytables.py
@@ -257,6 +257,7 @@ def _tables():
def to_hdf(path_or_buf, key, value, mode=None, complevel=None, complib=None,
append=None, **kwargs):
""" store this object, close it if we opened it """
+
if append:
f = lambda store: store.append(key, value, **kwargs)
else:
@@ -1535,6 +1536,12 @@ def maybe_set_size(self, min_itemsize=None, **kwargs):
self.typ = _tables(
).StringCol(itemsize=min_itemsize, pos=self.pos)
+ def validate(self, handler, append, **kwargs):
+ self.validate_names()
+
+ def validate_names(self):
+ pass
+
def validate_and_set(self, handler, append, **kwargs):
self.set_table(handler.table)
self.validate_col()
@@ -2080,6 +2087,10 @@ class DataIndexableCol(DataCol):
""" represent a data column that can be indexed """
is_data_indexable = True
+ def validate_names(self):
+ if not Index(self.values).is_object():
+ raise ValueError("cannot have non-object label DataIndexableCol")
+
def get_atom_string(self, block, itemsize):
return _tables().StringCol(itemsize=itemsize)
@@ -3756,6 +3767,9 @@ def write(self, obj, axes=None, append=False, complib=None,
min_itemsize=min_itemsize,
**kwargs)
+ for a in self.axes:
+ a.validate(self, append)
+
if not self.is_exists:
# create the table
diff --git a/pandas/io/tests/test_pytables.py b/pandas/io/tests/test_pytables.py
index 7d9c3c051344f..f671e61e90084 100644
--- a/pandas/io/tests/test_pytables.py
+++ b/pandas/io/tests/test_pytables.py
@@ -4640,6 +4640,35 @@ def test_colums_multiindex_modified(self):
df_loaded = read_hdf(path, 'df', columns=cols2load)
self.assertTrue(cols2load_original == cols2load)
+ def test_to_hdf_with_object_column_names(self):
+ # GH9057
+ # Writing HDF5 table format should only work for string-like
+ # column types
+
+ types_should_fail = [ tm.makeIntIndex, tm.makeFloatIndex,
+ tm.makeDateIndex, tm.makeTimedeltaIndex,
+ tm.makePeriodIndex ]
+ types_should_run = [ tm.makeStringIndex, tm.makeCategoricalIndex ]
+
+ if compat.PY3:
+ types_should_run.append(tm.makeUnicodeIndex)
+ else:
+ types_should_fail.append(tm.makeUnicodeIndex)
+
+ for index in types_should_fail:
+ df = DataFrame(np.random.randn(10, 2), columns=index(2))
+ with ensure_clean_path(self.path) as path:
+ with self.assertRaises(ValueError,
+ msg="cannot have non-object label DataIndexableCol"):
+ df.to_hdf(path, 'df', format='table', data_columns=True)
+
+ for index in types_should_run:
+ df = DataFrame(np.random.randn(10, 2), columns=index(2))
+ with ensure_clean_path(self.path) as path:
+ df.to_hdf(path, 'df', format='table', data_columns=True)
+ result = pd.read_hdf(path, 'df', where="index = [{0}]".format(df.index[0]))
+ assert(len(result))
+
def _test_sort(obj):
if isinstance(obj, DataFrame):
| Have DataFrame.to_hdf() raise an error when using pytables with non-string
column types
closes #9057
| https://api.github.com/repos/pandas-dev/pandas/pulls/10098 | 2015-05-11T05:08:57Z | 2015-06-07T22:28:38Z | 2015-06-07T22:28:37Z | 2015-06-07T22:28:40Z |
Default values for dropna to "False" (issue 9382) | diff --git a/.gitignore b/.gitignore
index 6b00558fb3b19..4dd19a4946e26 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,6 +17,7 @@
.idea
.vagrant
.noseids
+.ipynb_checkpoints
# Compiled source #
###################
diff --git a/doc/source/io.rst b/doc/source/io.rst
index 65f887288cc6d..6d30e864c4f1c 100644
--- a/doc/source/io.rst
+++ b/doc/source/io.rst
@@ -2410,6 +2410,10 @@ for some advanced strategies
There is a ``PyTables`` indexing bug which may appear when querying stores using an index. If you see a subset of results being returned, upgrade to ``PyTables`` >= 3.2. Stores created previously will need to be rewritten using the updated version.
+.. warning::
+
+ As of version 0.17.0, ``HDFStore`` will not drop rows that have all missing values by default. Previously, if all values (except the index) were missing, ``HDFStore`` would not write those rows to disk.
+
.. ipython:: python
:suppress:
:okexcept:
@@ -2486,6 +2490,8 @@ Closing a Store, Context Manager
import os
os.remove('store.h5')
+
+
Read/Write API
~~~~~~~~~~~~~~
@@ -2504,6 +2510,65 @@ similar to how ``read_csv`` and ``to_csv`` work. (new in 0.11.0)
os.remove('store_tl.h5')
+
+As of version 0.17.0, HDFStore will no longer drop rows that are all missing by default. This behavior can be enabled by setting ``dropna=True``.
+
+.. ipython:: python
+ :suppress:
+
+ import os
+
+.. ipython:: python
+
+ df_with_missing = pd.DataFrame({'col1':[0, np.nan, 2],
+ 'col2':[1, np.nan, np.nan]})
+ df_with_missing
+
+ df_with_missing.to_hdf('file.h5', 'df_with_missing',
+ format = 'table', mode='w')
+
+ pd.read_hdf('file.h5', 'df_with_missing')
+
+ df_with_missing.to_hdf('file.h5', 'df_with_missing',
+ format = 'table', mode='w', dropna=True)
+ pd.read_hdf('file.h5', 'df_with_missing')
+
+
+.. ipython:: python
+ :suppress:
+
+ os.remove('file.h5')
+
+This is also true for the major axis of a ``Panel``:
+
+.. ipython:: python
+
+ matrix = [[[np.nan, np.nan, np.nan],[1,np.nan,np.nan]],
+ [[np.nan, np.nan, np.nan], [np.nan,5,6]],
+ [[np.nan, np.nan, np.nan],[np.nan,3,np.nan]]]
+
+ panel_with_major_axis_all_missing = Panel(matrix,
+ items=['Item1', 'Item2','Item3'],
+ major_axis=[1,2],
+ minor_axis=['A', 'B', 'C'])
+
+ panel_with_major_axis_all_missing
+
+ panel_with_major_axis_all_missing.to_hdf('file.h5', 'panel',
+ dropna = True,
+ format='table',
+ mode='w')
+ reloaded = read_hdf('file.h5', 'panel')
+ reloaded
+
+
+.. ipython:: python
+ :suppress:
+
+ os.remove('file.h5')
+
+
+
.. _io.hdf5-fixed:
Fixed Format
diff --git a/doc/source/whatsnew/v0.17.0.txt b/doc/source/whatsnew/v0.17.0.txt
index 83e5ec5b1d107..80c9d16b1dcf7 100644
--- a/doc/source/whatsnew/v0.17.0.txt
+++ b/doc/source/whatsnew/v0.17.0.txt
@@ -295,6 +295,9 @@ Usually you simply want to know which values are null.
None == None
np.nan == np.nan
+
+.. _whatsnew_0170.api_breaking.other:
+
Other API Changes
^^^^^^^^^^^^^^^^^
@@ -330,6 +333,52 @@ Other API Changes
``raise ValueError`` All other public methods (names not beginning with underscores)
=============================== ===============================================================
+
+- default behavior for HDFStore write functions with ``format='table'`` is now to keep rows that are all missing except for index. Previously, the behavior was to drop rows that were all missing save the index. The previous behavior can be replicated using the ``dropna=True`` option. (:issue:`9382`)
+
+Previously,
+
+.. ipython:: python
+
+ df_with_missing = pd.DataFrame({'col1':[0, np.nan, 2],
+ 'col2':[1, np.nan, np.nan]})
+
+ df_with_missing
+
+
+.. code-block:: python
+
+ In [28]:
+ df_with_missing.to_hdf('file.h5', 'df_with_missing', format='table', mode='w')
+
+ pd.read_hdf('file.h5', 'df_with_missing')
+
+ Out [28]:
+ col1 col2
+ 0 0 1
+ 2 2 NaN
+
+
+New behavior:
+
+.. ipython:: python
+ :suppress:
+
+ import os
+
+.. ipython:: python
+
+ df_with_missing.to_hdf('file.h5', 'df_with_missing', format = 'table', mode='w')
+
+ pd.read_hdf('file.h5', 'df_with_missing')
+
+.. ipython:: python
+ :suppress:
+
+ os.remove('file.h5')
+
+See :ref:`documentation <io.hdf5>` for more details.
+
.. _whatsnew_0170.deprecations:
Deprecations
diff --git a/pandas/core/generic.py b/pandas/core/generic.py
index 292871000cafb..0d4b83d15ad3b 100644
--- a/pandas/core/generic.py
+++ b/pandas/core/generic.py
@@ -922,6 +922,8 @@ def to_hdf(self, path_or_buf, key, **kwargs):
in the store wherever possible
fletcher32 : bool, default False
If applying compression use the fletcher32 checksum
+ dropna : boolean, default False.
+ If true, ALL nan rows will not be written to store.
"""
diff --git a/pandas/io/pytables.py b/pandas/io/pytables.py
index 9e1a272ec5621..2c9ffe6b74536 100644
--- a/pandas/io/pytables.py
+++ b/pandas/io/pytables.py
@@ -220,7 +220,7 @@ class DuplicateWarning(Warning):
"""
with config.config_prefix('io.hdf'):
- config.register_option('dropna_table', True, dropna_doc,
+ config.register_option('dropna_table', False, dropna_doc,
validator=config.is_bool)
config.register_option(
'default_format', None, format_doc,
@@ -817,7 +817,7 @@ def put(self, key, value, format=None, append=False, **kwargs):
This will force Table format, append the input data to the
existing.
encoding : default None, provide an encoding for strings
- dropna : boolean, default True, do not write an ALL nan row to
+ dropna : boolean, default False, do not write an ALL nan row to
the store settable by the option 'io.hdf.dropna_table'
"""
if format is None:
@@ -899,7 +899,7 @@ def append(self, key, value, format=None, append=True, columns=None,
chunksize : size to chunk the writing
expectedrows : expected TOTAL row size of this table
encoding : default None, provide an encoding for strings
- dropna : boolean, default True, do not write an ALL nan row to
+ dropna : boolean, default False, do not write an ALL nan row to
the store settable by the option 'io.hdf.dropna_table'
Notes
-----
@@ -919,7 +919,7 @@ def append(self, key, value, format=None, append=True, columns=None,
**kwargs)
def append_to_multiple(self, d, value, selector, data_columns=None,
- axes=None, dropna=True, **kwargs):
+ axes=None, dropna=False, **kwargs):
"""
Append to multiple tables
@@ -934,7 +934,7 @@ def append_to_multiple(self, d, value, selector, data_columns=None,
data_columns : list of columns to create as data columns, or True to
use all columns
dropna : if evaluates to True, drop rows from all tables if any single
- row in each table has all NaN
+ row in each table has all NaN. Default False.
Notes
-----
@@ -3787,7 +3787,7 @@ class AppendableTable(LegacyTable):
def write(self, obj, axes=None, append=False, complib=None,
complevel=None, fletcher32=None, min_itemsize=None,
- chunksize=None, expectedrows=None, dropna=True, **kwargs):
+ chunksize=None, expectedrows=None, dropna=False, **kwargs):
if not append and self.is_exists:
self._handle.remove_node(self.group, 'table')
@@ -3827,7 +3827,7 @@ def write(self, obj, axes=None, append=False, complib=None,
# add the rows
self.write_data(chunksize, dropna=dropna)
- def write_data(self, chunksize, dropna=True):
+ def write_data(self, chunksize, dropna=False):
""" we form the data into a 2-d including indexes,values,mask
write chunk-by-chunk """
diff --git a/pandas/io/tests/test_pytables.py b/pandas/io/tests/test_pytables.py
index ea30fb14251f4..210852d83094f 100644
--- a/pandas/io/tests/test_pytables.py
+++ b/pandas/io/tests/test_pytables.py
@@ -1040,6 +1040,28 @@ def test_append_all_nans(self):
store.append('df2', df[10:], dropna=False)
tm.assert_frame_equal(store['df2'], df)
+ # Test to make sure defaults are to not drop.
+ # Corresponding to Issue 9382
+ df_with_missing = DataFrame({'col1':[0, np.nan, 2], 'col2':[1, np.nan, np.nan]})
+
+ with ensure_clean_path(self.path) as path:
+ df_with_missing.to_hdf(path, 'df_with_missing', format = 'table')
+ reloaded = read_hdf(path, 'df_with_missing')
+ tm.assert_frame_equal(df_with_missing, reloaded)
+
+ matrix = [[[np.nan, np.nan, np.nan],[1,np.nan,np.nan]],
+ [[np.nan, np.nan, np.nan], [np.nan,5,6]],
+ [[np.nan, np.nan, np.nan],[np.nan,3,np.nan]]]
+
+ panel_with_missing = Panel(matrix, items=['Item1', 'Item2','Item3'],
+ major_axis=[1,2],
+ minor_axis=['A', 'B', 'C'])
+
+ with ensure_clean_path(self.path) as path:
+ panel_with_missing.to_hdf(path, 'panel_with_missing', format='table')
+ reloaded_panel = read_hdf(path, 'panel_with_missing')
+ tm.assert_panel_equal(panel_with_missing, reloaded_panel)
+
def test_append_frame_column_oriented(self):
with ensure_clean_store(self.path) as store:
@@ -4885,7 +4907,6 @@ def test_complex_append(self):
result = store.select('df')
assert_frame_equal(pd.concat([df, df], 0), result)
-
def _test_sort(obj):
if isinstance(obj, DataFrame):
return obj.reindex(sorted(obj.index))
| As per discussion in Issue 9382, changes all HDF functions from having default of dropping all rows with NA in all non-index rows.
closes #9382
Followup for #9484
| https://api.github.com/repos/pandas-dev/pandas/pulls/10097 | 2015-05-09T22:52:55Z | 2015-07-31T22:37:48Z | 2015-07-31T22:37:48Z | 2015-07-31T22:37:53Z |
BUG: Timestamp properties may return np.int | diff --git a/doc/source/whatsnew/v0.17.0.txt b/doc/source/whatsnew/v0.17.0.txt
index 9bf478831ea01..8a74d90b41b7b 100644
--- a/doc/source/whatsnew/v0.17.0.txt
+++ b/doc/source/whatsnew/v0.17.0.txt
@@ -59,3 +59,10 @@ Bug Fixes
~~~~~~~~~
- Bug in ``Categorical`` repr with ``display.width`` of ``None`` in Python 3 (:issue:`10087`)
+
+
+- Bug in ``Timestamp``'s' ``microsecond``, ``quarter``, ``dayofyear``, ``week`` and ``daysinmonth`` properties return ``np.int`` type, not built-in ``int``. (:issue:`10050`)
+- Bug in ``NaT`` raises ``AttributeError`` when accessing to ``daysinmonth``, ``dayofweek`` properties. (:issue:`10096`)
+
+
+
diff --git a/pandas/tseries/tests/test_timedeltas.py b/pandas/tseries/tests/test_timedeltas.py
index 45145eb7ab7e8..ae868af60ae63 100644
--- a/pandas/tseries/tests/test_timedeltas.py
+++ b/pandas/tseries/tests/test_timedeltas.py
@@ -311,49 +311,64 @@ def test_fields(self):
# compat to datetime.timedelta
rng = to_timedelta('1 days, 10:11:12')
- self.assertEqual(rng.days,1)
- self.assertEqual(rng.seconds,10*3600+11*60+12)
- self.assertEqual(rng.microseconds,0)
- self.assertEqual(rng.nanoseconds,0)
+ self.assertEqual(rng.days, 1)
+ self.assertEqual(rng.seconds, 10*3600+11*60+12)
+ self.assertEqual(rng.microseconds, 0)
+ self.assertEqual(rng.nanoseconds, 0)
self.assertRaises(AttributeError, lambda : rng.hours)
self.assertRaises(AttributeError, lambda : rng.minutes)
self.assertRaises(AttributeError, lambda : rng.milliseconds)
+ # GH 10050
+ self.assertTrue(isinstance(rng.days, int))
+ self.assertTrue(isinstance(rng.seconds, int))
+ self.assertTrue(isinstance(rng.microseconds, int))
+ self.assertTrue(isinstance(rng.nanoseconds, int))
+
td = Timedelta('-1 days, 10:11:12')
- self.assertEqual(abs(td),Timedelta('13:48:48'))
+ self.assertEqual(abs(td), Timedelta('13:48:48'))
self.assertTrue(str(td) == "-1 days +10:11:12")
- self.assertEqual(-td,Timedelta('0 days 13:48:48'))
- self.assertEqual(-Timedelta('-1 days, 10:11:12').value,49728000000000)
- self.assertEqual(Timedelta('-1 days, 10:11:12').value,-49728000000000)
+ self.assertEqual(-td, Timedelta('0 days 13:48:48'))
+ self.assertEqual(-Timedelta('-1 days, 10:11:12').value, 49728000000000)
+ self.assertEqual(Timedelta('-1 days, 10:11:12').value, -49728000000000)
rng = to_timedelta('-1 days, 10:11:12.100123456')
- self.assertEqual(rng.days,-1)
- self.assertEqual(rng.seconds,10*3600+11*60+12)
- self.assertEqual(rng.microseconds,100*1000+123)
- self.assertEqual(rng.nanoseconds,456)
+ self.assertEqual(rng.days, -1)
+ self.assertEqual(rng.seconds, 10*3600+11*60+12)
+ self.assertEqual(rng.microseconds, 100*1000+123)
+ self.assertEqual(rng.nanoseconds, 456)
self.assertRaises(AttributeError, lambda : rng.hours)
self.assertRaises(AttributeError, lambda : rng.minutes)
self.assertRaises(AttributeError, lambda : rng.milliseconds)
# components
tup = pd.to_timedelta(-1, 'us').components
- self.assertEqual(tup.days,-1)
- self.assertEqual(tup.hours,23)
- self.assertEqual(tup.minutes,59)
- self.assertEqual(tup.seconds,59)
- self.assertEqual(tup.milliseconds,999)
- self.assertEqual(tup.microseconds,999)
- self.assertEqual(tup.nanoseconds,0)
+ self.assertEqual(tup.days, -1)
+ self.assertEqual(tup.hours, 23)
+ self.assertEqual(tup.minutes, 59)
+ self.assertEqual(tup.seconds, 59)
+ self.assertEqual(tup.milliseconds, 999)
+ self.assertEqual(tup.microseconds, 999)
+ self.assertEqual(tup.nanoseconds, 0)
+
+ # GH 10050
+ self.assertTrue(isinstance(tup.days, int))
+ self.assertTrue(isinstance(tup.hours, int))
+ self.assertTrue(isinstance(tup.minutes, int))
+ self.assertTrue(isinstance(tup.seconds, int))
+ self.assertTrue(isinstance(tup.milliseconds, int))
+ self.assertTrue(isinstance(tup.microseconds, int))
+ self.assertTrue(isinstance(tup.nanoseconds, int))
tup = Timedelta('-1 days 1 us').components
- self.assertEqual(tup.days,-2)
- self.assertEqual(tup.hours,23)
- self.assertEqual(tup.minutes,59)
- self.assertEqual(tup.seconds,59)
- self.assertEqual(tup.milliseconds,999)
- self.assertEqual(tup.microseconds,999)
- self.assertEqual(tup.nanoseconds,0)
+ self.assertEqual(tup.days, -2)
+ self.assertEqual(tup.hours, 23)
+ self.assertEqual(tup.minutes, 59)
+ self.assertEqual(tup.seconds, 59)
+ self.assertEqual(tup.milliseconds, 999)
+ self.assertEqual(tup.microseconds, 999)
+ self.assertEqual(tup.nanoseconds, 0)
def test_timedelta_range(self):
diff --git a/pandas/tseries/tests/test_tslib.py b/pandas/tseries/tests/test_tslib.py
index e452ddee9d8db..6b3dd63e6415b 100644
--- a/pandas/tseries/tests/test_tslib.py
+++ b/pandas/tseries/tests/test_tslib.py
@@ -369,6 +369,58 @@ def test_today(self):
self.assertTrue(abs(ts_from_string_tz.tz_localize(None)
- ts_from_method_tz.tz_localize(None)) < delta)
+ def test_fields(self):
+ # GH 10050
+ ts = Timestamp('2015-05-10 09:06:03.000100001')
+ self.assertEqual(ts.year, 2015)
+ self.assertTrue(isinstance(ts.year, int))
+ self.assertEqual(ts.month, 5)
+ self.assertTrue(isinstance(ts.month, int))
+ self.assertEqual(ts.day, 10)
+ self.assertTrue(isinstance(ts.day, int))
+ self.assertEqual(ts.hour, 9)
+ self.assertTrue(isinstance(ts.hour, int))
+ self.assertEqual(ts.minute, 6)
+ self.assertTrue(isinstance(ts.minute, int))
+ self.assertEqual(ts.second, 3)
+ self.assertTrue(isinstance(ts.second, int))
+ self.assertRaises(AttributeError, lambda : ts.millisecond)
+ self.assertEqual(ts.microsecond, 100)
+ self.assertTrue(isinstance(ts.microsecond, int))
+ self.assertEqual(ts.nanosecond, 1)
+ self.assertTrue(isinstance(ts.nanosecond, int))
+ self.assertEqual(ts.dayofweek, 6)
+ self.assertTrue(isinstance(ts.dayofweek, int))
+ self.assertEqual(ts.quarter, 2)
+ self.assertTrue(isinstance(ts.quarter, int))
+ self.assertEqual(ts.dayofyear, 130)
+ self.assertTrue(isinstance(ts.dayofyear, int))
+ self.assertEqual(ts.week, 19)
+ self.assertTrue(isinstance(ts.week, int))
+ self.assertEqual(ts.daysinmonth, 31)
+ self.assertTrue(isinstance(ts.days_in_month, int))
+ self.assertEqual(ts.daysinmonth, 31)
+ self.assertTrue(isinstance(ts.daysinmonth, int))
+
+ def test_nat_fields(self):
+ # GH 10050
+ ts = Timestamp('NaT')
+ self.assertTrue(np.isnan(ts.year))
+ self.assertTrue(np.isnan(ts.month))
+ self.assertTrue(np.isnan(ts.day))
+ self.assertTrue(np.isnan(ts.hour))
+ self.assertTrue(np.isnan(ts.minute))
+ self.assertTrue(np.isnan(ts.second))
+ self.assertTrue(np.isnan(ts.microsecond))
+ self.assertTrue(np.isnan(ts.nanosecond))
+ self.assertTrue(np.isnan(ts.dayofweek))
+ self.assertTrue(np.isnan(ts.quarter))
+ self.assertTrue(np.isnan(ts.dayofyear))
+ self.assertTrue(np.isnan(ts.week))
+ self.assertTrue(np.isnan(ts.daysinmonth))
+ self.assertTrue(np.isnan(ts.days_in_month))
+
+
class TestDatetimeParsingWrappers(tm.TestCase):
def test_does_not_convert_mixed_integer(self):
bad_date_strings = (
diff --git a/pandas/tslib.pyx b/pandas/tslib.pyx
index 40dbbd7584c7a..66f14bfb0346a 100644
--- a/pandas/tslib.pyx
+++ b/pandas/tslib.pyx
@@ -627,7 +627,7 @@ class NaTType(_NaT):
fields = ['year', 'quarter', 'month', 'day', 'hour',
'minute', 'second', 'millisecond', 'microsecond', 'nanosecond',
- 'week', 'dayofyear', 'days_in_month']
+ 'week', 'dayofyear', 'days_in_month', 'daysinmonth', 'dayofweek']
for field in fields:
prop = property(fget=lambda self: np.nan)
setattr(NaTType, field, prop)
@@ -952,7 +952,7 @@ cdef class _Timestamp(datetime):
cpdef _get_field(self, field):
out = get_date_field(np.array([self.value], dtype=np.int64), field)
- return out[0]
+ return int(out[0])
cpdef _get_start_end_field(self, field):
month_kw = self.freq.kwds.get('startingMonth', self.freq.kwds.get('month', 12)) if self.freq else 12
| Closes #10050.
Also added `daysinmonth` and `dayofweek` properties to `NaT` and perform tests.
| https://api.github.com/repos/pandas-dev/pandas/pulls/10096 | 2015-05-09T22:26:31Z | 2015-05-12T19:58:49Z | 2015-05-12T19:58:49Z | 2015-06-02T19:26:11Z |
BUG: Series.fillna() raises if given a numerically convertible string | diff --git a/doc/source/whatsnew/v0.16.1.txt b/doc/source/whatsnew/v0.16.1.txt
index 4ccaf7a4719c9..2efa19e79fff0 100755
--- a/doc/source/whatsnew/v0.16.1.txt
+++ b/doc/source/whatsnew/v0.16.1.txt
@@ -372,3 +372,4 @@ Bug Fixes
- Updated BigQuery connector to no longer use deprecated ``oauth2client.tools.run()`` (:issue:`8327`)
- Bug in subclassed ``DataFrame``. It may not return the correct class, when slicing or subsetting it. (:issue:`9632`)
- Bug in ``.median()`` where non-float null values are not handled correctly (:issue:`10040`)
+- Bug in Series.fillna() where it raises if a numerically convertible string is given (:issue:`10092`)
diff --git a/pandas/core/internals.py b/pandas/core/internals.py
index 564484a19e873..3395ea360165e 100644
--- a/pandas/core/internals.py
+++ b/pandas/core/internals.py
@@ -4017,7 +4017,8 @@ def _putmask_smart(v, m, n):
try:
nn = n[m]
nn_at = nn.astype(v.dtype)
- if (nn == nn_at).all():
+ comp = (nn == nn_at)
+ if is_list_like(comp) and comp.all():
nv = v.copy()
nv[m] = nn_at
return nv
diff --git a/pandas/tests/test_series.py b/pandas/tests/test_series.py
index f4880fdbb5de4..22f8aee1e0a4e 100644
--- a/pandas/tests/test_series.py
+++ b/pandas/tests/test_series.py
@@ -3654,6 +3654,16 @@ def test_fillna(self):
expected = Series([999,999,np.nan],index=[0,1,2])
assert_series_equal(result,expected)
+ # GH 9043
+ # make sure a string representation of int/float values can be filled
+ # correctly without raising errors or being converted
+ vals = ['0', '1.5', '-0.3']
+ for val in vals:
+ s = Series([0, 1, np.nan, np.nan, 4], dtype='float64')
+ result = s.fillna(val)
+ expected = Series([0, 1, val, val, 4], dtype='object')
+ assert_series_equal(result, expected)
+
def test_fillna_bug(self):
x = Series([nan, 1., nan, 3., nan], ['z', 'a', 'b', 'c', 'd'])
filled = x.fillna(method='ffill')
| First reported here but it's been dormant for a long time: https://github.com/pydata/pandas/pull/9043
I think it'd be good to patch this bug. @jreback please let me know which release this should go to and I can add a release note. Thanks.
| https://api.github.com/repos/pandas-dev/pandas/pulls/10092 | 2015-05-09T19:36:35Z | 2015-05-10T01:29:59Z | 2015-05-10T01:29:59Z | 2015-05-10T01:53:25Z |
fix the inconsistency between code and description | diff --git a/doc/source/merging.rst b/doc/source/merging.rst
index 8f2f4c9467ac2..d51c2f62b8a0c 100644
--- a/doc/source/merging.rst
+++ b/doc/source/merging.rst
@@ -490,7 +490,7 @@ standard database join operations between DataFrame objects:
::
- merge(left, right, how='left', on=None, left_on=None, right_on=None,
+ merge(left, right, how='inner', on=None, left_on=None, right_on=None,
left_index=False, right_index=False, sort=True,
suffixes=('_x', '_y'), copy=True)
| https://api.github.com/repos/pandas-dev/pandas/pulls/10091 | 2015-05-09T12:36:15Z | 2015-05-09T15:24:29Z | 2015-05-09T15:24:29Z | 2015-05-09T15:24:32Z | |
PERF: increase performance of str_split when returning a frame | diff --git a/doc/source/whatsnew/v0.16.2.txt b/doc/source/whatsnew/v0.16.2.txt
index 86332a26fd14c..49f143e158abf 100644
--- a/doc/source/whatsnew/v0.16.2.txt
+++ b/doc/source/whatsnew/v0.16.2.txt
@@ -47,6 +47,7 @@ Performance Improvements
~~~~~~~~~~~~~~~~~~~~~~~~
- Improved ``Series.resample`` performance with dtype=datetime64[ns] (:issue:`7754`)
+- Increase performance of ``str.split`` when ``expand=True`` (:issue:`10081`)
.. _whatsnew_0162.bug_fixes:
diff --git a/pandas/core/strings.py b/pandas/core/strings.py
index f4ac0166cf44b..78ae4fba02033 100644
--- a/pandas/core/strings.py
+++ b/pandas/core/strings.py
@@ -1,7 +1,7 @@
import numpy as np
from pandas.compat import zip
-from pandas.core.common import isnull, _values_from_object, is_bool_dtype
+from pandas.core.common import isnull, _values_from_object, is_bool_dtype, is_list_like
import pandas.compat as compat
from pandas.util.decorators import Appender, deprecate_kwarg
import re
@@ -1090,7 +1090,11 @@ def _wrap_result_expand(self, result, expand=False):
else:
index = self.series.index
if expand:
- cons_row = self.series._constructor
+ def cons_row(x):
+ if is_list_like(x):
+ return x
+ else:
+ return [ x ]
cons = self.series._constructor_expanddim
data = [cons_row(x) for x in result]
return cons(data, index=index)
diff --git a/vb_suite/strings.py b/vb_suite/strings.py
index 96791cd52f1cf..f229e0ddedbae 100644
--- a/vb_suite/strings.py
+++ b/vb_suite/strings.py
@@ -35,6 +35,7 @@ def make_series(letters, strlen, size):
strings_match = Benchmark("many.str.match(r'mat..this')", setup)
strings_extract = Benchmark("many.str.extract(r'(\w*)matchthis(\w*)')", setup)
strings_join_split = Benchmark("many.str.join(r'--').str.split('--')", setup)
+strings_join_split_expand = Benchmark("many.str.join(r'--').str.split('--',expand=True)", setup)
strings_len = Benchmark("many.str.len()", setup)
strings_findall = Benchmark("many.str.findall(r'[A-Z]+')", setup)
strings_pad = Benchmark("many.str.pad(100, side='both')", setup)
| Closes #10081.
This simply removes the unnecessary `Series()` in the creation of the DataFrame for the split values in `str_split`. It vastly improves performance (20ms vs 3s for a series of 20,000 strings as a test) while not changing current behavior.
| https://api.github.com/repos/pandas-dev/pandas/pulls/10090 | 2015-05-09T05:21:22Z | 2015-06-05T16:54:04Z | 2015-06-05T16:54:04Z | 2015-06-05T16:54:19Z |
Extended DataReader to fetch Dividends and Stock Splits from Yahoo!. | diff --git a/doc/source/remote_data.rst b/doc/source/remote_data.rst
index 1992288fd4d00..19bb420a76c16 100644
--- a/doc/source/remote_data.rst
+++ b/doc/source/remote_data.rst
@@ -61,6 +61,8 @@ It should be noted, that various sources support different kinds of data, so not
Yahoo! Finance
--------------
+Historical stock prices from Yahoo! Finance.
+
.. ipython:: python
import pandas.io.data as web
@@ -70,6 +72,18 @@ Yahoo! Finance
f = web.DataReader("F", 'yahoo', start, end)
f.ix['2010-01-04']
+Historical corporate actions (Dividends and Stock Splits) from Yahoo! Finance.
+
+.. ipython:: python
+
+ import pandas.io.data as web
+ import datetime
+
+ start = datetime.datetime(2010, 1, 1)
+ end = datetime.datetime(2015, 5, 9)
+
+ web.DataReader('AAPL', 'yahoo-actions', start, end)
+
.. _remote_data.yahoo_options:
Yahoo! Finance Options
diff --git a/pandas/io/data.py b/pandas/io/data.py
index 3e077bf526ab9..f6a6f54867d9e 100644
--- a/pandas/io/data.py
+++ b/pandas/io/data.py
@@ -7,6 +7,7 @@
import tempfile
import datetime as dt
import time
+import csv
from collections import defaultdict
@@ -45,7 +46,7 @@ def DataReader(name, data_source=None, start=None, end=None,
the name of the dataset. Some data sources (yahoo, google, fred) will
accept a list of names.
data_source: str
- the data source ("yahoo", "google", "fred", or "ff")
+ the data source ("yahoo", "yahoo-actions", "google", "fred", or "ff")
start : {datetime, None}
left boundary for range (defaults to 1/1/2010)
end : {datetime, None}
@@ -57,6 +58,9 @@ def DataReader(name, data_source=None, start=None, end=None,
# Data from Yahoo! Finance
gs = DataReader("GS", "yahoo")
+ # Corporate Actions (Dividend and Split Data) from Yahoo! Finance
+ gs = DataReader("GS", "yahoo-actions")
+
# Data from Google Finance
aapl = DataReader("AAPL", "google")
@@ -75,6 +79,9 @@ def DataReader(name, data_source=None, start=None, end=None,
return get_data_yahoo(symbols=name, start=start, end=end,
adjust_price=False, chunksize=25,
retry_count=retry_count, pause=pause)
+ elif data_source == "yahoo-actions":
+ return get_data_yahoo_actions(symbol=name, start=start, end=end,
+ retry_count=retry_count, pause=pause)
elif data_source == "google":
return get_data_google(symbols=name, start=start, end=end,
adjust_price=False, chunksize=25,
@@ -423,6 +430,80 @@ def get_data_yahoo(symbols=None, start=None, end=None, retry_count=3,
return _get_data_from(symbols, start, end, interval, retry_count, pause,
adjust_price, ret_index, chunksize, 'yahoo')
+_HISTORICAL_YAHOO_ACTIONS_URL = 'http://ichart.finance.yahoo.com/x?'
+
+def get_data_yahoo_actions(symbol, start=None, end=None, retry_count=3,
+ pause=0.001):
+ """
+ Returns DataFrame of historical corporate actions (dividends and stock
+ splits) from symbols, over date range, start to end.
+
+ Parameters
+ ----------
+ sym : string with a single Single stock symbol (ticker).
+ start : string, (defaults to '1/1/2010')
+ Starting date, timestamp. Parses many different kind of date
+ representations (e.g., 'JAN-01-2010', '1/1/10', 'Jan, 1, 1980')
+ end : string, (defaults to today)
+ Ending date, timestamp. Same format as starting date.
+ retry_count : int, default 3
+ Number of times to retry query request.
+ pause : int, default 0
+ Time, in seconds, of the pause between retries.
+ """
+
+ start, end = _sanitize_dates(start, end)
+ url = (_HISTORICAL_YAHOO_ACTIONS_URL + 's=%s' % symbol +
+ '&a=%s' % (start.month - 1) +
+ '&b=%s' % start.day +
+ '&c=%s' % start.year +
+ '&d=%s' % (end.month - 1) +
+ '&e=%s' % end.day +
+ '&f=%s' % end.year +
+ '&g=v')
+
+ for _ in range(retry_count):
+ time.sleep(pause)
+
+ try:
+ with urlopen(url) as resp:
+ lines = resp.read()
+ except _network_error_classes:
+ pass
+ else:
+ actions_index = []
+ actions_entries = []
+
+ for line in csv.reader(StringIO(bytes_to_str(lines))):
+ # Ignore lines that aren't dividends or splits (Yahoo
+ # add a bunch of irrelevant fields.)
+ if len(line) != 3 or line[0] not in ('DIVIDEND', 'SPLIT'):
+ continue
+
+ action, date, value = line
+ if action == 'DIVIDEND':
+ actions_index.append(to_datetime(date))
+ actions_entries.append({
+ 'action': action,
+ 'value': float(value)
+ })
+ elif action == 'SPLIT' and ':' in value:
+ # Convert the split ratio to a fraction. For example a
+ # 4:1 split expressed as a fraction is 1/4 = 0.25.
+ denominator, numerator = value.split(':', 1)
+ split_fraction = float(numerator) / float(denominator)
+
+ actions_index.append(to_datetime(date))
+ actions_entries.append({
+ 'action': action,
+ 'value': split_fraction
+ })
+
+ return DataFrame(actions_entries, index=actions_index)
+
+ raise IOError("after %d tries, Yahoo! did not "
+ "return a 200 for url %r" % (retry_count, url))
+
def get_data_google(symbols=None, start=None, end=None, retry_count=3,
pause=0.001, adjust_price=False, ret_index=False,
diff --git a/pandas/io/tests/test_data.py b/pandas/io/tests/test_data.py
index 63ed26ea7d931..eb8023f712994 100644
--- a/pandas/io/tests/test_data.py
+++ b/pandas/io/tests/test_data.py
@@ -283,6 +283,29 @@ def test_get_date_ret_index(self):
# sanity checking
self.assertTrue(np.issubdtype(pan.values.dtype, np.floating))
+ @network
+ def test_get_data_yahoo_actions(self):
+ start = datetime(1990, 1, 1)
+ end = datetime(2000, 4, 5)
+
+ actions = web.get_data_yahoo_actions('BHP.AX', start, end)
+
+ self.assertEqual(sum(actions['action'] == 'DIVIDEND'), 20)
+ self.assertEqual(sum(actions['action'] == 'SPLIT'), 1)
+
+ self.assertEqual(actions.ix['1995-05-11']['action'][0], 'SPLIT')
+ self.assertEqual(actions.ix['1995-05-11']['value'][0], 1/1.1)
+
+ self.assertEqual(actions.ix['1993-05-10']['action'][0], 'DIVIDEND')
+ self.assertEqual(actions.ix['1993-05-10']['value'][0], 0.3)
+
+ @network
+ def test_get_data_yahoo_actions_invalid_symbol(self):
+ start = datetime(1990, 1, 1)
+ end = datetime(2000, 4, 5)
+
+ self.assertRaises(IOError, web.get_data_yahoo_actions, 'UNKNOWN TICKER', start, end)
+
class TestYahooOptions(tm.TestCase):
@classmethod
| - Added yahoo-actions data_source to DataReader;
- Added get_data_yahoo_actions that returns a DataFrame containing
DIVIDEND and SPLIT corporate actions fetched from Yahoo! Finance;
- Added unit tests;
- Added documentation example.
| https://api.github.com/repos/pandas-dev/pandas/pulls/10088 | 2015-05-09T03:22:04Z | 2015-05-09T15:25:46Z | null | 2015-05-09T15:25:54Z |
DEPR: Deprecate str.split return_type | diff --git a/doc/source/whatsnew/v0.16.1.txt b/doc/source/whatsnew/v0.16.1.txt
index 08a2946279a98..848fa5a2d7629 100755
--- a/doc/source/whatsnew/v0.16.1.txt
+++ b/doc/source/whatsnew/v0.16.1.txt
@@ -221,6 +221,28 @@ enhancements are performed to make string operation easier.
idx.str.startswith('a')
s[s.index.str.startswith('a')]
+
+- ``split`` now takes ``expand`` keyword to specify whether to expand dimensionality. ``return_type`` is deprecated. (:issue:`9847`)
+
+ .. ipython:: python
+
+ s = Series(['a,b', 'a,c', 'b,c'])
+
+ # return Series
+ s.str.split(',')
+
+ # return DataFrame
+ s.str.split(',', expand=True)
+
+ idx = Index(['a,b', 'a,c', 'b,c'])
+
+ # return Index
+ idx.str.split(',')
+
+ # return MultiIndex
+ idx.str.split(',', expand=True)
+
+
- Improved ``extract`` and ``get_dummies`` methods for ``Index.str`` (:issue:`9980`)
.. _whatsnew_0161.api:
@@ -249,6 +271,13 @@ API changes
- By default, ``read_csv`` and ``read_table`` will now try to infer the compression type based on the file extension. Set ``compression=None`` to restore the previous behavior (no decompression). (:issue:`9770`)
+.. _whatsnew_0161.deprecations:
+
+Deprecations
+^^^^^^^^^^^^
+
+- ``Series.str.split``'s ``return_type`` keyword was removed in favor of ``expand`` (:issue:`9847`)
+
.. _whatsnew_0161.performance:
Performance Improvements
diff --git a/pandas/core/strings.py b/pandas/core/strings.py
index a25879e61b580..8da43c18b989f 100644
--- a/pandas/core/strings.py
+++ b/pandas/core/strings.py
@@ -3,7 +3,7 @@
from pandas.compat import zip
from pandas.core.common import isnull, _values_from_object, is_bool_dtype
import pandas.compat as compat
-from pandas.util.decorators import Appender
+from pandas.util.decorators import Appender, deprecate_kwarg
import re
import pandas.lib as lib
import warnings
@@ -696,7 +696,7 @@ def str_pad(arr, width, side='left', fillchar=' '):
return _na_map(f, arr)
-def str_split(arr, pat=None, n=None, return_type='series'):
+def str_split(arr, pat=None, n=None):
"""
Split each string (a la re.split) in the Series/Index by given
pattern, propagating NA values. Equivalent to :meth:`str.split`.
@@ -705,29 +705,17 @@ def str_split(arr, pat=None, n=None, return_type='series'):
----------
pat : string, default None
String or regular expression to split on. If None, splits on whitespace
- n : int, default None (all)
- return_type : {'series', 'index', 'frame'}, default 'series'
- If frame, returns a DataFrame (elements are strings)
- If series or index, returns the same type as the original object
- (elements are lists of strings).
-
- Notes
- -----
- Both 0 and -1 will be interpreted as return all splits
+ n : int, default -1 (all)
+ None, 0 and -1 will be interpreted as return all splits
+ expand : bool, default False
+ * If True, return DataFrame/MultiIndex expanding dimensionality.
+ * If False, return Series/Index.
+ return_type : deprecated, use `expand`
Returns
-------
- split : Series/Index of objects or DataFrame
+ split : Series/Index or DataFrame/MultiIndex of objects
"""
- from pandas.core.series import Series
- from pandas.core.frame import DataFrame
- from pandas.core.index import Index
-
- if return_type not in ('series', 'index', 'frame'):
- raise ValueError("return_type must be {'series', 'index', 'frame'}")
- if return_type == 'frame' and isinstance(arr, Index):
- raise ValueError("return_type='frame' is not supported for string "
- "methods on Index")
if pat is None:
if n is None or n == 0:
n = -1
@@ -742,10 +730,7 @@ def str_split(arr, pat=None, n=None, return_type='series'):
n = 0
regex = re.compile(pat)
f = lambda x: regex.split(x, maxsplit=n)
- if return_type == 'frame':
- res = DataFrame((Series(x) for x in _na_map(f, arr)), index=arr.index)
- else:
- res = _na_map(f, arr)
+ res = _na_map(f, arr)
return res
@@ -1083,7 +1068,10 @@ def _wrap_result(self, result, **kwargs):
return DataFrame(result, index=self.series.index)
def _wrap_result_expand(self, result, expand=False):
- from pandas.core.index import Index
+ if not isinstance(expand, bool):
+ raise ValueError("expand must be True or False")
+
+ from pandas.core.index import Index, MultiIndex
if not hasattr(result, 'ndim'):
return result
@@ -1096,7 +1084,9 @@ def _wrap_result_expand(self, result, expand=False):
if expand:
result = list(result)
- return Index(result, name=name)
+ return MultiIndex.from_tuples(result, names=name)
+ else:
+ return Index(result, name=name)
else:
index = self.series.index
if expand:
@@ -1114,10 +1104,12 @@ def cat(self, others=None, sep=None, na_rep=None):
result = str_cat(self.series, others=others, sep=sep, na_rep=na_rep)
return self._wrap_result(result)
+ @deprecate_kwarg('return_type', 'expand',
+ mapping={'series': False, 'frame': True})
@copy(str_split)
- def split(self, pat=None, n=-1, return_type='series'):
- result = str_split(self.series, pat, n=n, return_type=return_type)
- return self._wrap_result(result)
+ def split(self, pat=None, n=-1, expand=False):
+ result = str_split(self.series, pat, n=n)
+ return self._wrap_result_expand(result, expand=expand)
_shared_docs['str_partition'] = ("""
Split the string at the %(side)s occurrence of `sep`, and return 3 elements
@@ -1131,7 +1123,7 @@ def split(self, pat=None, n=-1, return_type='series'):
String to split on.
expand : bool, default True
* If True, return DataFrame/MultiIndex expanding dimensionality.
- * If False, return Series/Index
+ * If False, return Series/Index.
Returns
-------
diff --git a/pandas/tests/test_index.py b/pandas/tests/test_index.py
index 2ee9d405d9601..0c8c8be5217c3 100644
--- a/pandas/tests/test_index.py
+++ b/pandas/tests/test_index.py
@@ -1280,11 +1280,12 @@ def test_str_attribute(self):
idx = Index(['a b c', 'd e', 'f'])
expected = Index([['a', 'b', 'c'], ['d', 'e'], ['f']])
tm.assert_index_equal(idx.str.split(), expected)
- tm.assert_index_equal(idx.str.split(return_type='series'), expected)
- # return_type 'index' is an alias for 'series'
- tm.assert_index_equal(idx.str.split(return_type='index'), expected)
- with self.assertRaisesRegexp(ValueError, 'not supported'):
- idx.str.split(return_type='frame')
+ tm.assert_index_equal(idx.str.split(expand=False), expected)
+
+ expected = MultiIndex.from_tuples([('a', 'b', 'c'),
+ ('d', 'e', np.nan),
+ ('f', np.nan, np.nan)])
+ tm.assert_index_equal(idx.str.split(expand=True), expected)
# test boolean case, should return np.array instead of boolean Index
idx = Index(['a1', 'a2', 'b1', 'b2'])
diff --git a/pandas/tests/test_strings.py b/pandas/tests/test_strings.py
index 9011e6c64b097..b0d8d89d65cf2 100644
--- a/pandas/tests/test_strings.py
+++ b/pandas/tests/test_strings.py
@@ -1206,14 +1206,19 @@ def test_split(self):
result = values.str.split('__')
tm.assert_series_equal(result, exp)
+ result = values.str.split('__', expand=False)
+ tm.assert_series_equal(result, exp)
+
# mixed
mixed = Series(['a_b_c', NA, 'd_e_f', True, datetime.today(),
None, 1, 2.])
-
- rs = Series(mixed).str.split('_')
+ rs = mixed.str.split('_')
xp = Series([['a', 'b', 'c'], NA, ['d', 'e', 'f'], NA, NA,
NA, NA, NA])
+ tm.assert_isinstance(rs, Series)
+ tm.assert_almost_equal(rs, xp)
+ rs = mixed.str.split('_', expand=False)
tm.assert_isinstance(rs, Series)
tm.assert_almost_equal(rs, xp)
@@ -1226,6 +1231,9 @@ def test_split(self):
[u('f'), u('g'), u('h')]])
tm.assert_series_equal(result, exp)
+ result = values.str.split('_', expand=False)
+ tm.assert_series_equal(result, exp)
+
def test_split_noargs(self):
# #1859
s = Series(['Wes McKinney', 'Travis Oliphant'])
@@ -1259,7 +1267,10 @@ def test_split_no_pat_with_nonzero_n(self):
def test_split_to_dataframe(self):
s = Series(['nosplit', 'alsonosplit'])
- result = s.str.split('_', return_type='frame')
+
+ with tm.assert_produces_warning():
+ result = s.str.split('_', return_type='frame')
+
exp = DataFrame({0: Series(['nosplit', 'alsonosplit'])})
tm.assert_frame_equal(result, exp)
@@ -1282,9 +1293,61 @@ def test_split_to_dataframe(self):
index=['preserve', 'me'])
tm.assert_frame_equal(result, exp)
- with tm.assertRaisesRegexp(ValueError, "return_type must be"):
+ with tm.assertRaisesRegexp(ValueError, "expand must be"):
+ s.str.split('_', return_type="some_invalid_type")
+
+ def test_split_to_dataframe_expand(self):
+ s = Series(['nosplit', 'alsonosplit'])
+ result = s.str.split('_', expand=True)
+ exp = DataFrame({0: Series(['nosplit', 'alsonosplit'])})
+ tm.assert_frame_equal(result, exp)
+
+ s = Series(['some_equal_splits', 'with_no_nans'])
+ result = s.str.split('_', expand=True)
+ exp = DataFrame({0: ['some', 'with'], 1: ['equal', 'no'],
+ 2: ['splits', 'nans']})
+ tm.assert_frame_equal(result, exp)
+
+ s = Series(['some_unequal_splits', 'one_of_these_things_is_not'])
+ result = s.str.split('_', expand=True)
+ exp = DataFrame({0: ['some', 'one'], 1: ['unequal', 'of'],
+ 2: ['splits', 'these'], 3: [NA, 'things'],
+ 4: [NA, 'is'], 5: [NA, 'not']})
+ tm.assert_frame_equal(result, exp)
+
+ s = Series(['some_splits', 'with_index'], index=['preserve', 'me'])
+ result = s.str.split('_', expand=True)
+ exp = DataFrame({0: ['some', 'with'], 1: ['splits', 'index']},
+ index=['preserve', 'me'])
+ tm.assert_frame_equal(result, exp)
+
+ with tm.assertRaisesRegexp(ValueError, "expand must be"):
s.str.split('_', return_type="some_invalid_type")
+ def test_split_to_multiindex_expand(self):
+ idx = Index(['nosplit', 'alsonosplit'])
+ result = idx.str.split('_', expand=True)
+ exp = Index([np.array(['nosplit']), np.array(['alsonosplit'])])
+ tm.assert_index_equal(result, exp)
+ self.assertEqual(result.nlevels, 1)
+
+ idx = Index(['some_equal_splits', 'with_no_nans'])
+ result = idx.str.split('_', expand=True)
+ exp = MultiIndex.from_tuples([('some', 'equal', 'splits'),
+ ('with', 'no', 'nans')])
+ tm.assert_index_equal(result, exp)
+ self.assertEqual(result.nlevels, 3)
+
+ idx = Index(['some_unequal_splits', 'one_of_these_things_is_not'])
+ result = idx.str.split('_', expand=True)
+ exp = MultiIndex.from_tuples([('some', 'unequal', 'splits', NA, NA, NA),
+ ('one', 'of', 'these', 'things', 'is', 'not')])
+ tm.assert_index_equal(result, exp)
+ self.assertEqual(result.nlevels, 6)
+
+ with tm.assertRaisesRegexp(ValueError, "expand must be"):
+ idx.str.split('_', return_type="some_invalid_type")
+
def test_partition_series(self):
values = Series(['a_b_c', 'c_d_e', NA, 'f_g_h'])
| Closes #9847, Closes #9870. Default value is `expand=False` to be compat with`return_type='series'`. May better to change the default to True in future (and show warning about it)?
CC @jreback @jorisvandenbossche @sreejata
| https://api.github.com/repos/pandas-dev/pandas/pulls/10085 | 2015-05-08T21:07:34Z | 2015-05-09T15:34:05Z | null | 2015-05-09T21:15:32Z |
DOC/CLN: docs fixes for Series.shift and DataFrame.shift | diff --git a/doc/source/timeseries.rst b/doc/source/timeseries.rst
index 172c71dc53c46..b69b523d9c908 100644
--- a/doc/source/timeseries.rst
+++ b/doc/source/timeseries.rst
@@ -1010,8 +1010,7 @@ Shifting / lagging
One may want to *shift* or *lag* the values in a TimeSeries back and forward in
time. The method for this is ``shift``, which is available on all of the pandas
-objects. In DataFrame, ``shift`` will currently only shift along the ``index``
-and in Panel along the ``major_axis``.
+objects.
.. ipython:: python
diff --git a/pandas/core/frame.py b/pandas/core/frame.py
index 9366ce859ce89..7cce560baa1fc 100644
--- a/pandas/core/frame.py
+++ b/pandas/core/frame.py
@@ -2525,6 +2525,11 @@ def fillna(self, value=None, method=None, axis=None, inplace=False,
limit=limit, downcast=downcast,
**kwargs)
+ @Appender(_shared_docs['shift'] % _shared_doc_kwargs)
+ def shift(self, periods=1, freq=None, axis=0, **kwargs):
+ return super(DataFrame, self).shift(periods=periods, freq=freq,
+ axis=axis, **kwargs)
+
def set_index(self, keys, drop=True, append=False, inplace=False,
verify_integrity=False):
"""
diff --git a/pandas/core/generic.py b/pandas/core/generic.py
index 27565056490ce..4fb08a7b7e107 100644
--- a/pandas/core/generic.py
+++ b/pandas/core/generic.py
@@ -3584,8 +3584,7 @@ def mask(self, cond, other=np.nan, inplace=False, axis=None, level=None,
return self.where(~cond, other=other, inplace=inplace, axis=axis,
level=level, try_cast=try_cast, raise_on_error=raise_on_error)
- def shift(self, periods=1, freq=None, axis=0, **kwargs):
- """
+ _shared_docs['shift'] = ("""
Shift index by desired number of periods with an optional time freq
Parameters
@@ -3595,6 +3594,7 @@ def shift(self, periods=1, freq=None, axis=0, **kwargs):
freq : DateOffset, timedelta, or time rule string, optional
Increment to use from datetools module or time rule (e.g. 'EOM').
See Notes.
+ axis : %(axes_single_arg)s
Notes
-----
@@ -3604,8 +3604,10 @@ def shift(self, periods=1, freq=None, axis=0, **kwargs):
Returns
-------
- shifted : same type as caller
- """
+ shifted : %(klass)s
+ """)
+ @Appender(_shared_docs['shift'] % _shared_doc_kwargs)
+ def shift(self, periods=1, freq=None, axis=0, **kwargs):
if periods == 0:
return self
diff --git a/pandas/core/series.py b/pandas/core/series.py
index a63434a43c7f9..95b6a6aa1e7dd 100644
--- a/pandas/core/series.py
+++ b/pandas/core/series.py
@@ -2151,6 +2151,11 @@ def fillna(self, value=None, method=None, axis=None, inplace=False,
limit=limit, downcast=downcast,
**kwargs)
+ @Appender(generic._shared_docs['shift'] % _shared_doc_kwargs)
+ def shift(self, periods=1, freq=None, axis=0, **kwargs):
+ return super(Series, self).shift(periods=periods, freq=freq,
+ axis=axis, **kwargs)
+
def reindex_axis(self, labels, axis=0, **kwargs):
""" for compatibility with higher dims """
if axis != 0:
| 1. currently `Series.shift()` and `DataFrame.shift()` are both missing `axis` information in the docstring.
2. comment in `timeseries.rst` about shifting only possible along `index` or `major_axis` is not true anymore
| https://api.github.com/repos/pandas-dev/pandas/pulls/10082 | 2015-05-08T02:05:11Z | 2015-05-08T13:45:18Z | 2015-05-08T13:45:18Z | 2015-05-08T16:12:06Z |
Fix for GH9992 - use create_tempfile to remove permission-related errors when running tests | diff --git a/pandas/io/tests/test_pytables.py b/pandas/io/tests/test_pytables.py
index 2e5cef8a1ef57..6cfd569904097 100644
--- a/pandas/io/tests/test_pytables.py
+++ b/pandas/io/tests/test_pytables.py
@@ -156,50 +156,51 @@ def tearDown(self):
pass
def test_factory_fun(self):
+ path = create_tempfile(self.path)
try:
- with get_store(self.path) as tbl:
+ with get_store(path) as tbl:
raise ValueError('blah')
except ValueError:
pass
finally:
- safe_remove(self.path)
+ safe_remove(path)
try:
- with get_store(self.path) as tbl:
+ with get_store(path) as tbl:
tbl['a'] = tm.makeDataFrame()
- with get_store(self.path) as tbl:
+ with get_store(path) as tbl:
self.assertEqual(len(tbl), 1)
self.assertEqual(type(tbl['a']), DataFrame)
finally:
safe_remove(self.path)
def test_context(self):
+ path = create_tempfile(self.path)
try:
- with HDFStore(self.path) as tbl:
+ with HDFStore(path) as tbl:
raise ValueError('blah')
except ValueError:
pass
finally:
- safe_remove(self.path)
+ safe_remove(path)
try:
- with HDFStore(self.path) as tbl:
+ with HDFStore(path) as tbl:
tbl['a'] = tm.makeDataFrame()
- with HDFStore(self.path) as tbl:
+ with HDFStore(path) as tbl:
self.assertEqual(len(tbl), 1)
self.assertEqual(type(tbl['a']), DataFrame)
finally:
- safe_remove(self.path)
+ safe_remove(path)
def test_conv_read_write(self):
-
+ path = create_tempfile(self.path)
try:
-
def roundtrip(key, obj,**kwargs):
- obj.to_hdf(self.path, key,**kwargs)
- return read_hdf(self.path, key)
+ obj.to_hdf(path, key,**kwargs)
+ return read_hdf(path, key)
o = tm.makeTimeSeries()
assert_series_equal(o, roundtrip('series',o))
@@ -215,12 +216,12 @@ def roundtrip(key, obj,**kwargs):
# table
df = DataFrame(dict(A=lrange(5), B=lrange(5)))
- df.to_hdf(self.path,'table',append=True)
- result = read_hdf(self.path, 'table', where = ['index>2'])
+ df.to_hdf(path,'table',append=True)
+ result = read_hdf(path, 'table', where = ['index>2'])
assert_frame_equal(df[df.index>2],result)
finally:
- safe_remove(self.path)
+ safe_remove(path)
def test_long_strings(self):
@@ -4329,13 +4330,14 @@ def do_copy(f = None, new_f = None, keys = None, propindexes = True, **kwargs):
df = tm.makeDataFrame()
try:
- st = HDFStore(self.path)
+ path = create_tempfile(self.path)
+ st = HDFStore(path)
st.append('df', df, data_columns = ['A'])
st.close()
- do_copy(f = self.path)
- do_copy(f = self.path, propindexes = False)
+ do_copy(f = path)
+ do_copy(f = path, propindexes = False)
finally:
- safe_remove(self.path)
+ safe_remove(path)
def test_legacy_table_write(self):
raise nose.SkipTest("cannot write legacy tables")
| Fixes #9992.
I wanted to take a stab at developing pandas. I am a novice at both git/github and I hope I did the merge and PR correctly.
@jreback, please let me know if there is anything I can fix.
| https://api.github.com/repos/pandas-dev/pandas/pulls/10080 | 2015-05-07T21:24:03Z | 2015-05-08T13:19:38Z | null | 2015-05-08T13:19:38Z |
Corrected typo in Grammar of Graphics | diff --git a/doc/source/ecosystem.rst b/doc/source/ecosystem.rst
index 194baba807d14..c70b6deade36e 100644
--- a/doc/source/ecosystem.rst
+++ b/doc/source/ecosystem.rst
@@ -57,7 +57,7 @@ large data to thin clients.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Hadley Wickham's `ggplot2 <http://ggplot2.org/>`__ is a foundational exploratory visualization package for the R language.
-Based on `"The Grammer of Graphics" <http://www.cs.uic.edu/~wilkinson/TheGrammarOfGraphics/GOG.html>`__ it
+Based on `"The Grammar of Graphics" <http://www.cs.uic.edu/~wilkinson/TheGrammarOfGraphics/GOG.html>`__ it
provides a powerful, declarative and extremely general way to generate bespoke plots of any kind of data.
It's really quite incredible. Various implementations to other languages are available,
but a faithful implementation for python users has long been missing. Although still young
| https://api.github.com/repos/pandas-dev/pandas/pulls/10077 | 2015-05-07T18:04:29Z | 2015-05-07T18:29:13Z | 2015-05-07T18:29:13Z | 2015-05-07T18:29:16Z | |
DOC: Fix v0.16.1 release note | diff --git a/doc/source/internals.rst b/doc/source/internals.rst
index bc1189a8961d6..17be04cd64d27 100644
--- a/doc/source/internals.rst
+++ b/doc/source/internals.rst
@@ -94,8 +94,7 @@ not check (or care) whether the levels themselves are sorted. Fortunately, the
constructors ``from_tuples`` and ``from_arrays`` ensure that this is true, but
if you compute the levels and labels yourself, please be careful.
-
-.. _:
+.. _ref-subclassing-pandas:
Subclassing pandas Data Structures
----------------------------------
diff --git a/doc/source/whatsnew/v0.16.1.txt b/doc/source/whatsnew/v0.16.1.txt
index 493f299b2bf32..f1123922045b3 100755
--- a/doc/source/whatsnew/v0.16.1.txt
+++ b/doc/source/whatsnew/v0.16.1.txt
@@ -16,6 +16,8 @@ Highlights include:
- ``BusinessHour`` offset is supported, see :ref:`here <timeseries.businesshour>`
+- Further enhancement to the ``.str`` accessor to make string operations easier, see :ref:`here <whatsnew_0161.enhancements.string>`
+
.. contents:: What's new in v0.16.1
:local:
:backlinks: none
@@ -37,34 +39,9 @@ Enhancements
Timestamp('2014-08-01 07:00') + BusinessHour()
Timestamp('2014-08-01 16:30') + BusinessHour()
-- Added ``StringMethods.capitalize()`` and ``swapcase`` which behave as the same as standard ``str`` (:issue:`9766`)
- ``DataFrame.diff`` now takes an ``axis`` parameter that determines the direction of differencing (:issue:`9727`)
-- Added ``StringMethods`` (.str accessor) to ``Index`` (:issue:`9068`)
-- Added ``StringMethods.normalize()`` which behaves the same as standard :func:`unicodedata.normalizes` (:issue:`10031`)
-
-- Added ``StringMethods.partition()`` and ``rpartition()`` which behave as the same as standard ``str`` (:issue:`9773`)
- Allow clip, clip_lower, and clip_upper to accept array-like arguments as thresholds (:issue:`6966`). These methods now have an ``axis`` parameter which determines how the Series or DataFrame will be aligned with the threshold(s).
- The ``.str`` accessor is now available for both ``Series`` and ``Index``.
-
- .. ipython:: python
-
- idx = Index([' jack', 'jill ', ' jesse ', 'frank'])
- idx.str.strip()
-
- One special case for the `.str` accessor on ``Index`` is that if a string method returns ``bool``, the ``.str`` accessor
- will return a ``np.array`` instead of a boolean ``Index`` (:issue:`8875`). This enables the following expression
- to work naturally:
-
-
- .. ipython:: python
-
- idx = Index(['a1', 'a2', 'b1', 'b2'])
- s = Series(range(4), index=idx)
- s
- idx.str.startswith('a')
- s[s.index.str.startswith('a')]
-
- ``DataFrame.mask()`` and ``Series.mask()`` now support same keywords as ``where`` (:issue:`8801`)
- ``drop`` function can now accept ``errors`` keyword to suppress ``ValueError`` raised when any of label does not exist in the target data. (:issue:`6736`)
@@ -199,6 +176,46 @@ when sampling from rows.
df = DataFrame({'col1':[9,8,7,6], 'weight_column':[0.5, 0.4, 0.1, 0]})
df.sample(n=3, weights='weight_column')
+
+.. _whatsnew_0161.enhancements.string:
+
+String Methods Enhancements
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+:ref:`Continuing from v0.16.0 <whatsnew_0160.enhancements.string>`, following
+enhancements are performed to make string operation easier.
+
+- Following new methods are accesible via ``.str`` accessor to apply the function to each values. This is intended to make it more consistent with standard methods on strings. (:issue:`9766`, :issue:`9773`, :issue:`10031`)
+
+ ================ =============== =============== =============== ================
+ .. .. Methods .. ..
+ ================ =============== =============== =============== ================
+ ``capitalize()`` ``swapcase()`` ``normalize()`` ``partition()`` ``rpartition()``
+ ================ =============== =============== =============== ================
+
+
+
+- Added ``StringMethods`` (.str accessor) to ``Index`` (:issue:`9068`)
+
+ The ``.str`` accessor is now available for both ``Series`` and ``Index``.
+
+ .. ipython:: python
+
+ idx = Index([' jack', 'jill ', ' jesse ', 'frank'])
+ idx.str.strip()
+
+ One special case for the `.str` accessor on ``Index`` is that if a string method returns ``bool``, the ``.str`` accessor
+ will return a ``np.array`` instead of a boolean ``Index`` (:issue:`8875`). This enables the following expression
+ to work naturally:
+
+ .. ipython:: python
+
+ idx = Index(['a1', 'a2', 'b1', 'b2'])
+ s = Series(range(4), index=idx)
+ s
+ idx.str.startswith('a')
+ s[s.index.str.startswith('a')]
+
.. _whatsnew_0161.api:
API changes
| - Organize `.str` related enhancements
- Fixed broken link
| https://api.github.com/repos/pandas-dev/pandas/pulls/10076 | 2015-05-07T17:58:59Z | 2015-05-07T23:23:31Z | 2015-05-07T23:23:31Z | 2015-05-08T02:34:35Z |
DOC/DEPR: port pandas.rpy to rpy2 guide | diff --git a/doc/source/r_interface.rst b/doc/source/r_interface.rst
index 2207c823f43b1..da37c92c88ecf 100644
--- a/doc/source/r_interface.rst
+++ b/doc/source/r_interface.rst
@@ -15,7 +15,69 @@ rpy2 / R interface
.. warning::
- In v0.16.0, the ``pandas.rpy`` interface has been **deprecated and will be removed in a future version**. Similar functionaility can be accessed thru the `rpy2 <http://rpy.sourceforge.net/>`_ project.
+ In v0.16.0, the ``pandas.rpy`` interface has been **deprecated and will be
+ removed in a future version**. Similar functionality can be accessed
+ through the `rpy2 <http://rpy.sourceforge.net/>`_ project.
+ See the :ref:`updating <rpy.updating>` section for a guide to port your
+ code from the ``pandas.rpy`` to ``rpy2`` functions.
+
+
+.. _rpy.updating:
+
+Updating your code to use rpy2 functions
+----------------------------------------
+
+In v0.16.0, the ``pandas.rpy`` module has been **deprecated** and users are
+pointed to the similar functionality in ``rpy2`` itself (rpy2 >= 2.4).
+
+Instead of importing ``import pandas.rpy.common as com``, the following imports
+should be done to activate the pandas conversion support in rpy2::
+
+ from rpy2.robjects import pandas2ri
+ pandas2ri.activate()
+
+Converting data frames back and forth between rpy2 and pandas should be largely
+automated (no need to convert explicitly, it will be done on the fly in most
+rpy2 functions).
+
+To convert explicitly, the functions are ``pandas2ri.py2ri()`` and
+``pandas2ri.ri2py()``. So these functions can be used to replace the existing
+functions in pandas:
+
+- ``com.convert_to_r_dataframe(df)`` should be replaced with ``pandas2ri.py2ri(df)``
+- ``com.convert_robj(rdf)`` should be replaced with ``pandas2ri.ri2py(rdf)``
+
+Note: these functions are for the latest version (rpy2 2.5.x) and were called
+``pandas2ri.pandas2ri()`` and ``pandas2ri.ri2pandas()`` previously.
+
+Some of the other functionality in `pandas.rpy` can be replaced easily as well.
+For example to load R data as done with the ``load_data`` function, the
+current method::
+
+ df_iris = com.load_data('iris')
+
+can be replaced with::
+
+ from rpy2.robjects import r
+ r.data('iris')
+ df_iris = pandas2ri.ri2py(r[name])
+
+The ``convert_to_r_matrix`` function can be replaced by the normal
+``pandas2ri.py2ri`` to convert dataframes, with a subsequent call to R
+``as.matrix`` function.
+
+.. warning::
+
+ Not all conversion functions in rpy2 are working exactly the same as the
+ current methods in pandas. If you experience problems or limitations in
+ comparison to the ones in pandas, please report this at the
+ `issue tracker <https://github.com/pydata/pandas/issues>`_.
+
+See also the documentation of the `rpy2 <http://rpy.sourceforge.net/>`_ project.
+
+
+R interface with rpy2
+---------------------
If your computer has R and rpy2 (> 2.2) installed (which will be left to the
reader), you will be able to leverage the below functionality. On Windows,
diff --git a/pandas/rpy/__init__.py b/pandas/rpy/__init__.py
index 899b684ecbff9..bad7ebc580ce2 100644
--- a/pandas/rpy/__init__.py
+++ b/pandas/rpy/__init__.py
@@ -5,7 +5,10 @@
import warnings
warnings.warn("The pandas.rpy module is deprecated and will be "
"removed in a future version. We refer to external packages "
- "like rpy2, found here: http://rpy.sourceforge.net", FutureWarning)
+ "like rpy2. "
+ "\nSee here for a guide on how to port your code to rpy2: "
+ "http://pandas.pydata.org/pandas-docs/stable/r_interface.html",
+ FutureWarning)
try:
from .common import importr, r, load_data
| Addresses the doc part of #9602
| https://api.github.com/repos/pandas-dev/pandas/pulls/10075 | 2015-05-07T12:05:27Z | 2015-05-11T09:12:42Z | 2015-05-11T09:12:42Z | 2015-05-11T09:12:42Z |
BUG: Fix typo in parsers.py | diff --git a/pandas/io/parsers.py b/pandas/io/parsers.py
index 59ecb29146315..1ca396935ae78 100755
--- a/pandas/io/parsers.py
+++ b/pandas/io/parsers.py
@@ -997,7 +997,7 @@ def _convert_to_ndarrays(self, dct, na_values, na_fvalues, verbose=False,
try:
values = lib.map_infer(values, conv_f)
except ValueError:
- mask = lib.ismember(values, na_values).view(np.uin8)
+ mask = lib.ismember(values, na_values).view(np.uint8)
values = lib.map_infer_mask(values, conv_f, mask)
coerce_type = False
| closes #9266
np.uin8 should be np.uint8
| https://api.github.com/repos/pandas-dev/pandas/pulls/10074 | 2015-05-07T11:19:02Z | 2015-06-02T10:53:55Z | null | 2015-06-02T10:53:55Z |
PERF: BlockPlacement.copy() speed-up | diff --git a/pandas/lib.pyx b/pandas/lib.pyx
index cc4c43494176e..fd01e0099ab6b 100644
--- a/pandas/lib.pyx
+++ b/pandas/lib.pyx
@@ -1641,12 +1641,21 @@ cdef class BlockPlacement:
cdef bint _has_slice, _has_array, _is_known_slice_like
- def __init__(self, val):
+ def __init__(self, val, fastpath=False):
cdef slice slc
self._has_slice = False
self._has_array = False
+ if fastpath:
+ if isinstance(val, slice):
+ self._as_slice = val
+ self._has_slice = True
+ else:
+ self._as_array = val
+ self._has_array = True
+ return
+
if isinstance(val, slice):
slc = slice_canonize(val)
@@ -1783,12 +1792,11 @@ cdef class BlockPlacement:
return self
- cdef BlockPlacement copy(self):
- cdef slice s = self._ensure_has_slice()
- if s is not None:
- return BlockPlacement(s)
+ cpdef BlockPlacement copy(self):
+ if self._as_slice is not None:
+ return BlockPlacement(self._as_slice, fastpath=True)
else:
- return BlockPlacement(self._as_array)
+ return BlockPlacement(self._as_array, fastpath=True)
def add(self, other):
return self.copy().iadd(other)
| Copying of a `BlockPlacement` is currently slower than it could/should be:
- `copy()` cannot be accessed from python, one currently needs to re-implement `copy()` if one wants to duplicate a `BlockPlacement` instance
- `copy()` tries to infer a slice for any array contained in the `BlockPlacement`.
- After `copy()` passes an array to the constructor, a sanity check in the form of `np.require(val, dtype=np.int64, requirements='W')` checks that the array is a valid input for a `BlockPlacement`. This is unnecessary since the array originated from a `BlockPlacement` for which this check was already done.
| https://api.github.com/repos/pandas-dev/pandas/pulls/10073 | 2015-05-07T10:59:27Z | 2015-08-05T10:32:51Z | null | 2015-08-05T10:32:51Z |
BUG: median() not correctly handling non-float null values (fixes #10… | diff --git a/doc/source/whatsnew/v0.16.1.txt b/doc/source/whatsnew/v0.16.1.txt
index 493f299b2bf32..e0ee88f6eb10c 100755
--- a/doc/source/whatsnew/v0.16.1.txt
+++ b/doc/source/whatsnew/v0.16.1.txt
@@ -320,3 +320,4 @@ Bug Fixes
- Google BigQuery connector now imports dependencies on a per-method basis.(:issue:`9713`)
- Updated BigQuery connector to no longer use deprecated ``oauth2client.tools.run()`` (:issue:`8327`)
- Bug in subclassed ``DataFrame``. It may not return the correct class, when slicing or subsetting it. (:issue:`9632`)
+- BUG in median() where non-float null values are not handled correctly (:issue:`10040`)
diff --git a/pandas/core/nanops.py b/pandas/core/nanops.py
index f68f4f9037d97..4121dd8e89bee 100644
--- a/pandas/core/nanops.py
+++ b/pandas/core/nanops.py
@@ -285,6 +285,7 @@ def get_median(x):
if values.dtype != np.float64:
values = values.astype('f8')
+ values[mask] = np.nan
if axis is None:
values = values.ravel()
diff --git a/pandas/tseries/tests/test_timedeltas.py b/pandas/tseries/tests/test_timedeltas.py
index faf4e3fa57780..45145eb7ab7e8 100644
--- a/pandas/tseries/tests/test_timedeltas.py
+++ b/pandas/tseries/tests/test_timedeltas.py
@@ -614,7 +614,7 @@ def test_timedelta_ops(self):
self.assertEqual(result, expected)
result = td.median()
- expected = to_timedelta('00:00:08')
+ expected = to_timedelta('00:00:09')
self.assertEqual(result, expected)
result = td.to_frame().median()
@@ -641,6 +641,14 @@ def test_timedelta_ops(self):
for op in ['skew','kurt','sem','var','prod']:
self.assertRaises(TypeError, lambda : getattr(td,op)())
+ # GH 10040
+ # make sure NaT is properly handled by median()
+ s = Series([Timestamp('2015-02-03'), Timestamp('2015-02-07')])
+ self.assertEqual(s.diff().median(), timedelta(days=4))
+
+ s = Series([Timestamp('2015-02-03'), Timestamp('2015-02-07'), Timestamp('2015-02-15')])
+ self.assertEqual(s.diff().median(), timedelta(days=6))
+
def test_timedelta_ops_scalar(self):
# GH 6808
base = pd.to_datetime('20130101 09:01:12.123456')
| closes #10040
| https://api.github.com/repos/pandas-dev/pandas/pulls/10072 | 2015-05-07T07:55:30Z | 2015-05-07T20:53:20Z | 2015-05-07T20:53:20Z | 2015-05-07T21:03:23Z |
DOC/CLN: fixed typos in timeseries.rst | diff --git a/doc/source/timeseries.rst b/doc/source/timeseries.rst
index ac3302ae40fa7..606026e7eeade 100644
--- a/doc/source/timeseries.rst
+++ b/doc/source/timeseries.rst
@@ -243,7 +243,7 @@ variety of frequency aliases. The default frequency for ``date_range`` is a
rng = bdate_range(start, end)
rng
-``date_range`` and ``bdate_range`` makes it easy to generate a range of dates
+``date_range`` and ``bdate_range`` make it easy to generate a range of dates
using various combinations of parameters like ``start``, ``end``,
``periods``, and ``freq``:
@@ -353,7 +353,7 @@ This specifies an **exact** stop time (and is not the same as the above)
dft['2013-1':'2013-2-28 00:00:00']
-We are stopping on the included end-point as its part of the index
+We are stopping on the included end-point as it is part of the index
.. ipython:: python
@@ -540,7 +540,7 @@ The ``rollforward`` and ``rollback`` methods do exactly what you would expect:
It's definitely worth exploring the ``pandas.tseries.offsets`` module and the
various docstrings for the classes.
-These operations (``apply``, ``rollforward`` and ``rollback``) preserves time (hour, minute, etc) information by default. To reset time, use ``normalize=True`` keyword when create offset instance. If ``normalize=True``, result is normalized after the function is applied.
+These operations (``apply``, ``rollforward`` and ``rollback``) preserves time (hour, minute, etc) information by default. To reset time, use ``normalize=True`` keyword when creating the offset instance. If ``normalize=True``, result is normalized after the function is applied.
.. ipython:: python
@@ -563,7 +563,7 @@ Parametric offsets
~~~~~~~~~~~~~~~~~~
Some of the offsets can be "parameterized" when created to result in different
-behavior. For example, the ``Week`` offset for generating weekly data accepts a
+behaviors. For example, the ``Week`` offset for generating weekly data accepts a
``weekday`` parameter which results in the generated dates always lying on a
particular day of the week:
@@ -806,7 +806,7 @@ strongly recommended that you switch to using the new offset aliases.
"ms", "L"
"us", "U"
-As you can see, legacy quarterly and annual frequencies are business quarter
+As you can see, legacy quarterly and annual frequencies are business quarters
and business year ends. Please also note the legacy time rule for milliseconds
``ms`` versus the new offset alias for month start ``MS``. This means that
offset alias parsing is case sensitive.
@@ -1060,8 +1060,8 @@ frequency periods.
Note that 0.8 marks a watershed in the timeseries functionality in pandas. In
previous versions, resampling had to be done using a combination of
``date_range``, ``groupby`` with ``asof``, and then calling an aggregation
-function on the grouped object. This was not nearly convenient or performant as
-the new pandas timeseries API.
+function on the grouped object. This was not nearly as convenient or performant
+as the new pandas timeseries API.
.. _timeseries.periods:
@@ -1099,7 +1099,7 @@ frequency.
p - 3
-If ``Period`` freq is daily or higher (``D``, ``H``, ``T``, ``S``, ``L``, ``U``, ``N``), ``offsets`` and ``timedelta``-like can be added if the result can have same freq. Otherise, ``ValueError`` will be raised.
+If ``Period`` freq is daily or higher (``D``, ``H``, ``T``, ``S``, ``L``, ``U``, ``N``), ``offsets`` and ``timedelta``-like can be added if the result can have the same freq. Otherise, ``ValueError`` will be raised.
.. ipython:: python
@@ -1160,7 +1160,7 @@ objects:
ps = Series(randn(len(prng)), prng)
ps
-``PeriodIndex`` supports addition and subtraction as the same rule as ``Period``.
+``PeriodIndex`` supports addition and subtraction with the same rule as ``Period``.
.. ipython:: python
@@ -1175,7 +1175,7 @@ objects:
PeriodIndex Partial String Indexing
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-You can pass in dates and strings to `Series` and `DataFrame` with `PeriodIndex`, as the same manner as `DatetimeIndex`. For details, refer to :ref:`DatetimeIndex Partial String Indexing <timeseries.partialindexing>`.
+You can pass in dates and strings to ``Series`` and ``DataFrame`` with ``PeriodIndex``, in the same manner as ``DatetimeIndex``. For details, refer to :ref:`DatetimeIndex Partial String Indexing <timeseries.partialindexing>`.
.. ipython:: python
@@ -1185,7 +1185,7 @@ You can pass in dates and strings to `Series` and `DataFrame` with `PeriodIndex`
ps['10/31/2011':'12/31/2011']
-Passing string represents lower frequency than `PeriodIndex` returns partial sliced data.
+Passing a string representing a lower frequency than ``PeriodIndex`` returns partial sliced data.
.. ipython:: python
@@ -1196,7 +1196,7 @@ Passing string represents lower frequency than `PeriodIndex` returns partial sli
dfp
dfp['2013-01-01 10H']
-As the same as `DatetimeIndex`, the endpoints will be included in the result. Below example slices data starting from 10:00 to 11:59.
+As with ``DatetimeIndex``, the endpoints will be included in the result. The example below slices data starting from 10:00 to 11:59.
.. ipython:: python
@@ -1204,7 +1204,7 @@ As the same as `DatetimeIndex`, the endpoints will be included in the result. Be
Frequency Conversion and Resampling with PeriodIndex
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The frequency of Periods and PeriodIndex can be converted via the ``asfreq``
+The frequency of ``Period`` and ``PeriodIndex`` can be converted via the ``asfreq``
method. Let's start with the fiscal year 2011, ending in December:
.. ipython:: python
@@ -1247,8 +1247,8 @@ period.
Period conversions with anchored frequencies are particularly useful for
working with various quarterly data common to economics, business, and other
fields. Many organizations define quarters relative to the month in which their
-fiscal year start and ends. Thus, first quarter of 2011 could start in 2010 or
-a few months into 2011. Via anchored frequencies, pandas works all quarterly
+fiscal year starts and ends. Thus, first quarter of 2011 could start in 2010 or
+a few months into 2011. Via anchored frequencies, pandas works for all quarterly
frequencies ``Q-JAN`` through ``Q-DEC``.
``Q-DEC`` define regular calendar quarters:
@@ -1354,7 +1354,7 @@ Time Zone Handling
------------------
Pandas provides rich support for working with timestamps in different time zones using ``pytz`` and ``dateutil`` libraries.
-``dateutil`` support is new [in 0.14.1] and currently only supported for fixed offset and tzfile zones. The default library is ``pytz``.
+``dateutil`` support is new in 0.14.1 and currently only supported for fixed offset and tzfile zones. The default library is ``pytz``.
Support for ``dateutil`` is provided for compatibility with other applications e.g. if you use ``dateutil`` in other python packages.
Working with Time Zones
| https://api.github.com/repos/pandas-dev/pandas/pulls/10071 | 2015-05-06T22:44:17Z | 2015-05-07T00:00:05Z | 2015-05-07T00:00:05Z | 2015-05-07T01:06:52Z | |
BUG make take_nd support readonly arrays | diff --git a/pandas/src/generate_code.py b/pandas/src/generate_code.py
index 9d0384857ed81..3b71d1c083ba1 100644
--- a/pandas/src/generate_code.py
+++ b/pandas/src/generate_code.py
@@ -93,12 +93,7 @@ def take_1d_%(name)s_%(dest)s(ndarray[%(c_type_in)s] values,
"""
-take_2d_axis0_template = """@cython.wraparound(False)
-@cython.boundscheck(False)
-def take_2d_axis0_%(name)s_%(dest)s(%(c_type_in)s[:, :] values,
- ndarray[int64_t] indexer,
- %(c_type_out)s[:, :] out,
- fill_value=np.nan):
+inner_take_2d_axis0_template = """\
cdef:
Py_ssize_t i, j, k, n, idx
%(c_type_out)s fv
@@ -140,12 +135,34 @@ def take_2d_axis0_%(name)s_%(dest)s(%(c_type_in)s[:, :] values,
"""
-take_2d_axis1_template = """@cython.wraparound(False)
+take_2d_axis0_template = """\
+@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis1_%(name)s_%(dest)s(%(c_type_in)s[:, :] values,
+cdef inline take_2d_axis0_%(name)s_%(dest)s_memview(%(c_type_in)s[:, :] values,
+ ndarray[int64_t] indexer,
+ %(c_type_out)s[:, :] out,
+ fill_value=np.nan):
+""" + inner_take_2d_axis0_template + """
+
+@cython.wraparound(False)
+@cython.boundscheck(False)
+def take_2d_axis0_%(name)s_%(dest)s(ndarray[%(c_type_in)s, ndim=2] values,
ndarray[int64_t] indexer,
%(c_type_out)s[:, :] out,
fill_value=np.nan):
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis0_%(name)s_%(dest)s_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
+""" + inner_take_2d_axis0_template
+
+
+inner_take_2d_axis1_template = """\
cdef:
Py_ssize_t i, j, k, n, idx
%(c_type_out)s fv
@@ -165,9 +182,36 @@ def take_2d_axis1_%(name)s_%(dest)s(%(c_type_in)s[:, :] values,
out[i, j] = fv
else:
out[i, j] = %(preval)svalues[i, idx]%(postval)s
-
"""
+take_2d_axis1_template = """\
+@cython.wraparound(False)
+@cython.boundscheck(False)
+cdef inline take_2d_axis1_%(name)s_%(dest)s_memview(%(c_type_in)s[:, :] values,
+ ndarray[int64_t] indexer,
+ %(c_type_out)s[:, :] out,
+ fill_value=np.nan):
+""" + inner_take_2d_axis1_template + """
+
+@cython.wraparound(False)
+@cython.boundscheck(False)
+def take_2d_axis1_%(name)s_%(dest)s(ndarray[%(c_type_in)s, ndim=2] values,
+ ndarray[int64_t] indexer,
+ %(c_type_out)s[:, :] out,
+ fill_value=np.nan):
+
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis1_%(name)s_%(dest)s_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
+""" + inner_take_2d_axis1_template
+
+
take_2d_multi_template = """@cython.wraparound(False)
@cython.boundscheck(False)
def take_2d_multi_%(name)s_%(dest)s(ndarray[%(c_type_in)s, ndim=2] values,
diff --git a/pandas/src/generated.pyx b/pandas/src/generated.pyx
index cab3a84f6ffe8..ac31fdedf2ea6 100644
--- a/pandas/src/generated.pyx
+++ b/pandas/src/generated.pyx
@@ -2704,10 +2704,10 @@ def take_1d_object_object(ndarray[object] values,
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis0_bool_bool(uint8_t[:, :] values,
- ndarray[int64_t] indexer,
- uint8_t[:, :] out,
- fill_value=np.nan):
+cdef inline take_2d_axis0_bool_bool_memview(uint8_t[:, :] values,
+ ndarray[int64_t] indexer,
+ uint8_t[:, :] out,
+ fill_value=np.nan):
cdef:
Py_ssize_t i, j, k, n, idx
uint8_t fv
@@ -2747,30 +2747,41 @@ def take_2d_axis0_bool_bool(uint8_t[:, :] values,
for j from 0 <= j < k:
out[i, j] = values[idx, j]
+
+
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis0_bool_object(uint8_t[:, :] values,
+def take_2d_axis0_bool_bool(ndarray[uint8_t, ndim=2] values,
ndarray[int64_t] indexer,
- object[:, :] out,
+ uint8_t[:, :] out,
fill_value=np.nan):
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis0_bool_bool_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
cdef:
Py_ssize_t i, j, k, n, idx
- object fv
+ uint8_t fv
n = len(indexer)
k = values.shape[1]
fv = fill_value
- IF False:
+ IF True:
cdef:
- object *v
- object *o
+ uint8_t *v
+ uint8_t *o
#GH3130
if (values.strides[1] == out.strides[1] and
- values.strides[1] == sizeof(object) and
- sizeof(object) * n >= 256):
+ values.strides[1] == sizeof(uint8_t) and
+ sizeof(uint8_t) * n >= 256):
for i from 0 <= i < n:
idx = indexer[i]
@@ -2780,7 +2791,7 @@ def take_2d_axis0_bool_object(uint8_t[:, :] values,
else:
v = &values[idx, 0]
o = &out[i, 0]
- memmove(o, v, <size_t>(sizeof(object) * k))
+ memmove(o, v, <size_t>(sizeof(uint8_t) * k))
return
for i from 0 <= i < n:
@@ -2790,32 +2801,32 @@ def take_2d_axis0_bool_object(uint8_t[:, :] values,
out[i, j] = fv
else:
for j from 0 <= j < k:
- out[i, j] = True if values[idx, j] > 0 else False
+ out[i, j] = values[idx, j]
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis0_int8_int8(int8_t[:, :] values,
- ndarray[int64_t] indexer,
- int8_t[:, :] out,
- fill_value=np.nan):
+cdef inline take_2d_axis0_bool_object_memview(uint8_t[:, :] values,
+ ndarray[int64_t] indexer,
+ object[:, :] out,
+ fill_value=np.nan):
cdef:
Py_ssize_t i, j, k, n, idx
- int8_t fv
+ object fv
n = len(indexer)
k = values.shape[1]
fv = fill_value
- IF True:
+ IF False:
cdef:
- int8_t *v
- int8_t *o
+ object *v
+ object *o
#GH3130
if (values.strides[1] == out.strides[1] and
- values.strides[1] == sizeof(int8_t) and
- sizeof(int8_t) * n >= 256):
+ values.strides[1] == sizeof(object) and
+ sizeof(object) * n >= 256):
for i from 0 <= i < n:
idx = indexer[i]
@@ -2825,7 +2836,7 @@ def take_2d_axis0_int8_int8(int8_t[:, :] values,
else:
v = &values[idx, 0]
o = &out[i, 0]
- memmove(o, v, <size_t>(sizeof(int8_t) * k))
+ memmove(o, v, <size_t>(sizeof(object) * k))
return
for i from 0 <= i < n:
@@ -2835,17 +2846,28 @@ def take_2d_axis0_int8_int8(int8_t[:, :] values,
out[i, j] = fv
else:
for j from 0 <= j < k:
- out[i, j] = values[idx, j]
+ out[i, j] = True if values[idx, j] > 0 else False
+
+
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis0_int8_int32(int8_t[:, :] values,
+def take_2d_axis0_bool_object(ndarray[uint8_t, ndim=2] values,
ndarray[int64_t] indexer,
- int32_t[:, :] out,
+ object[:, :] out,
fill_value=np.nan):
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis0_bool_object_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
cdef:
Py_ssize_t i, j, k, n, idx
- int32_t fv
+ object fv
n = len(indexer)
k = values.shape[1]
@@ -2854,13 +2876,13 @@ def take_2d_axis0_int8_int32(int8_t[:, :] values,
IF False:
cdef:
- int32_t *v
- int32_t *o
+ object *v
+ object *o
#GH3130
if (values.strides[1] == out.strides[1] and
- values.strides[1] == sizeof(int32_t) and
- sizeof(int32_t) * n >= 256):
+ values.strides[1] == sizeof(object) and
+ sizeof(object) * n >= 256):
for i from 0 <= i < n:
idx = indexer[i]
@@ -2870,7 +2892,7 @@ def take_2d_axis0_int8_int32(int8_t[:, :] values,
else:
v = &values[idx, 0]
o = &out[i, 0]
- memmove(o, v, <size_t>(sizeof(int32_t) * k))
+ memmove(o, v, <size_t>(sizeof(object) * k))
return
for i from 0 <= i < n:
@@ -2880,32 +2902,32 @@ def take_2d_axis0_int8_int32(int8_t[:, :] values,
out[i, j] = fv
else:
for j from 0 <= j < k:
- out[i, j] = values[idx, j]
+ out[i, j] = True if values[idx, j] > 0 else False
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis0_int8_int64(int8_t[:, :] values,
- ndarray[int64_t] indexer,
- int64_t[:, :] out,
- fill_value=np.nan):
+cdef inline take_2d_axis0_int8_int8_memview(int8_t[:, :] values,
+ ndarray[int64_t] indexer,
+ int8_t[:, :] out,
+ fill_value=np.nan):
cdef:
Py_ssize_t i, j, k, n, idx
- int64_t fv
+ int8_t fv
n = len(indexer)
k = values.shape[1]
fv = fill_value
- IF False:
+ IF True:
cdef:
- int64_t *v
- int64_t *o
+ int8_t *v
+ int8_t *o
#GH3130
if (values.strides[1] == out.strides[1] and
- values.strides[1] == sizeof(int64_t) and
- sizeof(int64_t) * n >= 256):
+ values.strides[1] == sizeof(int8_t) and
+ sizeof(int8_t) * n >= 256):
for i from 0 <= i < n:
idx = indexer[i]
@@ -2915,7 +2937,7 @@ def take_2d_axis0_int8_int64(int8_t[:, :] values,
else:
v = &values[idx, 0]
o = &out[i, 0]
- memmove(o, v, <size_t>(sizeof(int64_t) * k))
+ memmove(o, v, <size_t>(sizeof(int8_t) * k))
return
for i from 0 <= i < n:
@@ -2927,30 +2949,41 @@ def take_2d_axis0_int8_int64(int8_t[:, :] values,
for j from 0 <= j < k:
out[i, j] = values[idx, j]
+
+
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis0_int8_float64(int8_t[:, :] values,
+def take_2d_axis0_int8_int8(ndarray[int8_t, ndim=2] values,
ndarray[int64_t] indexer,
- float64_t[:, :] out,
+ int8_t[:, :] out,
fill_value=np.nan):
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis0_int8_int8_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
cdef:
Py_ssize_t i, j, k, n, idx
- float64_t fv
+ int8_t fv
n = len(indexer)
k = values.shape[1]
fv = fill_value
- IF False:
+ IF True:
cdef:
- float64_t *v
- float64_t *o
+ int8_t *v
+ int8_t *o
#GH3130
if (values.strides[1] == out.strides[1] and
- values.strides[1] == sizeof(float64_t) and
- sizeof(float64_t) * n >= 256):
+ values.strides[1] == sizeof(int8_t) and
+ sizeof(int8_t) * n >= 256):
for i from 0 <= i < n:
idx = indexer[i]
@@ -2960,7 +2993,7 @@ def take_2d_axis0_int8_float64(int8_t[:, :] values,
else:
v = &values[idx, 0]
o = &out[i, 0]
- memmove(o, v, <size_t>(sizeof(float64_t) * k))
+ memmove(o, v, <size_t>(sizeof(int8_t) * k))
return
for i from 0 <= i < n:
@@ -2974,28 +3007,28 @@ def take_2d_axis0_int8_float64(int8_t[:, :] values,
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis0_int16_int16(int16_t[:, :] values,
- ndarray[int64_t] indexer,
- int16_t[:, :] out,
- fill_value=np.nan):
+cdef inline take_2d_axis0_int8_int32_memview(int8_t[:, :] values,
+ ndarray[int64_t] indexer,
+ int32_t[:, :] out,
+ fill_value=np.nan):
cdef:
Py_ssize_t i, j, k, n, idx
- int16_t fv
+ int32_t fv
n = len(indexer)
k = values.shape[1]
fv = fill_value
- IF True:
+ IF False:
cdef:
- int16_t *v
- int16_t *o
+ int32_t *v
+ int32_t *o
#GH3130
if (values.strides[1] == out.strides[1] and
- values.strides[1] == sizeof(int16_t) and
- sizeof(int16_t) * n >= 256):
+ values.strides[1] == sizeof(int32_t) and
+ sizeof(int32_t) * n >= 256):
for i from 0 <= i < n:
idx = indexer[i]
@@ -3005,7 +3038,7 @@ def take_2d_axis0_int16_int16(int16_t[:, :] values,
else:
v = &values[idx, 0]
o = &out[i, 0]
- memmove(o, v, <size_t>(sizeof(int16_t) * k))
+ memmove(o, v, <size_t>(sizeof(int32_t) * k))
return
for i from 0 <= i < n:
@@ -3017,12 +3050,23 @@ def take_2d_axis0_int16_int16(int16_t[:, :] values,
for j from 0 <= j < k:
out[i, j] = values[idx, j]
+
+
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis0_int16_int32(int16_t[:, :] values,
+def take_2d_axis0_int8_int32(ndarray[int8_t, ndim=2] values,
ndarray[int64_t] indexer,
int32_t[:, :] out,
fill_value=np.nan):
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis0_int8_int32_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
cdef:
Py_ssize_t i, j, k, n, idx
int32_t fv
@@ -3064,10 +3108,10 @@ def take_2d_axis0_int16_int32(int16_t[:, :] values,
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis0_int16_int64(int16_t[:, :] values,
- ndarray[int64_t] indexer,
- int64_t[:, :] out,
- fill_value=np.nan):
+cdef inline take_2d_axis0_int8_int64_memview(int8_t[:, :] values,
+ ndarray[int64_t] indexer,
+ int64_t[:, :] out,
+ fill_value=np.nan):
cdef:
Py_ssize_t i, j, k, n, idx
int64_t fv
@@ -3107,15 +3151,26 @@ def take_2d_axis0_int16_int64(int16_t[:, :] values,
for j from 0 <= j < k:
out[i, j] = values[idx, j]
+
+
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis0_int16_float64(int16_t[:, :] values,
+def take_2d_axis0_int8_int64(ndarray[int8_t, ndim=2] values,
ndarray[int64_t] indexer,
- float64_t[:, :] out,
+ int64_t[:, :] out,
fill_value=np.nan):
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis0_int8_int64_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
cdef:
Py_ssize_t i, j, k, n, idx
- float64_t fv
+ int64_t fv
n = len(indexer)
k = values.shape[1]
@@ -3124,13 +3179,13 @@ def take_2d_axis0_int16_float64(int16_t[:, :] values,
IF False:
cdef:
- float64_t *v
- float64_t *o
+ int64_t *v
+ int64_t *o
#GH3130
if (values.strides[1] == out.strides[1] and
- values.strides[1] == sizeof(float64_t) and
- sizeof(float64_t) * n >= 256):
+ values.strides[1] == sizeof(int64_t) and
+ sizeof(int64_t) * n >= 256):
for i from 0 <= i < n:
idx = indexer[i]
@@ -3140,7 +3195,7 @@ def take_2d_axis0_int16_float64(int16_t[:, :] values,
else:
v = &values[idx, 0]
o = &out[i, 0]
- memmove(o, v, <size_t>(sizeof(float64_t) * k))
+ memmove(o, v, <size_t>(sizeof(int64_t) * k))
return
for i from 0 <= i < n:
@@ -3154,28 +3209,28 @@ def take_2d_axis0_int16_float64(int16_t[:, :] values,
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis0_int32_int32(int32_t[:, :] values,
- ndarray[int64_t] indexer,
- int32_t[:, :] out,
- fill_value=np.nan):
+cdef inline take_2d_axis0_int8_float64_memview(int8_t[:, :] values,
+ ndarray[int64_t] indexer,
+ float64_t[:, :] out,
+ fill_value=np.nan):
cdef:
Py_ssize_t i, j, k, n, idx
- int32_t fv
+ float64_t fv
n = len(indexer)
k = values.shape[1]
fv = fill_value
- IF True:
+ IF False:
cdef:
- int32_t *v
- int32_t *o
+ float64_t *v
+ float64_t *o
#GH3130
if (values.strides[1] == out.strides[1] and
- values.strides[1] == sizeof(int32_t) and
- sizeof(int32_t) * n >= 256):
+ values.strides[1] == sizeof(float64_t) and
+ sizeof(float64_t) * n >= 256):
for i from 0 <= i < n:
idx = indexer[i]
@@ -3185,7 +3240,7 @@ def take_2d_axis0_int32_int32(int32_t[:, :] values,
else:
v = &values[idx, 0]
o = &out[i, 0]
- memmove(o, v, <size_t>(sizeof(int32_t) * k))
+ memmove(o, v, <size_t>(sizeof(float64_t) * k))
return
for i from 0 <= i < n:
@@ -3197,15 +3252,26 @@ def take_2d_axis0_int32_int32(int32_t[:, :] values,
for j from 0 <= j < k:
out[i, j] = values[idx, j]
+
+
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis0_int32_int64(int32_t[:, :] values,
+def take_2d_axis0_int8_float64(ndarray[int8_t, ndim=2] values,
ndarray[int64_t] indexer,
- int64_t[:, :] out,
+ float64_t[:, :] out,
fill_value=np.nan):
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis0_int8_float64_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
cdef:
Py_ssize_t i, j, k, n, idx
- int64_t fv
+ float64_t fv
n = len(indexer)
k = values.shape[1]
@@ -3214,13 +3280,13 @@ def take_2d_axis0_int32_int64(int32_t[:, :] values,
IF False:
cdef:
- int64_t *v
- int64_t *o
+ float64_t *v
+ float64_t *o
#GH3130
if (values.strides[1] == out.strides[1] and
- values.strides[1] == sizeof(int64_t) and
- sizeof(int64_t) * n >= 256):
+ values.strides[1] == sizeof(float64_t) and
+ sizeof(float64_t) * n >= 256):
for i from 0 <= i < n:
idx = indexer[i]
@@ -3230,7 +3296,7 @@ def take_2d_axis0_int32_int64(int32_t[:, :] values,
else:
v = &values[idx, 0]
o = &out[i, 0]
- memmove(o, v, <size_t>(sizeof(int64_t) * k))
+ memmove(o, v, <size_t>(sizeof(float64_t) * k))
return
for i from 0 <= i < n:
@@ -3244,28 +3310,28 @@ def take_2d_axis0_int32_int64(int32_t[:, :] values,
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis0_int32_float64(int32_t[:, :] values,
- ndarray[int64_t] indexer,
- float64_t[:, :] out,
- fill_value=np.nan):
+cdef inline take_2d_axis0_int16_int16_memview(int16_t[:, :] values,
+ ndarray[int64_t] indexer,
+ int16_t[:, :] out,
+ fill_value=np.nan):
cdef:
Py_ssize_t i, j, k, n, idx
- float64_t fv
+ int16_t fv
n = len(indexer)
k = values.shape[1]
fv = fill_value
- IF False:
+ IF True:
cdef:
- float64_t *v
- float64_t *o
+ int16_t *v
+ int16_t *o
#GH3130
if (values.strides[1] == out.strides[1] and
- values.strides[1] == sizeof(float64_t) and
- sizeof(float64_t) * n >= 256):
+ values.strides[1] == sizeof(int16_t) and
+ sizeof(int16_t) * n >= 256):
for i from 0 <= i < n:
idx = indexer[i]
@@ -3275,7 +3341,7 @@ def take_2d_axis0_int32_float64(int32_t[:, :] values,
else:
v = &values[idx, 0]
o = &out[i, 0]
- memmove(o, v, <size_t>(sizeof(float64_t) * k))
+ memmove(o, v, <size_t>(sizeof(int16_t) * k))
return
for i from 0 <= i < n:
@@ -3287,15 +3353,26 @@ def take_2d_axis0_int32_float64(int32_t[:, :] values,
for j from 0 <= j < k:
out[i, j] = values[idx, j]
+
+
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis0_int64_int64(int64_t[:, :] values,
+def take_2d_axis0_int16_int16(ndarray[int16_t, ndim=2] values,
ndarray[int64_t] indexer,
- int64_t[:, :] out,
+ int16_t[:, :] out,
fill_value=np.nan):
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis0_int16_int16_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
cdef:
Py_ssize_t i, j, k, n, idx
- int64_t fv
+ int16_t fv
n = len(indexer)
k = values.shape[1]
@@ -3304,13 +3381,13 @@ def take_2d_axis0_int64_int64(int64_t[:, :] values,
IF True:
cdef:
- int64_t *v
- int64_t *o
+ int16_t *v
+ int16_t *o
#GH3130
if (values.strides[1] == out.strides[1] and
- values.strides[1] == sizeof(int64_t) and
- sizeof(int64_t) * n >= 256):
+ values.strides[1] == sizeof(int16_t) and
+ sizeof(int16_t) * n >= 256):
for i from 0 <= i < n:
idx = indexer[i]
@@ -3320,7 +3397,7 @@ def take_2d_axis0_int64_int64(int64_t[:, :] values,
else:
v = &values[idx, 0]
o = &out[i, 0]
- memmove(o, v, <size_t>(sizeof(int64_t) * k))
+ memmove(o, v, <size_t>(sizeof(int16_t) * k))
return
for i from 0 <= i < n:
@@ -3334,13 +3411,13 @@ def take_2d_axis0_int64_int64(int64_t[:, :] values,
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis0_int64_float64(int64_t[:, :] values,
- ndarray[int64_t] indexer,
- float64_t[:, :] out,
- fill_value=np.nan):
+cdef inline take_2d_axis0_int16_int32_memview(int16_t[:, :] values,
+ ndarray[int64_t] indexer,
+ int32_t[:, :] out,
+ fill_value=np.nan):
cdef:
Py_ssize_t i, j, k, n, idx
- float64_t fv
+ int32_t fv
n = len(indexer)
k = values.shape[1]
@@ -3349,13 +3426,13 @@ def take_2d_axis0_int64_float64(int64_t[:, :] values,
IF False:
cdef:
- float64_t *v
- float64_t *o
+ int32_t *v
+ int32_t *o
#GH3130
if (values.strides[1] == out.strides[1] and
- values.strides[1] == sizeof(float64_t) and
- sizeof(float64_t) * n >= 256):
+ values.strides[1] == sizeof(int32_t) and
+ sizeof(int32_t) * n >= 256):
for i from 0 <= i < n:
idx = indexer[i]
@@ -3365,7 +3442,7 @@ def take_2d_axis0_int64_float64(int64_t[:, :] values,
else:
v = &values[idx, 0]
o = &out[i, 0]
- memmove(o, v, <size_t>(sizeof(float64_t) * k))
+ memmove(o, v, <size_t>(sizeof(int32_t) * k))
return
for i from 0 <= i < n:
@@ -3377,30 +3454,41 @@ def take_2d_axis0_int64_float64(int64_t[:, :] values,
for j from 0 <= j < k:
out[i, j] = values[idx, j]
+
+
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis0_float32_float32(float32_t[:, :] values,
+def take_2d_axis0_int16_int32(ndarray[int16_t, ndim=2] values,
ndarray[int64_t] indexer,
- float32_t[:, :] out,
+ int32_t[:, :] out,
fill_value=np.nan):
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis0_int16_int32_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
cdef:
Py_ssize_t i, j, k, n, idx
- float32_t fv
+ int32_t fv
n = len(indexer)
k = values.shape[1]
fv = fill_value
- IF True:
+ IF False:
cdef:
- float32_t *v
- float32_t *o
+ int32_t *v
+ int32_t *o
#GH3130
if (values.strides[1] == out.strides[1] and
- values.strides[1] == sizeof(float32_t) and
- sizeof(float32_t) * n >= 256):
+ values.strides[1] == sizeof(int32_t) and
+ sizeof(int32_t) * n >= 256):
for i from 0 <= i < n:
idx = indexer[i]
@@ -3410,7 +3498,7 @@ def take_2d_axis0_float32_float32(float32_t[:, :] values,
else:
v = &values[idx, 0]
o = &out[i, 0]
- memmove(o, v, <size_t>(sizeof(float32_t) * k))
+ memmove(o, v, <size_t>(sizeof(int32_t) * k))
return
for i from 0 <= i < n:
@@ -3424,13 +3512,13 @@ def take_2d_axis0_float32_float32(float32_t[:, :] values,
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis0_float32_float64(float32_t[:, :] values,
- ndarray[int64_t] indexer,
- float64_t[:, :] out,
- fill_value=np.nan):
+cdef inline take_2d_axis0_int16_int64_memview(int16_t[:, :] values,
+ ndarray[int64_t] indexer,
+ int64_t[:, :] out,
+ fill_value=np.nan):
cdef:
Py_ssize_t i, j, k, n, idx
- float64_t fv
+ int64_t fv
n = len(indexer)
k = values.shape[1]
@@ -3439,9 +3527,166 @@ def take_2d_axis0_float32_float64(float32_t[:, :] values,
IF False:
cdef:
- float64_t *v
- float64_t *o
-
+ int64_t *v
+ int64_t *o
+
+ #GH3130
+ if (values.strides[1] == out.strides[1] and
+ values.strides[1] == sizeof(int64_t) and
+ sizeof(int64_t) * n >= 256):
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ v = &values[idx, 0]
+ o = &out[i, 0]
+ memmove(o, v, <size_t>(sizeof(int64_t) * k))
+ return
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ for j from 0 <= j < k:
+ out[i, j] = values[idx, j]
+
+
+
+@cython.wraparound(False)
+@cython.boundscheck(False)
+def take_2d_axis0_int16_int64(ndarray[int16_t, ndim=2] values,
+ ndarray[int64_t] indexer,
+ int64_t[:, :] out,
+ fill_value=np.nan):
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis0_int16_int64_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ int64_t fv
+
+ n = len(indexer)
+ k = values.shape[1]
+
+ fv = fill_value
+
+ IF False:
+ cdef:
+ int64_t *v
+ int64_t *o
+
+ #GH3130
+ if (values.strides[1] == out.strides[1] and
+ values.strides[1] == sizeof(int64_t) and
+ sizeof(int64_t) * n >= 256):
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ v = &values[idx, 0]
+ o = &out[i, 0]
+ memmove(o, v, <size_t>(sizeof(int64_t) * k))
+ return
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ for j from 0 <= j < k:
+ out[i, j] = values[idx, j]
+
+@cython.wraparound(False)
+@cython.boundscheck(False)
+cdef inline take_2d_axis0_int16_float64_memview(int16_t[:, :] values,
+ ndarray[int64_t] indexer,
+ float64_t[:, :] out,
+ fill_value=np.nan):
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ float64_t fv
+
+ n = len(indexer)
+ k = values.shape[1]
+
+ fv = fill_value
+
+ IF False:
+ cdef:
+ float64_t *v
+ float64_t *o
+
+ #GH3130
+ if (values.strides[1] == out.strides[1] and
+ values.strides[1] == sizeof(float64_t) and
+ sizeof(float64_t) * n >= 256):
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ v = &values[idx, 0]
+ o = &out[i, 0]
+ memmove(o, v, <size_t>(sizeof(float64_t) * k))
+ return
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ for j from 0 <= j < k:
+ out[i, j] = values[idx, j]
+
+
+
+@cython.wraparound(False)
+@cython.boundscheck(False)
+def take_2d_axis0_int16_float64(ndarray[int16_t, ndim=2] values,
+ ndarray[int64_t] indexer,
+ float64_t[:, :] out,
+ fill_value=np.nan):
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis0_int16_float64_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ float64_t fv
+
+ n = len(indexer)
+ k = values.shape[1]
+
+ fv = fill_value
+
+ IF False:
+ cdef:
+ float64_t *v
+ float64_t *o
+
#GH3130
if (values.strides[1] == out.strides[1] and
values.strides[1] == sizeof(float64_t) and
@@ -3459,114 +3704,1528 @@ def take_2d_axis0_float32_float64(float32_t[:, :] values,
return
for i from 0 <= i < n:
- idx = indexer[i]
- if idx == -1:
- for j from 0 <= j < k:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ for j from 0 <= j < k:
+ out[i, j] = values[idx, j]
+
+@cython.wraparound(False)
+@cython.boundscheck(False)
+cdef inline take_2d_axis0_int32_int32_memview(int32_t[:, :] values,
+ ndarray[int64_t] indexer,
+ int32_t[:, :] out,
+ fill_value=np.nan):
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ int32_t fv
+
+ n = len(indexer)
+ k = values.shape[1]
+
+ fv = fill_value
+
+ IF True:
+ cdef:
+ int32_t *v
+ int32_t *o
+
+ #GH3130
+ if (values.strides[1] == out.strides[1] and
+ values.strides[1] == sizeof(int32_t) and
+ sizeof(int32_t) * n >= 256):
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ v = &values[idx, 0]
+ o = &out[i, 0]
+ memmove(o, v, <size_t>(sizeof(int32_t) * k))
+ return
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ for j from 0 <= j < k:
+ out[i, j] = values[idx, j]
+
+
+
+@cython.wraparound(False)
+@cython.boundscheck(False)
+def take_2d_axis0_int32_int32(ndarray[int32_t, ndim=2] values,
+ ndarray[int64_t] indexer,
+ int32_t[:, :] out,
+ fill_value=np.nan):
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis0_int32_int32_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ int32_t fv
+
+ n = len(indexer)
+ k = values.shape[1]
+
+ fv = fill_value
+
+ IF True:
+ cdef:
+ int32_t *v
+ int32_t *o
+
+ #GH3130
+ if (values.strides[1] == out.strides[1] and
+ values.strides[1] == sizeof(int32_t) and
+ sizeof(int32_t) * n >= 256):
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ v = &values[idx, 0]
+ o = &out[i, 0]
+ memmove(o, v, <size_t>(sizeof(int32_t) * k))
+ return
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ for j from 0 <= j < k:
+ out[i, j] = values[idx, j]
+
+@cython.wraparound(False)
+@cython.boundscheck(False)
+cdef inline take_2d_axis0_int32_int64_memview(int32_t[:, :] values,
+ ndarray[int64_t] indexer,
+ int64_t[:, :] out,
+ fill_value=np.nan):
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ int64_t fv
+
+ n = len(indexer)
+ k = values.shape[1]
+
+ fv = fill_value
+
+ IF False:
+ cdef:
+ int64_t *v
+ int64_t *o
+
+ #GH3130
+ if (values.strides[1] == out.strides[1] and
+ values.strides[1] == sizeof(int64_t) and
+ sizeof(int64_t) * n >= 256):
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ v = &values[idx, 0]
+ o = &out[i, 0]
+ memmove(o, v, <size_t>(sizeof(int64_t) * k))
+ return
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ for j from 0 <= j < k:
+ out[i, j] = values[idx, j]
+
+
+
+@cython.wraparound(False)
+@cython.boundscheck(False)
+def take_2d_axis0_int32_int64(ndarray[int32_t, ndim=2] values,
+ ndarray[int64_t] indexer,
+ int64_t[:, :] out,
+ fill_value=np.nan):
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis0_int32_int64_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ int64_t fv
+
+ n = len(indexer)
+ k = values.shape[1]
+
+ fv = fill_value
+
+ IF False:
+ cdef:
+ int64_t *v
+ int64_t *o
+
+ #GH3130
+ if (values.strides[1] == out.strides[1] and
+ values.strides[1] == sizeof(int64_t) and
+ sizeof(int64_t) * n >= 256):
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ v = &values[idx, 0]
+ o = &out[i, 0]
+ memmove(o, v, <size_t>(sizeof(int64_t) * k))
+ return
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ for j from 0 <= j < k:
+ out[i, j] = values[idx, j]
+
+@cython.wraparound(False)
+@cython.boundscheck(False)
+cdef inline take_2d_axis0_int32_float64_memview(int32_t[:, :] values,
+ ndarray[int64_t] indexer,
+ float64_t[:, :] out,
+ fill_value=np.nan):
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ float64_t fv
+
+ n = len(indexer)
+ k = values.shape[1]
+
+ fv = fill_value
+
+ IF False:
+ cdef:
+ float64_t *v
+ float64_t *o
+
+ #GH3130
+ if (values.strides[1] == out.strides[1] and
+ values.strides[1] == sizeof(float64_t) and
+ sizeof(float64_t) * n >= 256):
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ v = &values[idx, 0]
+ o = &out[i, 0]
+ memmove(o, v, <size_t>(sizeof(float64_t) * k))
+ return
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ for j from 0 <= j < k:
+ out[i, j] = values[idx, j]
+
+
+
+@cython.wraparound(False)
+@cython.boundscheck(False)
+def take_2d_axis0_int32_float64(ndarray[int32_t, ndim=2] values,
+ ndarray[int64_t] indexer,
+ float64_t[:, :] out,
+ fill_value=np.nan):
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis0_int32_float64_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ float64_t fv
+
+ n = len(indexer)
+ k = values.shape[1]
+
+ fv = fill_value
+
+ IF False:
+ cdef:
+ float64_t *v
+ float64_t *o
+
+ #GH3130
+ if (values.strides[1] == out.strides[1] and
+ values.strides[1] == sizeof(float64_t) and
+ sizeof(float64_t) * n >= 256):
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ v = &values[idx, 0]
+ o = &out[i, 0]
+ memmove(o, v, <size_t>(sizeof(float64_t) * k))
+ return
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ for j from 0 <= j < k:
+ out[i, j] = values[idx, j]
+
+@cython.wraparound(False)
+@cython.boundscheck(False)
+cdef inline take_2d_axis0_int64_int64_memview(int64_t[:, :] values,
+ ndarray[int64_t] indexer,
+ int64_t[:, :] out,
+ fill_value=np.nan):
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ int64_t fv
+
+ n = len(indexer)
+ k = values.shape[1]
+
+ fv = fill_value
+
+ IF True:
+ cdef:
+ int64_t *v
+ int64_t *o
+
+ #GH3130
+ if (values.strides[1] == out.strides[1] and
+ values.strides[1] == sizeof(int64_t) and
+ sizeof(int64_t) * n >= 256):
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ v = &values[idx, 0]
+ o = &out[i, 0]
+ memmove(o, v, <size_t>(sizeof(int64_t) * k))
+ return
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ for j from 0 <= j < k:
+ out[i, j] = values[idx, j]
+
+
+
+@cython.wraparound(False)
+@cython.boundscheck(False)
+def take_2d_axis0_int64_int64(ndarray[int64_t, ndim=2] values,
+ ndarray[int64_t] indexer,
+ int64_t[:, :] out,
+ fill_value=np.nan):
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis0_int64_int64_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ int64_t fv
+
+ n = len(indexer)
+ k = values.shape[1]
+
+ fv = fill_value
+
+ IF True:
+ cdef:
+ int64_t *v
+ int64_t *o
+
+ #GH3130
+ if (values.strides[1] == out.strides[1] and
+ values.strides[1] == sizeof(int64_t) and
+ sizeof(int64_t) * n >= 256):
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ v = &values[idx, 0]
+ o = &out[i, 0]
+ memmove(o, v, <size_t>(sizeof(int64_t) * k))
+ return
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ for j from 0 <= j < k:
+ out[i, j] = values[idx, j]
+
+@cython.wraparound(False)
+@cython.boundscheck(False)
+cdef inline take_2d_axis0_int64_float64_memview(int64_t[:, :] values,
+ ndarray[int64_t] indexer,
+ float64_t[:, :] out,
+ fill_value=np.nan):
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ float64_t fv
+
+ n = len(indexer)
+ k = values.shape[1]
+
+ fv = fill_value
+
+ IF False:
+ cdef:
+ float64_t *v
+ float64_t *o
+
+ #GH3130
+ if (values.strides[1] == out.strides[1] and
+ values.strides[1] == sizeof(float64_t) and
+ sizeof(float64_t) * n >= 256):
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ v = &values[idx, 0]
+ o = &out[i, 0]
+ memmove(o, v, <size_t>(sizeof(float64_t) * k))
+ return
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ for j from 0 <= j < k:
+ out[i, j] = values[idx, j]
+
+
+
+@cython.wraparound(False)
+@cython.boundscheck(False)
+def take_2d_axis0_int64_float64(ndarray[int64_t, ndim=2] values,
+ ndarray[int64_t] indexer,
+ float64_t[:, :] out,
+ fill_value=np.nan):
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis0_int64_float64_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ float64_t fv
+
+ n = len(indexer)
+ k = values.shape[1]
+
+ fv = fill_value
+
+ IF False:
+ cdef:
+ float64_t *v
+ float64_t *o
+
+ #GH3130
+ if (values.strides[1] == out.strides[1] and
+ values.strides[1] == sizeof(float64_t) and
+ sizeof(float64_t) * n >= 256):
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ v = &values[idx, 0]
+ o = &out[i, 0]
+ memmove(o, v, <size_t>(sizeof(float64_t) * k))
+ return
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ for j from 0 <= j < k:
+ out[i, j] = values[idx, j]
+
+@cython.wraparound(False)
+@cython.boundscheck(False)
+cdef inline take_2d_axis0_float32_float32_memview(float32_t[:, :] values,
+ ndarray[int64_t] indexer,
+ float32_t[:, :] out,
+ fill_value=np.nan):
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ float32_t fv
+
+ n = len(indexer)
+ k = values.shape[1]
+
+ fv = fill_value
+
+ IF True:
+ cdef:
+ float32_t *v
+ float32_t *o
+
+ #GH3130
+ if (values.strides[1] == out.strides[1] and
+ values.strides[1] == sizeof(float32_t) and
+ sizeof(float32_t) * n >= 256):
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ v = &values[idx, 0]
+ o = &out[i, 0]
+ memmove(o, v, <size_t>(sizeof(float32_t) * k))
+ return
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ for j from 0 <= j < k:
+ out[i, j] = values[idx, j]
+
+
+
+@cython.wraparound(False)
+@cython.boundscheck(False)
+def take_2d_axis0_float32_float32(ndarray[float32_t, ndim=2] values,
+ ndarray[int64_t] indexer,
+ float32_t[:, :] out,
+ fill_value=np.nan):
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis0_float32_float32_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ float32_t fv
+
+ n = len(indexer)
+ k = values.shape[1]
+
+ fv = fill_value
+
+ IF True:
+ cdef:
+ float32_t *v
+ float32_t *o
+
+ #GH3130
+ if (values.strides[1] == out.strides[1] and
+ values.strides[1] == sizeof(float32_t) and
+ sizeof(float32_t) * n >= 256):
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ v = &values[idx, 0]
+ o = &out[i, 0]
+ memmove(o, v, <size_t>(sizeof(float32_t) * k))
+ return
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ for j from 0 <= j < k:
+ out[i, j] = values[idx, j]
+
+@cython.wraparound(False)
+@cython.boundscheck(False)
+cdef inline take_2d_axis0_float32_float64_memview(float32_t[:, :] values,
+ ndarray[int64_t] indexer,
+ float64_t[:, :] out,
+ fill_value=np.nan):
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ float64_t fv
+
+ n = len(indexer)
+ k = values.shape[1]
+
+ fv = fill_value
+
+ IF False:
+ cdef:
+ float64_t *v
+ float64_t *o
+
+ #GH3130
+ if (values.strides[1] == out.strides[1] and
+ values.strides[1] == sizeof(float64_t) and
+ sizeof(float64_t) * n >= 256):
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ v = &values[idx, 0]
+ o = &out[i, 0]
+ memmove(o, v, <size_t>(sizeof(float64_t) * k))
+ return
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ for j from 0 <= j < k:
+ out[i, j] = values[idx, j]
+
+
+
+@cython.wraparound(False)
+@cython.boundscheck(False)
+def take_2d_axis0_float32_float64(ndarray[float32_t, ndim=2] values,
+ ndarray[int64_t] indexer,
+ float64_t[:, :] out,
+ fill_value=np.nan):
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis0_float32_float64_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ float64_t fv
+
+ n = len(indexer)
+ k = values.shape[1]
+
+ fv = fill_value
+
+ IF False:
+ cdef:
+ float64_t *v
+ float64_t *o
+
+ #GH3130
+ if (values.strides[1] == out.strides[1] and
+ values.strides[1] == sizeof(float64_t) and
+ sizeof(float64_t) * n >= 256):
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ v = &values[idx, 0]
+ o = &out[i, 0]
+ memmove(o, v, <size_t>(sizeof(float64_t) * k))
+ return
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ for j from 0 <= j < k:
+ out[i, j] = values[idx, j]
+
+@cython.wraparound(False)
+@cython.boundscheck(False)
+cdef inline take_2d_axis0_float64_float64_memview(float64_t[:, :] values,
+ ndarray[int64_t] indexer,
+ float64_t[:, :] out,
+ fill_value=np.nan):
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ float64_t fv
+
+ n = len(indexer)
+ k = values.shape[1]
+
+ fv = fill_value
+
+ IF True:
+ cdef:
+ float64_t *v
+ float64_t *o
+
+ #GH3130
+ if (values.strides[1] == out.strides[1] and
+ values.strides[1] == sizeof(float64_t) and
+ sizeof(float64_t) * n >= 256):
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ v = &values[idx, 0]
+ o = &out[i, 0]
+ memmove(o, v, <size_t>(sizeof(float64_t) * k))
+ return
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ for j from 0 <= j < k:
+ out[i, j] = values[idx, j]
+
+
+
+@cython.wraparound(False)
+@cython.boundscheck(False)
+def take_2d_axis0_float64_float64(ndarray[float64_t, ndim=2] values,
+ ndarray[int64_t] indexer,
+ float64_t[:, :] out,
+ fill_value=np.nan):
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis0_float64_float64_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ float64_t fv
+
+ n = len(indexer)
+ k = values.shape[1]
+
+ fv = fill_value
+
+ IF True:
+ cdef:
+ float64_t *v
+ float64_t *o
+
+ #GH3130
+ if (values.strides[1] == out.strides[1] and
+ values.strides[1] == sizeof(float64_t) and
+ sizeof(float64_t) * n >= 256):
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ v = &values[idx, 0]
+ o = &out[i, 0]
+ memmove(o, v, <size_t>(sizeof(float64_t) * k))
+ return
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ for j from 0 <= j < k:
+ out[i, j] = values[idx, j]
+
+@cython.wraparound(False)
+@cython.boundscheck(False)
+cdef inline take_2d_axis0_object_object_memview(object[:, :] values,
+ ndarray[int64_t] indexer,
+ object[:, :] out,
+ fill_value=np.nan):
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ object fv
+
+ n = len(indexer)
+ k = values.shape[1]
+
+ fv = fill_value
+
+ IF False:
+ cdef:
+ object *v
+ object *o
+
+ #GH3130
+ if (values.strides[1] == out.strides[1] and
+ values.strides[1] == sizeof(object) and
+ sizeof(object) * n >= 256):
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ v = &values[idx, 0]
+ o = &out[i, 0]
+ memmove(o, v, <size_t>(sizeof(object) * k))
+ return
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ for j from 0 <= j < k:
+ out[i, j] = values[idx, j]
+
+
+
+@cython.wraparound(False)
+@cython.boundscheck(False)
+def take_2d_axis0_object_object(ndarray[object, ndim=2] values,
+ ndarray[int64_t] indexer,
+ object[:, :] out,
+ fill_value=np.nan):
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis0_object_object_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ object fv
+
+ n = len(indexer)
+ k = values.shape[1]
+
+ fv = fill_value
+
+ IF False:
+ cdef:
+ object *v
+ object *o
+
+ #GH3130
+ if (values.strides[1] == out.strides[1] and
+ values.strides[1] == sizeof(object) and
+ sizeof(object) * n >= 256):
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ v = &values[idx, 0]
+ o = &out[i, 0]
+ memmove(o, v, <size_t>(sizeof(object) * k))
+ return
+
+ for i from 0 <= i < n:
+ idx = indexer[i]
+ if idx == -1:
+ for j from 0 <= j < k:
+ out[i, j] = fv
+ else:
+ for j from 0 <= j < k:
+ out[i, j] = values[idx, j]
+
+
+@cython.wraparound(False)
+@cython.boundscheck(False)
+cdef inline take_2d_axis1_bool_bool_memview(uint8_t[:, :] values,
+ ndarray[int64_t] indexer,
+ uint8_t[:, :] out,
+ fill_value=np.nan):
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ uint8_t fv
+
+ n = len(values)
+ k = len(indexer)
+
+ if n == 0 or k == 0:
+ return
+
+ fv = fill_value
+
+ for i from 0 <= i < n:
+ for j from 0 <= j < k:
+ idx = indexer[j]
+ if idx == -1:
+ out[i, j] = fv
+ else:
+ out[i, j] = values[i, idx]
+
+
+@cython.wraparound(False)
+@cython.boundscheck(False)
+def take_2d_axis1_bool_bool(ndarray[uint8_t, ndim=2] values,
+ ndarray[int64_t] indexer,
+ uint8_t[:, :] out,
+ fill_value=np.nan):
+
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis1_bool_bool_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ uint8_t fv
+
+ n = len(values)
+ k = len(indexer)
+
+ if n == 0 or k == 0:
+ return
+
+ fv = fill_value
+
+ for i from 0 <= i < n:
+ for j from 0 <= j < k:
+ idx = indexer[j]
+ if idx == -1:
+ out[i, j] = fv
+ else:
+ out[i, j] = values[i, idx]
+@cython.wraparound(False)
+@cython.boundscheck(False)
+cdef inline take_2d_axis1_bool_object_memview(uint8_t[:, :] values,
+ ndarray[int64_t] indexer,
+ object[:, :] out,
+ fill_value=np.nan):
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ object fv
+
+ n = len(values)
+ k = len(indexer)
+
+ if n == 0 or k == 0:
+ return
+
+ fv = fill_value
+
+ for i from 0 <= i < n:
+ for j from 0 <= j < k:
+ idx = indexer[j]
+ if idx == -1:
+ out[i, j] = fv
+ else:
+ out[i, j] = True if values[i, idx] > 0 else False
+
+
+@cython.wraparound(False)
+@cython.boundscheck(False)
+def take_2d_axis1_bool_object(ndarray[uint8_t, ndim=2] values,
+ ndarray[int64_t] indexer,
+ object[:, :] out,
+ fill_value=np.nan):
+
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis1_bool_object_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ object fv
+
+ n = len(values)
+ k = len(indexer)
+
+ if n == 0 or k == 0:
+ return
+
+ fv = fill_value
+
+ for i from 0 <= i < n:
+ for j from 0 <= j < k:
+ idx = indexer[j]
+ if idx == -1:
+ out[i, j] = fv
+ else:
+ out[i, j] = True if values[i, idx] > 0 else False
+@cython.wraparound(False)
+@cython.boundscheck(False)
+cdef inline take_2d_axis1_int8_int8_memview(int8_t[:, :] values,
+ ndarray[int64_t] indexer,
+ int8_t[:, :] out,
+ fill_value=np.nan):
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ int8_t fv
+
+ n = len(values)
+ k = len(indexer)
+
+ if n == 0 or k == 0:
+ return
+
+ fv = fill_value
+
+ for i from 0 <= i < n:
+ for j from 0 <= j < k:
+ idx = indexer[j]
+ if idx == -1:
+ out[i, j] = fv
+ else:
+ out[i, j] = values[i, idx]
+
+
+@cython.wraparound(False)
+@cython.boundscheck(False)
+def take_2d_axis1_int8_int8(ndarray[int8_t, ndim=2] values,
+ ndarray[int64_t] indexer,
+ int8_t[:, :] out,
+ fill_value=np.nan):
+
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis1_int8_int8_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ int8_t fv
+
+ n = len(values)
+ k = len(indexer)
+
+ if n == 0 or k == 0:
+ return
+
+ fv = fill_value
+
+ for i from 0 <= i < n:
+ for j from 0 <= j < k:
+ idx = indexer[j]
+ if idx == -1:
+ out[i, j] = fv
+ else:
+ out[i, j] = values[i, idx]
+@cython.wraparound(False)
+@cython.boundscheck(False)
+cdef inline take_2d_axis1_int8_int32_memview(int8_t[:, :] values,
+ ndarray[int64_t] indexer,
+ int32_t[:, :] out,
+ fill_value=np.nan):
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ int32_t fv
+
+ n = len(values)
+ k = len(indexer)
+
+ if n == 0 or k == 0:
+ return
+
+ fv = fill_value
+
+ for i from 0 <= i < n:
+ for j from 0 <= j < k:
+ idx = indexer[j]
+ if idx == -1:
+ out[i, j] = fv
+ else:
+ out[i, j] = values[i, idx]
+
+
+@cython.wraparound(False)
+@cython.boundscheck(False)
+def take_2d_axis1_int8_int32(ndarray[int8_t, ndim=2] values,
+ ndarray[int64_t] indexer,
+ int32_t[:, :] out,
+ fill_value=np.nan):
+
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis1_int8_int32_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ int32_t fv
+
+ n = len(values)
+ k = len(indexer)
+
+ if n == 0 or k == 0:
+ return
+
+ fv = fill_value
+
+ for i from 0 <= i < n:
+ for j from 0 <= j < k:
+ idx = indexer[j]
+ if idx == -1:
+ out[i, j] = fv
+ else:
+ out[i, j] = values[i, idx]
+@cython.wraparound(False)
+@cython.boundscheck(False)
+cdef inline take_2d_axis1_int8_int64_memview(int8_t[:, :] values,
+ ndarray[int64_t] indexer,
+ int64_t[:, :] out,
+ fill_value=np.nan):
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ int64_t fv
+
+ n = len(values)
+ k = len(indexer)
+
+ if n == 0 or k == 0:
+ return
+
+ fv = fill_value
+
+ for i from 0 <= i < n:
+ for j from 0 <= j < k:
+ idx = indexer[j]
+ if idx == -1:
+ out[i, j] = fv
+ else:
+ out[i, j] = values[i, idx]
+
+
+@cython.wraparound(False)
+@cython.boundscheck(False)
+def take_2d_axis1_int8_int64(ndarray[int8_t, ndim=2] values,
+ ndarray[int64_t] indexer,
+ int64_t[:, :] out,
+ fill_value=np.nan):
+
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis1_int8_int64_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ int64_t fv
+
+ n = len(values)
+ k = len(indexer)
+
+ if n == 0 or k == 0:
+ return
+
+ fv = fill_value
+
+ for i from 0 <= i < n:
+ for j from 0 <= j < k:
+ idx = indexer[j]
+ if idx == -1:
+ out[i, j] = fv
+ else:
+ out[i, j] = values[i, idx]
+@cython.wraparound(False)
+@cython.boundscheck(False)
+cdef inline take_2d_axis1_int8_float64_memview(int8_t[:, :] values,
+ ndarray[int64_t] indexer,
+ float64_t[:, :] out,
+ fill_value=np.nan):
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ float64_t fv
+
+ n = len(values)
+ k = len(indexer)
+
+ if n == 0 or k == 0:
+ return
+
+ fv = fill_value
+
+ for i from 0 <= i < n:
+ for j from 0 <= j < k:
+ idx = indexer[j]
+ if idx == -1:
+ out[i, j] = fv
+ else:
+ out[i, j] = values[i, idx]
+
+
+@cython.wraparound(False)
+@cython.boundscheck(False)
+def take_2d_axis1_int8_float64(ndarray[int8_t, ndim=2] values,
+ ndarray[int64_t] indexer,
+ float64_t[:, :] out,
+ fill_value=np.nan):
+
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis1_int8_float64_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ float64_t fv
+
+ n = len(values)
+ k = len(indexer)
+
+ if n == 0 or k == 0:
+ return
+
+ fv = fill_value
+
+ for i from 0 <= i < n:
+ for j from 0 <= j < k:
+ idx = indexer[j]
+ if idx == -1:
+ out[i, j] = fv
+ else:
+ out[i, j] = values[i, idx]
+@cython.wraparound(False)
+@cython.boundscheck(False)
+cdef inline take_2d_axis1_int16_int16_memview(int16_t[:, :] values,
+ ndarray[int64_t] indexer,
+ int16_t[:, :] out,
+ fill_value=np.nan):
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ int16_t fv
+
+ n = len(values)
+ k = len(indexer)
+
+ if n == 0 or k == 0:
+ return
+
+ fv = fill_value
+
+ for i from 0 <= i < n:
+ for j from 0 <= j < k:
+ idx = indexer[j]
+ if idx == -1:
+ out[i, j] = fv
+ else:
+ out[i, j] = values[i, idx]
+
+
+@cython.wraparound(False)
+@cython.boundscheck(False)
+def take_2d_axis1_int16_int16(ndarray[int16_t, ndim=2] values,
+ ndarray[int64_t] indexer,
+ int16_t[:, :] out,
+ fill_value=np.nan):
+
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis1_int16_int16_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ int16_t fv
+
+ n = len(values)
+ k = len(indexer)
+
+ if n == 0 or k == 0:
+ return
+
+ fv = fill_value
+
+ for i from 0 <= i < n:
+ for j from 0 <= j < k:
+ idx = indexer[j]
+ if idx == -1:
+ out[i, j] = fv
+ else:
+ out[i, j] = values[i, idx]
+@cython.wraparound(False)
+@cython.boundscheck(False)
+cdef inline take_2d_axis1_int16_int32_memview(int16_t[:, :] values,
+ ndarray[int64_t] indexer,
+ int32_t[:, :] out,
+ fill_value=np.nan):
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ int32_t fv
+
+ n = len(values)
+ k = len(indexer)
+
+ if n == 0 or k == 0:
+ return
+
+ fv = fill_value
+
+ for i from 0 <= i < n:
+ for j from 0 <= j < k:
+ idx = indexer[j]
+ if idx == -1:
out[i, j] = fv
- else:
- for j from 0 <= j < k:
- out[i, j] = values[idx, j]
+ else:
+ out[i, j] = values[i, idx]
+
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis0_float64_float64(float64_t[:, :] values,
+def take_2d_axis1_int16_int32(ndarray[int16_t, ndim=2] values,
ndarray[int64_t] indexer,
- float64_t[:, :] out,
+ int32_t[:, :] out,
fill_value=np.nan):
+
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis1_int16_int32_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
cdef:
Py_ssize_t i, j, k, n, idx
- float64_t fv
+ int32_t fv
- n = len(indexer)
- k = values.shape[1]
+ n = len(values)
+ k = len(indexer)
+
+ if n == 0 or k == 0:
+ return
fv = fill_value
- IF True:
- cdef:
- float64_t *v
- float64_t *o
+ for i from 0 <= i < n:
+ for j from 0 <= j < k:
+ idx = indexer[j]
+ if idx == -1:
+ out[i, j] = fv
+ else:
+ out[i, j] = values[i, idx]
+@cython.wraparound(False)
+@cython.boundscheck(False)
+cdef inline take_2d_axis1_int16_int64_memview(int16_t[:, :] values,
+ ndarray[int64_t] indexer,
+ int64_t[:, :] out,
+ fill_value=np.nan):
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ int64_t fv
- #GH3130
- if (values.strides[1] == out.strides[1] and
- values.strides[1] == sizeof(float64_t) and
- sizeof(float64_t) * n >= 256):
+ n = len(values)
+ k = len(indexer)
- for i from 0 <= i < n:
- idx = indexer[i]
- if idx == -1:
- for j from 0 <= j < k:
- out[i, j] = fv
- else:
- v = &values[idx, 0]
- o = &out[i, 0]
- memmove(o, v, <size_t>(sizeof(float64_t) * k))
- return
+ if n == 0 or k == 0:
+ return
+
+ fv = fill_value
for i from 0 <= i < n:
- idx = indexer[i]
- if idx == -1:
- for j from 0 <= j < k:
+ for j from 0 <= j < k:
+ idx = indexer[j]
+ if idx == -1:
out[i, j] = fv
- else:
- for j from 0 <= j < k:
- out[i, j] = values[idx, j]
+ else:
+ out[i, j] = values[i, idx]
+
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis0_object_object(object[:, :] values,
+def take_2d_axis1_int16_int64(ndarray[int16_t, ndim=2] values,
ndarray[int64_t] indexer,
- object[:, :] out,
+ int64_t[:, :] out,
fill_value=np.nan):
+
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis1_int16_int64_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
cdef:
Py_ssize_t i, j, k, n, idx
- object fv
+ int64_t fv
- n = len(indexer)
- k = values.shape[1]
+ n = len(values)
+ k = len(indexer)
+
+ if n == 0 or k == 0:
+ return
fv = fill_value
- IF False:
- cdef:
- object *v
- object *o
+ for i from 0 <= i < n:
+ for j from 0 <= j < k:
+ idx = indexer[j]
+ if idx == -1:
+ out[i, j] = fv
+ else:
+ out[i, j] = values[i, idx]
+@cython.wraparound(False)
+@cython.boundscheck(False)
+cdef inline take_2d_axis1_int16_float64_memview(int16_t[:, :] values,
+ ndarray[int64_t] indexer,
+ float64_t[:, :] out,
+ fill_value=np.nan):
+ cdef:
+ Py_ssize_t i, j, k, n, idx
+ float64_t fv
- #GH3130
- if (values.strides[1] == out.strides[1] and
- values.strides[1] == sizeof(object) and
- sizeof(object) * n >= 256):
+ n = len(values)
+ k = len(indexer)
- for i from 0 <= i < n:
- idx = indexer[i]
- if idx == -1:
- for j from 0 <= j < k:
- out[i, j] = fv
- else:
- v = &values[idx, 0]
- o = &out[i, 0]
- memmove(o, v, <size_t>(sizeof(object) * k))
- return
+ if n == 0 or k == 0:
+ return
+
+ fv = fill_value
for i from 0 <= i < n:
- idx = indexer[i]
- if idx == -1:
- for j from 0 <= j < k:
+ for j from 0 <= j < k:
+ idx = indexer[j]
+ if idx == -1:
out[i, j] = fv
- else:
- for j from 0 <= j < k:
- out[i, j] = values[idx, j]
+ else:
+ out[i, j] = values[i, idx]
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis1_bool_bool(uint8_t[:, :] values,
+def take_2d_axis1_int16_float64(ndarray[int16_t, ndim=2] values,
ndarray[int64_t] indexer,
- uint8_t[:, :] out,
+ float64_t[:, :] out,
fill_value=np.nan):
+
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis1_int16_float64_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
cdef:
Py_ssize_t i, j, k, n, idx
- uint8_t fv
+ float64_t fv
n = len(values)
k = len(indexer)
@@ -3583,16 +5242,15 @@ def take_2d_axis1_bool_bool(uint8_t[:, :] values,
out[i, j] = fv
else:
out[i, j] = values[i, idx]
-
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis1_bool_object(uint8_t[:, :] values,
- ndarray[int64_t] indexer,
- object[:, :] out,
- fill_value=np.nan):
+cdef inline take_2d_axis1_int32_int32_memview(int32_t[:, :] values,
+ ndarray[int64_t] indexer,
+ int32_t[:, :] out,
+ fill_value=np.nan):
cdef:
Py_ssize_t i, j, k, n, idx
- object fv
+ int32_t fv
n = len(values)
k = len(indexer)
@@ -3608,17 +5266,28 @@ def take_2d_axis1_bool_object(uint8_t[:, :] values,
if idx == -1:
out[i, j] = fv
else:
- out[i, j] = True if values[i, idx] > 0 else False
+ out[i, j] = values[i, idx]
+
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis1_int8_int8(int8_t[:, :] values,
+def take_2d_axis1_int32_int32(ndarray[int32_t, ndim=2] values,
ndarray[int64_t] indexer,
- int8_t[:, :] out,
+ int32_t[:, :] out,
fill_value=np.nan):
+
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis1_int32_int32_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
cdef:
Py_ssize_t i, j, k, n, idx
- int8_t fv
+ int32_t fv
n = len(values)
k = len(indexer)
@@ -3635,16 +5304,15 @@ def take_2d_axis1_int8_int8(int8_t[:, :] values,
out[i, j] = fv
else:
out[i, j] = values[i, idx]
-
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis1_int8_int32(int8_t[:, :] values,
- ndarray[int64_t] indexer,
- int32_t[:, :] out,
- fill_value=np.nan):
+cdef inline take_2d_axis1_int32_int64_memview(int32_t[:, :] values,
+ ndarray[int64_t] indexer,
+ int64_t[:, :] out,
+ fill_value=np.nan):
cdef:
Py_ssize_t i, j, k, n, idx
- int32_t fv
+ int64_t fv
n = len(values)
k = len(indexer)
@@ -3662,12 +5330,23 @@ def take_2d_axis1_int8_int32(int8_t[:, :] values,
else:
out[i, j] = values[i, idx]
+
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis1_int8_int64(int8_t[:, :] values,
+def take_2d_axis1_int32_int64(ndarray[int32_t, ndim=2] values,
ndarray[int64_t] indexer,
int64_t[:, :] out,
fill_value=np.nan):
+
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis1_int32_int64_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
cdef:
Py_ssize_t i, j, k, n, idx
int64_t fv
@@ -3687,13 +5366,12 @@ def take_2d_axis1_int8_int64(int8_t[:, :] values,
out[i, j] = fv
else:
out[i, j] = values[i, idx]
-
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis1_int8_float64(int8_t[:, :] values,
- ndarray[int64_t] indexer,
- float64_t[:, :] out,
- fill_value=np.nan):
+cdef inline take_2d_axis1_int32_float64_memview(int32_t[:, :] values,
+ ndarray[int64_t] indexer,
+ float64_t[:, :] out,
+ fill_value=np.nan):
cdef:
Py_ssize_t i, j, k, n, idx
float64_t fv
@@ -3714,15 +5392,26 @@ def take_2d_axis1_int8_float64(int8_t[:, :] values,
else:
out[i, j] = values[i, idx]
+
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis1_int16_int16(int16_t[:, :] values,
+def take_2d_axis1_int32_float64(ndarray[int32_t, ndim=2] values,
ndarray[int64_t] indexer,
- int16_t[:, :] out,
+ float64_t[:, :] out,
fill_value=np.nan):
+
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis1_int32_float64_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
cdef:
Py_ssize_t i, j, k, n, idx
- int16_t fv
+ float64_t fv
n = len(values)
k = len(indexer)
@@ -3739,16 +5428,15 @@ def take_2d_axis1_int16_int16(int16_t[:, :] values,
out[i, j] = fv
else:
out[i, j] = values[i, idx]
-
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis1_int16_int32(int16_t[:, :] values,
- ndarray[int64_t] indexer,
- int32_t[:, :] out,
- fill_value=np.nan):
+cdef inline take_2d_axis1_int64_int64_memview(int64_t[:, :] values,
+ ndarray[int64_t] indexer,
+ int64_t[:, :] out,
+ fill_value=np.nan):
cdef:
Py_ssize_t i, j, k, n, idx
- int32_t fv
+ int64_t fv
n = len(values)
k = len(indexer)
@@ -3766,12 +5454,23 @@ def take_2d_axis1_int16_int32(int16_t[:, :] values,
else:
out[i, j] = values[i, idx]
+
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis1_int16_int64(int16_t[:, :] values,
+def take_2d_axis1_int64_int64(ndarray[int64_t, ndim=2] values,
ndarray[int64_t] indexer,
int64_t[:, :] out,
fill_value=np.nan):
+
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis1_int64_int64_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
cdef:
Py_ssize_t i, j, k, n, idx
int64_t fv
@@ -3791,13 +5490,12 @@ def take_2d_axis1_int16_int64(int16_t[:, :] values,
out[i, j] = fv
else:
out[i, j] = values[i, idx]
-
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis1_int16_float64(int16_t[:, :] values,
- ndarray[int64_t] indexer,
- float64_t[:, :] out,
- fill_value=np.nan):
+cdef inline take_2d_axis1_int64_float64_memview(int64_t[:, :] values,
+ ndarray[int64_t] indexer,
+ float64_t[:, :] out,
+ fill_value=np.nan):
cdef:
Py_ssize_t i, j, k, n, idx
float64_t fv
@@ -3818,15 +5516,26 @@ def take_2d_axis1_int16_float64(int16_t[:, :] values,
else:
out[i, j] = values[i, idx]
+
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis1_int32_int32(int32_t[:, :] values,
+def take_2d_axis1_int64_float64(ndarray[int64_t, ndim=2] values,
ndarray[int64_t] indexer,
- int32_t[:, :] out,
+ float64_t[:, :] out,
fill_value=np.nan):
+
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis1_int64_float64_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
cdef:
Py_ssize_t i, j, k, n, idx
- int32_t fv
+ float64_t fv
n = len(values)
k = len(indexer)
@@ -3843,16 +5552,15 @@ def take_2d_axis1_int32_int32(int32_t[:, :] values,
out[i, j] = fv
else:
out[i, j] = values[i, idx]
-
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis1_int32_int64(int32_t[:, :] values,
- ndarray[int64_t] indexer,
- int64_t[:, :] out,
- fill_value=np.nan):
+cdef inline take_2d_axis1_float32_float32_memview(float32_t[:, :] values,
+ ndarray[int64_t] indexer,
+ float32_t[:, :] out,
+ fill_value=np.nan):
cdef:
Py_ssize_t i, j, k, n, idx
- int64_t fv
+ float32_t fv
n = len(values)
k = len(indexer)
@@ -3870,15 +5578,26 @@ def take_2d_axis1_int32_int64(int32_t[:, :] values,
else:
out[i, j] = values[i, idx]
+
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis1_int32_float64(int32_t[:, :] values,
+def take_2d_axis1_float32_float32(ndarray[float32_t, ndim=2] values,
ndarray[int64_t] indexer,
- float64_t[:, :] out,
+ float32_t[:, :] out,
fill_value=np.nan):
+
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis1_float32_float32_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
cdef:
Py_ssize_t i, j, k, n, idx
- float64_t fv
+ float32_t fv
n = len(values)
k = len(indexer)
@@ -3895,16 +5614,15 @@ def take_2d_axis1_int32_float64(int32_t[:, :] values,
out[i, j] = fv
else:
out[i, j] = values[i, idx]
-
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis1_int64_int64(int64_t[:, :] values,
- ndarray[int64_t] indexer,
- int64_t[:, :] out,
- fill_value=np.nan):
+cdef inline take_2d_axis1_float32_float64_memview(float32_t[:, :] values,
+ ndarray[int64_t] indexer,
+ float64_t[:, :] out,
+ fill_value=np.nan):
cdef:
Py_ssize_t i, j, k, n, idx
- int64_t fv
+ float64_t fv
n = len(values)
k = len(indexer)
@@ -3922,12 +5640,23 @@ def take_2d_axis1_int64_int64(int64_t[:, :] values,
else:
out[i, j] = values[i, idx]
+
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis1_int64_float64(int64_t[:, :] values,
+def take_2d_axis1_float32_float64(ndarray[float32_t, ndim=2] values,
ndarray[int64_t] indexer,
float64_t[:, :] out,
fill_value=np.nan):
+
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis1_float32_float64_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
cdef:
Py_ssize_t i, j, k, n, idx
float64_t fv
@@ -3947,16 +5676,15 @@ def take_2d_axis1_int64_float64(int64_t[:, :] values,
out[i, j] = fv
else:
out[i, j] = values[i, idx]
-
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis1_float32_float32(float32_t[:, :] values,
- ndarray[int64_t] indexer,
- float32_t[:, :] out,
- fill_value=np.nan):
+cdef inline take_2d_axis1_float64_float64_memview(float64_t[:, :] values,
+ ndarray[int64_t] indexer,
+ float64_t[:, :] out,
+ fill_value=np.nan):
cdef:
Py_ssize_t i, j, k, n, idx
- float32_t fv
+ float64_t fv
n = len(values)
k = len(indexer)
@@ -3974,12 +5702,23 @@ def take_2d_axis1_float32_float32(float32_t[:, :] values,
else:
out[i, j] = values[i, idx]
+
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis1_float32_float64(float32_t[:, :] values,
+def take_2d_axis1_float64_float64(ndarray[float64_t, ndim=2] values,
ndarray[int64_t] indexer,
float64_t[:, :] out,
fill_value=np.nan):
+
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis1_float64_float64_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
cdef:
Py_ssize_t i, j, k, n, idx
float64_t fv
@@ -3999,16 +5738,15 @@ def take_2d_axis1_float32_float64(float32_t[:, :] values,
out[i, j] = fv
else:
out[i, j] = values[i, idx]
-
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis1_float64_float64(float64_t[:, :] values,
- ndarray[int64_t] indexer,
- float64_t[:, :] out,
- fill_value=np.nan):
+cdef inline take_2d_axis1_object_object_memview(object[:, :] values,
+ ndarray[int64_t] indexer,
+ object[:, :] out,
+ fill_value=np.nan):
cdef:
Py_ssize_t i, j, k, n, idx
- float64_t fv
+ object fv
n = len(values)
k = len(indexer)
@@ -4026,12 +5764,23 @@ def take_2d_axis1_float64_float64(float64_t[:, :] values,
else:
out[i, j] = values[i, idx]
+
@cython.wraparound(False)
@cython.boundscheck(False)
-def take_2d_axis1_object_object(object[:, :] values,
+def take_2d_axis1_object_object(ndarray[object, ndim=2] values,
ndarray[int64_t] indexer,
object[:, :] out,
fill_value=np.nan):
+
+ if values.flags.writeable:
+ # We can call the memoryview version of the code
+ take_2d_axis1_object_object_memview(values, indexer, out,
+ fill_value=fill_value)
+ return
+
+ # We cannot use the memoryview version on readonly-buffers due to
+ # a limitation of Cython's typed memoryviews. Instead we can use
+ # the slightly slower Cython ndarray type directly.
cdef:
Py_ssize_t i, j, k, n, idx
object fv
@@ -4052,7 +5801,6 @@ def take_2d_axis1_object_object(object[:, :] values,
else:
out[i, j] = values[i, idx]
-
@cython.wraparound(False)
@cython.boundscheck(False)
def take_2d_multi_bool_bool(ndarray[uint8_t, ndim=2] values,
@@ -5784,7 +7532,8 @@ def group_ohlc_float64(ndarray[float64_t, ndim=2] out,
b = 0
if K > 1:
- raise NotImplementedError
+ raise NotImplementedError("Argument 'values' must have only "
+ "one dimension")
else:
for i in range(N):
while b < ngroups - 1 and i >= bins[b]:
@@ -5857,7 +7606,8 @@ def group_ohlc_float32(ndarray[float32_t, ndim=2] out,
b = 0
if K > 1:
- raise NotImplementedError
+ raise NotImplementedError("Argument 'values' must have only "
+ "one dimension")
else:
for i in range(N):
while b < ngroups - 1 and i >= bins[b]:
diff --git a/pandas/tests/test_common.py b/pandas/tests/test_common.py
index 0daea15e617a3..3282a36bda7b8 100644
--- a/pandas/tests/test_common.py
+++ b/pandas/tests/test_common.py
@@ -628,8 +628,9 @@ def _test_dtype(dtype, fill_value, out_dtype):
_test_dtype(np.bool_, '', np.object_)
def test_2d_with_out(self):
- def _test_dtype(dtype, can_hold_na):
+ def _test_dtype(dtype, can_hold_na, writeable=True):
data = np.random.randint(0, 2, (5, 3)).astype(dtype)
+ data.flags.writeable = writeable
indexer = [2, 1, 0, 1]
out0 = np.empty((4, 3), dtype=dtype)
@@ -660,18 +661,22 @@ def _test_dtype(dtype, can_hold_na):
# no exception o/w
data.take(indexer, out=out, axis=i)
- _test_dtype(np.float64, True)
- _test_dtype(np.float32, True)
- _test_dtype(np.uint64, False)
- _test_dtype(np.uint32, False)
- _test_dtype(np.uint16, False)
- _test_dtype(np.uint8, False)
- _test_dtype(np.int64, False)
- _test_dtype(np.int32, False)
- _test_dtype(np.int16, False)
- _test_dtype(np.int8, False)
- _test_dtype(np.object_, True)
- _test_dtype(np.bool, False)
+ for writeable in [True, False]:
+ # Check that take_nd works both with writeable arrays (in which
+ # case fast typed memoryviews implementation) and read-only
+ # arrays alike.
+ _test_dtype(np.float64, True, writeable=writeable)
+ _test_dtype(np.float32, True, writeable=writeable)
+ _test_dtype(np.uint64, False, writeable=writeable)
+ _test_dtype(np.uint32, False, writeable=writeable)
+ _test_dtype(np.uint16, False, writeable=writeable)
+ _test_dtype(np.uint8, False, writeable=writeable)
+ _test_dtype(np.int64, False, writeable=writeable)
+ _test_dtype(np.int32, False, writeable=writeable)
+ _test_dtype(np.int16, False, writeable=writeable)
+ _test_dtype(np.int8, False, writeable=writeable)
+ _test_dtype(np.object_, True, writeable=writeable)
+ _test_dtype(np.bool, False, writeable=writeable)
def test_2d_fill_nonna(self):
def _test_dtype(dtype, fill_value, out_dtype):
| This is a tentative fix for #10043. I have not run any benchmark yet. I think we should do that before considering merging this PR. Any recommended way to do it?
| https://api.github.com/repos/pandas-dev/pandas/pulls/10070 | 2015-05-06T16:57:21Z | 2015-05-08T00:06:21Z | null | 2015-05-11T09:16:04Z |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.