Skip to content
Snippets Groups Projects
Commit 9e154aa1 authored by Bert Palm's avatar Bert Palm 🎇
Browse files

make column slicing, include both bounds

parent 07cea992
No related branches found
No related tags found
2 merge requests!2Develop,!1complete rework
...@@ -8,7 +8,8 @@ from collections import OrderedDict ...@@ -8,7 +8,8 @@ from collections import OrderedDict
from pandas.core.dtypes.common import ( from pandas.core.dtypes.common import (
is_list_like, is_list_like,
is_iterator, is_iterator,
is_number is_number,
is_integer,
) )
from pandas.core.indexing import need_slice from pandas.core.indexing import need_slice
...@@ -71,9 +72,9 @@ class _LocIndexer: ...@@ -71,9 +72,9 @@ class _LocIndexer:
stop = keys.index(rslice.stop) if rslice.stop is not None else None stop = keys.index(rslice.stop) if rslice.stop is not None else None
except ValueError: except ValueError:
raise KeyError("The slice start label or the slice stop label is not present in the columns.") raise KeyError("The slice start label or the slice stop label is not present in the columns.")
if not is_number(rslice): if not is_integer(rslice) and rslice > 0:
raise TypeError("The step parameter of the slice must be numeric.") raise TypeError("The step parameter of the slice must be positive integer.")
return keys[slice(start, stop, rslice.step)] return keys[slice(start, stop + 1, rslice.step)]
class DictOfSeries: class DictOfSeries:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment