after_merge
stringlengths
28
79.6k
before_merge
stringlengths
20
79.6k
url
stringlengths
38
71
full_traceback
stringlengths
43
922k
traceback_type
stringclasses
555 values
def _reindex_non_unique(self, target): """ Create a new index with target's values (move/add/delete values as necessary) use with non-unique Index and a possibly non-unique target. Parameters ---------- target : an iterable Returns ------- new_index : pd.Index Resulting ind...
def _reindex_non_unique(self, target): """ Create a new index with target's values (move/add/delete values as necessary) use with non-unique Index and a possibly non-unique target. Parameters ---------- target : an iterable Returns ------- new_index : pd.Index Resulting ind...
https://github.com/pandas-dev/pandas/issues/13691
In [2]: s = pd.Series(0, index=pd.MultiIndex.from_product([[0], [1,2]])) In [3]: s.loc[[]] Out[3]: Series([], dtype: int64) In [4]: s = pd.Series(0, index=pd.MultiIndex.from_product([[0], [1,1]])) In [5]: s.loc[[]] --------------------------------------------------------------------------- TypeError ...
TypeError
def write_array(self, key: str, value: ArrayLike, items: Optional[Index] = None): # TODO: we only have one test that gets here, the only EA # that gets passed is DatetimeArray, and we never have # both self._filters and EA assert isinstance(value, (np.ndarray, ABCExtensionArray)), type(value) if ...
def write_array(self, key: str, value: ArrayLike, items: Optional[Index] = None): # TODO: we only have one test that gets here, the only EA # that gets passed is DatetimeArray, and we never have # both self._filters and EA assert isinstance(value, (np.ndarray, ABCExtensionArray)), type(value) if ...
https://github.com/pandas-dev/pandas/issues/20594
In [1]: import pandas as pd ...: ...: def check_roundtrip(obj): ...: with pd.HDFStore('test.h5', 'w') as store: ...: store['obj'] = obj ...: retrieved = store['obj'] ...: return obj.equals(retrieved) ...: ...: s = pd.Series([], dtype='datetime64[ns, UTC]') ...: t = pd.Series([0], dtype='date...
TypeError
def write_array(self, key: str, obj: FrameOrSeries, items: Optional[Index] = None): # TODO: we only have a few tests that get here, the only EA # that gets passed is DatetimeArray, and we never have # both self._filters and EA value = extract_array(obj, extract_numpy=True) if key in self.group: ...
def write_array(self, key: str, value: ArrayLike, items: Optional[Index] = None): # TODO: we only have one test that gets here, the only EA # that gets passed is DatetimeArray, and we never have # both self._filters and EA assert isinstance(value, (np.ndarray, ABCExtensionArray)), type(value) if ...
https://github.com/pandas-dev/pandas/issues/20594
In [1]: import pandas as pd ...: ...: def check_roundtrip(obj): ...: with pd.HDFStore('test.h5', 'w') as store: ...: store['obj'] = obj ...: retrieved = store['obj'] ...: return obj.equals(retrieved) ...: ...: s = pd.Series([], dtype='datetime64[ns, UTC]') ...: t = pd.Series([0], dtype='date...
TypeError
def write(self, obj, **kwargs): super().write(obj, **kwargs) self.write_index("index", obj.index) self.write_array("values", obj) self.attrs.name = obj.name
def write(self, obj, **kwargs): super().write(obj, **kwargs) self.write_index("index", obj.index) self.write_array("values", obj.values) self.attrs.name = obj.name
https://github.com/pandas-dev/pandas/issues/20594
In [1]: import pandas as pd ...: ...: def check_roundtrip(obj): ...: with pd.HDFStore('test.h5', 'w') as store: ...: store['obj'] = obj ...: retrieved = store['obj'] ...: return obj.equals(retrieved) ...: ...: s = pd.Series([], dtype='datetime64[ns, UTC]') ...: t = pd.Series([0], dtype='date...
TypeError
def maybe_casted_values(index, codes=None): """ Convert an index, given directly or as a pair (level, code), to a 1D array. Parameters ---------- index : Index codes : sequence of integers (optional) Returns ------- ExtensionArray or ndarray If codes is `None`, the values o...
def maybe_casted_values(index, codes=None): """ Convert an index, given directly or as a pair (level, code), to a 1D array. Parameters ---------- index : Index codes : sequence of integers (optional) Returns ------- ExtensionArray or ndarray If codes is `None`, the values o...
https://github.com/pandas-dev/pandas/issues/24206
In [29]: idx = pd.MultiIndex([pd.CategoricalIndex(['A', 'B']), pd.CategoricalIndex(['a', 'b'])], [[0, 0, 1, 1], [0, 1, 0, -1]]) In [30]: df = pd.DataFrame({'col': range(len(idx))}, index=idx) In [31]: df Out[31]: col A a 0 b 1 B a 2 NaN 3 In [32]: df.reset_index() /home/joris/miniconda3/lib/python3...
TypeError
def construct_1d_arraylike_from_scalar( value, length: int, dtype: DtypeObj ) -> ArrayLike: """ create a np.ndarray / pandas type of specified shape and dtype filled with values Parameters ---------- value : scalar value length : int dtype : pandas_dtype or np.dtype Returns ...
def construct_1d_arraylike_from_scalar( value, length: int, dtype: DtypeObj ) -> ArrayLike: """ create a np.ndarray / pandas type of specified shape and dtype filled with values Parameters ---------- value : scalar value length : int dtype : pandas_dtype or np.dtype Returns ...
https://github.com/pandas-dev/pandas/issues/36541
In [18]: ix = pd.MultiIndex.from_tuples([(pd.NaT, 1), (pd.NaT, 2)], names=['a', 'b']) In [19]: ix Out[19]: MultiIndex([('NaT', 1), ('NaT', 2)], names=['a', 'b']) In [20]: d = pd.DataFrame({'x': [11, 12]}, index=ix) In [21]: d Out[21]: x a b NaT 1 11 2 12 In [22]: d.reset_index() --------------------------------...
ValueError
def _cat_compare_op(op): opname = f"__{op.__name__}__" fill_value = True if op is operator.ne else False @unpack_zerodim_and_defer(opname) def func(self, other): hashable = is_hashable(other) if is_list_like(other) and len(other) != len(self) and not hashable: # in hashable ...
def _cat_compare_op(op): opname = f"__{op.__name__}__" fill_value = True if op is operator.ne else False @unpack_zerodim_and_defer(opname) def func(self, other): if is_list_like(other) and len(other) != len(self): # TODO: Could this fail if the categories are listlike objects? ...
https://github.com/pandas-dev/pandas/issues/20439
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-5-4d3f2e8a3cfd> in <module>() ----> 1 c[0] = (1, 2) /Users/taugspurger/miniconda3/envs/pandas-0.19.2/lib/python3.5/site-packages/pandas/core/categorical...
ValueError
def func(self, other): hashable = is_hashable(other) if is_list_like(other) and len(other) != len(self) and not hashable: # in hashable case we may have a tuple that is itself a category raise ValueError("Lengths must match.") if not self.ordered: if opname in ["__lt__", "__gt__", "...
def func(self, other): if is_list_like(other) and len(other) != len(self): # TODO: Could this fail if the categories are listlike objects? raise ValueError("Lengths must match.") if not self.ordered: if opname in ["__lt__", "__gt__", "__le__", "__ge__"]: raise TypeError("Uno...
https://github.com/pandas-dev/pandas/issues/20439
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-5-4d3f2e8a3cfd> in <module>() ----> 1 c[0] = (1, 2) /Users/taugspurger/miniconda3/envs/pandas-0.19.2/lib/python3.5/site-packages/pandas/core/categorical...
ValueError
def _validate_setitem_value(self, value): value = extract_array(value, extract_numpy=True) # require identical categories set if isinstance(value, Categorical): if not is_dtype_equal(self, value): raise ValueError( "Cannot set a Categorical with another, without identica...
def _validate_setitem_value(self, value): value = extract_array(value, extract_numpy=True) # require identical categories set if isinstance(value, Categorical): if not is_dtype_equal(self, value): raise ValueError( "Cannot set a Categorical with another, without identica...
https://github.com/pandas-dev/pandas/issues/20439
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-5-4d3f2e8a3cfd> in <module>() ----> 1 c[0] = (1, 2) /Users/taugspurger/miniconda3/envs/pandas-0.19.2/lib/python3.5/site-packages/pandas/core/categorical...
ValueError
def __rmatmul__(self, other): """ Matrix multiplication using binary `@` operator in Python>=3.5. """ try: return self.T.dot(np.transpose(other)).T except ValueError as err: if "shape mismatch" not in str(err): raise # GH#21581 give exception message for original ...
def __rmatmul__(self, other): """ Matrix multiplication using binary `@` operator in Python>=3.5. """ return self.T.dot(np.transpose(other)).T
https://github.com/pandas-dev/pandas/issues/21581
# a.__matmul__ is called ... a @ df Traceback (most recent call last): File "<stdin>", line 2, in <module> ValueError: shapes (10,4) and (5,3) not aligned: 4 (dim 1) != 5 (dim 0) # df.__rmatmul__ is called ... a.tolist() @ df Traceback (most recent call last): File "<stdin>", line 2, in <module> File "/Users/mingli/Gi...
ValueError
def get_grouper( obj: FrameOrSeries, key=None, axis: int = 0, level=None, sort: bool = True, observed: bool = False, mutated: bool = False, validate: bool = True, dropna: bool = True, ) -> Tuple["ops.BaseGrouper", Set[Label], FrameOrSeries]: """ Create and return a BaseGroupe...
def get_grouper( obj: FrameOrSeries, key=None, axis: int = 0, level=None, sort: bool = True, observed: bool = False, mutated: bool = False, validate: bool = True, dropna: bool = True, ) -> Tuple["ops.BaseGrouper", Set[Label], FrameOrSeries]: """ Create and return a BaseGroupe...
https://github.com/pandas-dev/pandas/issues/36620
In [1]: import pandas as pd ...: df = pd.DataFrame({"A": [0, 0, 1, None], "B": [10, 2, 10, None]}) ...: gb = df.groupby('A', dropna=False) In [2]: gb.dropna Out[2]: False In [3]: gb.grouper.dropna --------------------------------------------------------------------------- AttributeError Tra...
AttributeError
def __init__( self, axis: Index, groupings: Sequence["grouper.Grouping"], sort: bool = True, group_keys: bool = True, mutated: bool = False, indexer: Optional[np.ndarray] = None, dropna: bool = True, ): assert isinstance(axis, Index), axis self._filter_empty_groups = self.compre...
def __init__( self, axis: Index, groupings: Sequence["grouper.Grouping"], sort: bool = True, group_keys: bool = True, mutated: bool = False, indexer: Optional[np.ndarray] = None, ): assert isinstance(axis, Index), axis self._filter_empty_groups = self.compressed = len(groupings) != ...
https://github.com/pandas-dev/pandas/issues/36620
In [1]: import pandas as pd ...: df = pd.DataFrame({"A": [0, 0, 1, None], "B": [10, 2, 10, None]}) ...: gb = df.groupby('A', dropna=False) In [2]: gb.dropna Out[2]: False In [3]: gb.grouper.dropna --------------------------------------------------------------------------- AttributeError Tra...
AttributeError
def _bins_to_cuts( x, bins, right: bool = True, labels=None, precision: int = 3, include_lowest: bool = False, dtype=None, duplicates: str = "raise", ordered: bool = True, ): if not ordered and labels is None: raise ValueError("'labels' must be provided if 'ordered = Fals...
def _bins_to_cuts( x, bins, right: bool = True, labels=None, precision: int = 3, include_lowest: bool = False, dtype=None, duplicates: str = "raise", ordered: bool = True, ): if not ordered and not labels: raise ValueError("'labels' must be provided if 'ordered = False'")...
https://github.com/pandas-dev/pandas/issues/36603
Traceback (most recent call last): File "/Users/mark/PycharmProjects/temp/bug1/cut_test.py", line 8, in <module> print(pd.cut(test.row_value, cuts.cut_value, labels=cuts.cut_label[:-1], ordered=False)) File "/Users/mark/PycharmProjects/temp/bug1/venv/lib/python3.7/site-packages/pandas/core/reshape/tile.py", line 284, i...
ValueError
def _get_cell_string_value(self, cell) -> str: """ Find and decode OpenDocument text:s tags that represent a run length encoded sequence of space characters. """ from odf.element import Element from odf.namespaces import TEXTNS from odf.text import S text_s = S().qname value = [] ...
def _get_cell_string_value(self, cell) -> str: """ Find and decode OpenDocument text:s tags that represent a run length encoded sequence of space characters. """ from odf.element import Element, Text from odf.namespaces import TEXTNS from odf.text import P, S text_p = P().qname text...
https://github.com/pandas-dev/pandas/issues/35802
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/michael/.local/share/virtualenvs/merge-csv-NFbvYFrS/lib/python3.8/site-packages/pandas/util/_decorators.py", line 296, in wrapper return func(*args, **kwargs) File "/home/michael/.local/share/virtualenvs/merge-csv-NFbvYFrS/lib/python3.8/...
UnboundLocalError
def _aggregate(self, arg, *args, **kwargs): """ provide an implementation for the aggregators Parameters ---------- arg : string, dict, function *args : args to pass on to the function **kwargs : kwargs to pass on to the function Returns ------- tuple of result, how Notes ...
def _aggregate(self, arg, *args, **kwargs): """ provide an implementation for the aggregators Parameters ---------- arg : string, dict, function *args : args to pass on to the function **kwargs : kwargs to pass on to the function Returns ------- tuple of result, how Notes ...
https://github.com/pandas-dev/pandas/issues/36212
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) ~/.virtualenvs/dimensions-connectors/lib/python3.7/site-packages/pandas/core/base.py in _aggregate(self, arg, *args, **kwargs) 470 try: --> 471 ...
ValueError
def infer_dtype_from_scalar(val, pandas_dtype: bool = False) -> Tuple[DtypeObj, Any]: """ Interpret the dtype from a scalar. Parameters ---------- pandas_dtype : bool, default False whether to infer dtype including pandas extension types. If False, scalar belongs to pandas extension...
def infer_dtype_from_scalar(val, pandas_dtype: bool = False) -> Tuple[DtypeObj, Any]: """ Interpret the dtype from a scalar. Parameters ---------- pandas_dtype : bool, default False whether to infer dtype including pandas extension types. If False, scalar belongs to pandas extension...
https://github.com/pandas-dev/pandas/issues/36291
import pandas as pd pd.Series(1000000000000000000000) 0 1000000000000000000000 dtype: object pd.Series(1000000000000000000000, index = pd.date_range(pd.Timestamp.now().floor("1D"), pd.Timestamp.now(), freq='T')) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/matt/opt/anaconda3/li...
OverflowError
def _upsample(self, method, limit=None, fill_value=None): """ Parameters ---------- method : string {'backfill', 'bfill', 'pad', 'ffill', 'asfreq'} method for upsampling limit : int, default None Maximum size gap to fill when reindexing fill_value : scalar, default None V...
def _upsample(self, method, limit=None, fill_value=None): """ Parameters ---------- method : string {'backfill', 'bfill', 'pad', 'ffill', 'asfreq'} method for upsampling limit : int, default None Maximum size gap to fill when reindexing fill_value : scalar, default None V...
https://github.com/pandas-dev/pandas/issues/35219
import pandas as pd # works as expected (note the daylight savings transitions in the head and tail) pd.Series(1., pd.date_range('2020-03-28','2020-10-27', freq='D', tz="Europe/Amsterdam")).resample('24H').pad() 2020-03-28 00:00:00+01:00 1.0 2020-03-29 00:00:00+01:00 1.0 2020-03-30 01:00:00+02:00 1.0 2020-03...
ValueError
def _create_blocks(self, obj: FrameOrSeriesUnion): """ Split data into blocks & return conformed data. """ # Ensure the object we're rolling over is monotonically sorted relative # to the groups # GH 36197 if not obj.empty: groupby_order = np.concatenate( list(self._group...
def _create_blocks(self, obj: FrameOrSeriesUnion): """ Split data into blocks & return conformed data. """ # Ensure the object we're rolling over is monotonically sorted relative # to the groups groupby_order = np.concatenate(list(self._groupby.grouper.indices.values())).astype( np.int64...
https://github.com/pandas-dev/pandas/issues/36197
pd.DataFrame({"s1": []}).groupby("s1").rolling(window=1).sum()' Traceback (most recent call last): File "<string>", line 1, in <module> File "site-packages/pandas/core/window/rolling.py", line 2072, in sum return super().sum(*args, **kwargs) File "site-packages/pandas/core/window/rolling.py", line 1424, in sum window_f...
ValueError
def sort_values( self, return_indexer=False, ascending=True, na_position: str_t = "last", key: Optional[Callable] = None, ): """ Return a sorted copy of the index. Return a sorted copy of the index, and optionally return the indices that sorted the index itself. Parameters ...
def sort_values( self, return_indexer=False, ascending=True, key: Optional[Callable] = None ): """ Return a sorted copy of the index. Return a sorted copy of the index, and optionally return the indices that sorted the index itself. Parameters ---------- return_indexer : bool, default ...
https://github.com/pandas-dev/pandas/issues/35584
import pandas as pd pd.__version__ '1.1.0' sr = pd.Series(['a',None,'c',None,'e']) sr.sort_values() 0 a 2 c 4 e 1 None 3 None dtype: object idx = pd.Index(['a',None,'c',None,'e']) idx Index(['a', None, 'c', None, 'e'], dtype='object') idx.sort_values() Traceback (most recent call last): File "<i...
TypeError
def replace( self, to_replace=None, value=None, inplace: bool_t = False, limit: Optional[int] = None, regex=False, method="pad", ): """ Replace values given in `to_replace` with `value`. Values of the {klass} are replaced with other values dynamically. This differs from upda...
def replace( self, to_replace=None, value=None, inplace: bool_t = False, limit: Optional[int] = None, regex=False, method="pad", ): """ Replace values given in `to_replace` with `value`. Values of the {klass} are replaced with other values dynamically. This differs from upda...
https://github.com/pandas-dev/pandas/issues/34789
Traceback (most recent call last): File "/home/developer/.config/JetBrains/PyCharmCE2020.1/scratches/scratch_1.py", line 7, in <module> df = df.replace({"replace_string": "test"}) File "/home/developer/PycharmProjects/pandas/pandas/core/frame.py", line 4277, in replace return super().replace( File "/home/developer/Pych...
TypeError
def _replace_list( self, src_list: List[Any], dest_list: List[Any], inplace: bool = False, regex: bool = False, ) -> List["Block"]: """ See BlockManager._replace_list docstring. """ src_len = len(src_list) - 1 def comp(s: Scalar, mask: np.ndarray, regex: bool = False) -> np.ndar...
def _replace_list( self, src_list: List[Any], dest_list: List[Any], masks: List[np.ndarray], inplace: bool = False, regex: bool = False, ) -> List["Block"]: """ See BlockManager._replace_list docstring. """ src_len = len(src_list) - 1 rb = [self if inplace else self.copy()] ...
https://github.com/pandas-dev/pandas/issues/34789
Traceback (most recent call last): File "/home/developer/.config/JetBrains/PyCharmCE2020.1/scratches/scratch_1.py", line 7, in <module> df = df.replace({"replace_string": "test"}) File "/home/developer/PycharmProjects/pandas/pandas/core/frame.py", line 4277, in replace return super().replace( File "/home/developer/Pych...
TypeError
def _extract_bool_array(mask: ArrayLike) -> np.ndarray: """ If we have a SparseArray or BooleanArray, convert it to ndarray[bool]. """ if isinstance(mask, ExtensionArray): # We could have BooleanArray, Sparse[bool], ... # Except for BooleanArray, this is equivalent to just # np...
def _extract_bool_array(mask: ArrayLike) -> np.ndarray: """ If we have a SparseArray or BooleanArray, convert it to ndarray[bool]. """ if isinstance(mask, ExtensionArray): # We could have BooleanArray, Sparse[bool], ... mask = np.asarray(mask, dtype=np.bool_) assert isinstance(mask,...
https://github.com/pandas-dev/pandas/issues/34789
Traceback (most recent call last): File "/home/developer/.config/JetBrains/PyCharmCE2020.1/scratches/scratch_1.py", line 7, in <module> df = df.replace({"replace_string": "test"}) File "/home/developer/PycharmProjects/pandas/pandas/core/frame.py", line 4277, in replace return super().replace( File "/home/developer/Pych...
TypeError
def replace_list( self: T, src_list: List[Any], dest_list: List[Any], inplace: bool = False, regex: bool = False, ) -> T: """do a list replace""" inplace = validate_bool_kwarg(inplace, "inplace") bm = self.apply( "_replace_list", src_list=src_list, dest_list=dest...
def replace_list( self: T, src_list: List[Any], dest_list: List[Any], inplace: bool = False, regex: bool = False, ) -> T: """do a list replace""" inplace = validate_bool_kwarg(inplace, "inplace") # figure out our mask apriori to avoid repeated replacements values = self.as_array() ...
https://github.com/pandas-dev/pandas/issues/34789
Traceback (most recent call last): File "/home/developer/.config/JetBrains/PyCharmCE2020.1/scratches/scratch_1.py", line 7, in <module> df = df.replace({"replace_string": "test"}) File "/home/developer/PycharmProjects/pandas/pandas/core/frame.py", line 4277, in replace return super().replace( File "/home/developer/Pych...
TypeError
def _maybe_cast_for_get_loc(self, key) -> Timestamp: # needed to localize naive datetimes or dates (GH 35690) key = Timestamp(key) if key.tzinfo is None: key = key.tz_localize(self.tz) else: key = key.tz_convert(self.tz) return key
def _maybe_cast_for_get_loc(self, key) -> Timestamp: # needed to localize naive datetimes key = Timestamp(key) if key.tzinfo is None: key = key.tz_localize(self.tz) else: key = key.tz_convert(self.tz) return key
https://github.com/pandas-dev/pandas/issues/34077
In [1]: import pandas as pd, datetime as dt In [2]: pd.__version__ Out[2]: '1.0.3' In [3]: a = pd.DatetimeIndex(['2010-01-01', '2010-01-03']) In [4]: a.slice_locs(dt.datetime(2010, 1, 1), dt.datetime(2010, 1, 3)) Out[4]: (0, 2) In [5]: a.slice_locs(dt.datetime(2010, 1, 1), dt.datetime(2010, 1, 2)) Out[5]: (0, 1) I...
TypeError
def _maybe_cast_slice_bound(self, label, side: str, kind): """ If label is a string, cast it to datetime according to resolution. Parameters ---------- label : object side : {'left', 'right'} kind : {'loc', 'getitem'} or None Returns ------- label : object Notes ----- ...
def _maybe_cast_slice_bound(self, label, side: str, kind): """ If label is a string, cast it to datetime according to resolution. Parameters ---------- label : object side : {'left', 'right'} kind : {'loc', 'getitem'} or None Returns ------- label : object Notes ----- ...
https://github.com/pandas-dev/pandas/issues/34077
In [1]: import pandas as pd, datetime as dt In [2]: pd.__version__ Out[2]: '1.0.3' In [3]: a = pd.DatetimeIndex(['2010-01-01', '2010-01-03']) In [4]: a.slice_locs(dt.datetime(2010, 1, 1), dt.datetime(2010, 1, 3)) Out[4]: (0, 2) In [5]: a.slice_locs(dt.datetime(2010, 1, 1), dt.datetime(2010, 1, 2)) Out[5]: (0, 1) I...
TypeError
def get_grouper( obj: FrameOrSeries, key=None, axis: int = 0, level=None, sort: bool = True, observed: bool = False, mutated: bool = False, validate: bool = True, dropna: bool = True, ) -> Tuple["ops.BaseGrouper", List[Hashable], FrameOrSeries]: """ Create and return a BaseGr...
def get_grouper( obj: FrameOrSeries, key=None, axis: int = 0, level=None, sort: bool = True, observed: bool = False, mutated: bool = False, validate: bool = True, dropna: bool = True, ) -> Tuple["ops.BaseGrouper", List[Hashable], FrameOrSeries]: """ Create and return a BaseGr...
https://github.com/pandas-dev/pandas/issues/34240
In [11]: s = pd.Series([1, 2, 3], index=pd.period_range('2000', periods=3, name='A')) In [12]: s.index.get_loc('A') --------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-12-3a472f211c46> in <module> ----> 1...
ValueError
def is_in_obj(gpr) -> bool: if not hasattr(gpr, "name"): return False try: return gpr is obj[gpr.name] except (KeyError, IndexError): # IndexError reached in e.g. test_skip_group_keys when we pass # lambda here return False
def is_in_obj(gpr) -> bool: if not hasattr(gpr, "name"): return False try: return gpr is obj[gpr.name] except (KeyError, IndexError, ValueError): # TODO: ValueError: Given date string not likely a datetime. # should be KeyError? return False
https://github.com/pandas-dev/pandas/issues/34240
In [11]: s = pd.Series([1, 2, 3], index=pd.period_range('2000', periods=3, name='A')) In [12]: s.index.get_loc('A') --------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-12-3a472f211c46> in <module> ----> 1...
ValueError
def get_loc(self, key, method=None, tolerance=None): """ Get integer location for requested label. Parameters ---------- key : Period, NaT, str, or datetime String or datetime key must be parsable as Period. Returns ------- loc : int or ndarray[int64] Raises ------ ...
def get_loc(self, key, method=None, tolerance=None): """ Get integer location for requested label. Parameters ---------- key : Period, NaT, str, or datetime String or datetime key must be parsable as Period. Returns ------- loc : int or ndarray[int64] Raises ------ ...
https://github.com/pandas-dev/pandas/issues/34240
In [11]: s = pd.Series([1, 2, 3], index=pd.period_range('2000', periods=3, name='A')) In [12]: s.index.get_loc('A') --------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-12-3a472f211c46> in <module> ----> 1...
ValueError
def _disallow_scalar_only_bool_ops(self): rhs = self.rhs lhs = self.lhs # GH#24883 unwrap dtype if necessary to ensure we have a type object rhs_rt = rhs.return_type rhs_rt = getattr(rhs_rt, "type", rhs_rt) lhs_rt = lhs.return_type lhs_rt = getattr(lhs_rt, "type", lhs_rt) if ( (...
def _disallow_scalar_only_bool_ops(self): if ( (self.lhs.is_scalar or self.rhs.is_scalar) and self.op in _bool_ops_dict and ( not ( issubclass(self.rhs.return_type, (bool, np.bool_)) and issubclass(self.lhs.return_type, (bool, np.bool_)) ...
https://github.com/pandas-dev/pandas/issues/24883
# Your code here Scenario 1: df2=pd.DataFrame({'a1':[10,20]}) df2.eval("c=((a1>10) &amp; True )") Out[8]: a1 c 0 10 False 1 20 True Scenario 2: df2=pd.DataFrame({'a1':['Y','N']}) df2.eval("c=((a1 == 'Y') &amp; True )") Traceback (most recent call last): TypeError: issubclass() arg 1 must be a class
TypeError
def interpolate( self, method="linear", axis=0, limit=None, inplace=False, limit_direction="forward", limit_area=None, downcast=None, **kwargs, ): """ Interpolate values according to different methods. """ result = self._upsample("asfreq") return result.interpolat...
def interpolate( self, method="linear", axis=0, limit=None, inplace=False, limit_direction="forward", limit_area=None, downcast=None, **kwargs, ): """ Interpolate values according to different methods. """ result = self._upsample(None) return result.interpolate( ...
https://github.com/pandas-dev/pandas/issues/35325
TypeError Traceback (most recent call last) ~/.cache/pypoetry/virtualenvs/lagps-6BuXYM4Y-py3.8/lib/python3.8/site-packages/pandas/core/groupby/groupby.py in apply(self, func, *args, **kwargs) 735 try: --> 736 result = self._python_apply_general(f) 737 ...
TypeError
def _transform_general( self, func, *args, engine="cython", engine_kwargs=None, **kwargs ): """ Transform with a non-str `func`. """ if maybe_use_numba(engine): numba_func, cache_key = generate_numba_func( func, engine_kwargs, kwargs, "groupby_transform" ) klass = ty...
def _transform_general( self, func, *args, engine="cython", engine_kwargs=None, **kwargs ): """ Transform with a non-str `func`. """ if maybe_use_numba(engine): numba_func, cache_key = generate_numba_func( func, engine_kwargs, kwargs, "groupby_transform" ) klass = t...
https://github.com/pandas-dev/pandas/issues/35014
In [1]: import pandas as pd In [2]: df = pd.DataFrame({"A": [0, 0, 1, None], "B": [1, 2, 3, None]}) In [3]: gb = df.groupby("A", dropna=False) In [6]: gb['B'].transform(len) --------------------------------------------------------------------------- ValueError Traceback (most recent call ...
ValueError
def __floordiv__(self, other): if is_scalar(other): if isinstance(other, (timedelta, np.timedelta64, Tick)): other = Timedelta(other) if other is NaT: # treat this specifically as timedelta-NaT result = np.empty(self.shape, dtype=np.float64) ...
def __floordiv__(self, other): if is_scalar(other): if isinstance(other, (timedelta, np.timedelta64, Tick)): other = Timedelta(other) if other is NaT: # treat this specifically as timedelta-NaT result = np.empty(self.shape, dtype=np.float64) ...
https://github.com/pandas-dev/pandas/issues/35529
import pandas as pd sr = pd.Series([10, 20, 30], dtype='timedelta64[ns]') sr 0 00:00:00.000000 1 00:00:00.000000 2 00:00:00.000000 dtype: timedelta64[ns] sr = pd.Series([1000, 20, 30], dtype='timedelta64[ns]') sr 0 00:00:00.000001 1 00:00:00.000000 2 00:00:00.000000 dtype: timedelta64[ns] sr = pd.Series([10...
ValueError
def _generate_range( cls, start, end, periods, freq, tz=None, normalize=False, ambiguous="raise", nonexistent="raise", closed=None, ): periods = dtl.validate_periods(periods) if freq is None and any(x is None for x in [periods, start, end]): raise ValueError("Must...
def _generate_range( cls, start, end, periods, freq, tz=None, normalize=False, ambiguous="raise", nonexistent="raise", closed=None, ): periods = dtl.validate_periods(periods) if freq is None and any(x is None for x in [periods, start, end]): raise ValueError("Must...
https://github.com/pandas-dev/pandas/issues/35297
import pandas as pd timezone = 'America/New_York' start = pd.Timestamp(year=2020, month=11, day=1, hour=1).tz_localize(timezone, ambiguous=False) pd.date_range(start, periods=2, ambiguous=False) --------------------------------------------------------------------------- AmbiguousTimeError Traceb...
AmbiguousTimeError
def _extract_multi_indexer_columns( self, header, index_names, col_names, passed_names=False ): """ extract and return the names, index_names, col_names header is a list-of-lists returned from the parsers """ if len(header) < 2: return header[0], index_names, col_names, passed_names ...
def _extract_multi_indexer_columns( self, header, index_names, col_names, passed_names=False ): """ extract and return the names, index_names, col_names header is a list-of-lists returned from the parsers """ if len(header) < 2: return header[0], index_names, col_names, passed_names ...
https://github.com/pandas-dev/pandas/issues/34748
Traceback (most recent call last): File "test.py", line 3, in <module> pd.read_excel('test.xlsx', header=[0, 1], index_col=0, engine='xlrd') File "/home/sasha/miniconda3/lib/python3.7/site-packages/pandas/io/excel/_base.py", line 334, in read_excel **kwds, File "/home/sasha/miniconda3/lib/python3.7/site-packages/pandas...
TypeError
def _get_data_from_filepath(self, filepath_or_buffer): """ The function read_json accepts three input types: 1. filepath (string-like) 2. file-like object (e.g. open file object, StringIO) 3. JSON string This method turns (1) into (2) to simplify the rest of the processing. It r...
def _get_data_from_filepath(self, filepath_or_buffer): """ The function read_json accepts three input types: 1. filepath (string-like) 2. file-like object (e.g. open file object, StringIO) 3. JSON string This method turns (1) into (2) to simplify the rest of the processing. It r...
https://github.com/pandas-dev/pandas/issues/27135
# output when using fileurl: TypeError Traceback (most recent call last) <ipython-input-82-605ab8a466fd> in <module> ----> 1 for chunk in reader: 2 print(chunk) 3 ~/anaconda3/envs/test_latest_pandas_json/lib/python3.7/site-packages/pandas/io/json/json.py in __next__(self) 579 ...
TypeError
def append_to_multiple( self, d: Dict, value, selector, data_columns=None, axes=None, dropna=False, **kwargs, ): """ Append to multiple tables Parameters ---------- d : a dict of table_name to table_columns, None is acceptable as the values of one node (this ...
def append_to_multiple( self, d: Dict, value, selector, data_columns=None, axes=None, dropna=False, **kwargs, ): """ Append to multiple tables Parameters ---------- d : a dict of table_name to table_columns, None is acceptable as the values of one node (this ...
https://github.com/pandas-dev/pandas/issues/11238
store.append_to_multiple({ ... 'index': ["IX"], ... 'nums': ["Num", "BigNum", "RandNum"], ... "strs": ["Str", "LongStr"] ... }, d.iloc[[0]], 'index', min_itemsize={"Str": 10, "LongStr": 100}) Traceback (most recent call last): File "<pyshell#52>", line 5, in <module> }, d.iloc[[0]], 'index', min_itemsize={"...
ValueError
def setup(self, orient, frame): N = 10**5 ncols = 5 index = date_range("20000101", periods=N, freq="H") timedeltas = timedelta_range(start=1, periods=N, freq="s") datetimes = date_range(start=1, periods=N, freq="s") ints = np.random.randint(100000000, size=N) longints = sys.maxsize * np.rand...
def setup(self, orient, frame): N = 10**5 ncols = 5 index = date_range("20000101", periods=N, freq="H") timedeltas = timedelta_range(start=1, periods=N, freq="s") datetimes = date_range(start=1, periods=N, freq="s") ints = np.random.randint(100000000, size=N) floats = np.random.randn(N) ...
https://github.com/pandas-dev/pandas/issues/34395
dumps(sys.maxsize) '9223372036854775807' dumps(sys.maxsize + 1, default_handler=str) Traceback (most recent call last): File "<stdin>", line 1, in <module> OverflowError: int too big to convert
OverflowError
def setup(self): N = 10**5 ncols = 5 index = date_range("20000101", periods=N, freq="H") timedeltas = timedelta_range(start=1, periods=N, freq="s") datetimes = date_range(start=1, periods=N, freq="s") ints = np.random.randint(100000000, size=N) longints = sys.maxsize * np.random.randint(1000...
def setup(self): N = 10**5 ncols = 5 index = date_range("20000101", periods=N, freq="H") timedeltas = timedelta_range(start=1, periods=N, freq="s") datetimes = date_range(start=1, periods=N, freq="s") ints = np.random.randint(100000000, size=N) floats = np.random.randn(N) strings = tm.ma...
https://github.com/pandas-dev/pandas/issues/34395
dumps(sys.maxsize) '9223372036854775807' dumps(sys.maxsize + 1, default_handler=str) Traceback (most recent call last): File "<stdin>", line 1, in <module> OverflowError: int too big to convert
OverflowError
def to_csv( self, path_or_buf: Optional[FilePathOrBuffer] = None, sep: str = ",", na_rep: str = "", float_format: Optional[str] = None, columns: Optional[Sequence[Label]] = None, header: Union[bool_t, List[str]] = True, index: bool_t = True, index_label: Optional[Union[bool_t, str, S...
def to_csv( self, path_or_buf: Optional[FilePathOrBuffer] = None, sep: str = ",", na_rep: str = "", float_format: Optional[str] = None, columns: Optional[Sequence[Label]] = None, header: Union[bool_t, List[str]] = True, index: bool_t = True, index_label: Optional[Union[bool_t, str, S...
https://github.com/pandas-dev/pandas/issues/22610
--------------------------------------------------------------------------- UnicodeEncodeError Traceback (most recent call last) <ipython-input-50-769583baba38> in <module>() 4 srs = pd.Series() 5 srs.loc[ 0 ] = s ----> 6 srs.to_csv('testcase.csv') /opt/conda/lib/python3.6/site-packages/pandas/c...
UnicodeEncodeError
def get_handle( path_or_buf, mode: str, encoding=None, compression: Optional[Union[str, Mapping[str, Any]]] = None, memory_map: bool = False, is_text: bool = True, errors=None, ): """ Get file handle for given path/buffer and mode. Parameters ---------- path_or_buf : str...
def get_handle( path_or_buf, mode: str, encoding=None, compression: Optional[Union[str, Mapping[str, Any]]] = None, memory_map: bool = False, is_text: bool = True, ): """ Get file handle for given path/buffer and mode. Parameters ---------- path_or_buf : str or file handle ...
https://github.com/pandas-dev/pandas/issues/22610
--------------------------------------------------------------------------- UnicodeEncodeError Traceback (most recent call last) <ipython-input-50-769583baba38> in <module>() 4 srs = pd.Series() 5 srs.loc[ 0 ] = s ----> 6 srs.to_csv('testcase.csv') /opt/conda/lib/python3.6/site-packages/pandas/c...
UnicodeEncodeError
def __init__( self, obj, path_or_buf: Optional[FilePathOrBuffer[str]] = None, sep: str = ",", na_rep: str = "", float_format: Optional[str] = None, cols=None, header: Union[bool, Sequence[Hashable]] = True, index: bool = True, index_label: Optional[Union[bool, Hashable, Sequence[...
def __init__( self, obj, path_or_buf: Optional[FilePathOrBuffer[str]] = None, sep: str = ",", na_rep: str = "", float_format: Optional[str] = None, cols=None, header: Union[bool, Sequence[Hashable]] = True, index: bool = True, index_label: Optional[Union[bool, Hashable, Sequence[...
https://github.com/pandas-dev/pandas/issues/22610
--------------------------------------------------------------------------- UnicodeEncodeError Traceback (most recent call last) <ipython-input-50-769583baba38> in <module>() 4 srs = pd.Series() 5 srs.loc[ 0 ] = s ----> 6 srs.to_csv('testcase.csv') /opt/conda/lib/python3.6/site-packages/pandas/c...
UnicodeEncodeError
def save(self) -> None: """ Create the writer & save. """ # GH21227 internal compression is not used when file-like passed. if self.compression and hasattr(self.path_or_buf, "write"): warnings.warn( "compression has no effect when passing file-like object as input.", ...
def save(self) -> None: """ Create the writer & save. """ # GH21227 internal compression is not used when file-like passed. if self.compression and hasattr(self.path_or_buf, "write"): warnings.warn( "compression has no effect when passing file-like object as input.", ...
https://github.com/pandas-dev/pandas/issues/22610
--------------------------------------------------------------------------- UnicodeEncodeError Traceback (most recent call last) <ipython-input-50-769583baba38> in <module>() 4 srs = pd.Series() 5 srs.loc[ 0 ] = s ----> 6 srs.to_csv('testcase.csv') /opt/conda/lib/python3.6/site-packages/pandas/c...
UnicodeEncodeError
def _where( self, cond, other=np.nan, inplace=False, axis=None, level=None, errors="raise", try_cast=False, ): """ Equivalent to public method `where`, except that `other` is not applied as a function even if callable. Used in __setitem__. """ inplace = validate_bool_...
def _where( self, cond, other=np.nan, inplace=False, axis=None, level=None, errors="raise", try_cast=False, ): """ Equivalent to public method `where`, except that `other` is not applied as a function even if callable. Used in __setitem__. """ inplace = validate_bool_...
https://github.com/pandas-dev/pandas/issues/34592
pd.Series([], dtype=float).where([]) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/nix/store/vqd2pmsja84h36wz6c878bgbpz46cy2h-python3.7-pandas-1.0.3/lib/python3.7/site-packages/pandas/core/generic.py", line 8919, in where cond, other, inplace, axis, level, errors=errors, try_cast=try_cas...
ValueError
def _is_potential_multi_index( columns, index_col: Optional[Union[bool, Sequence[int]]] = None ): """ Check whether or not the `columns` parameter could be converted into a MultiIndex. Parameters ---------- columns : array-like Object which may or may not be convertible into a Multi...
def _is_potential_multi_index(columns): """ Check whether or not the `columns` parameter could be converted into a MultiIndex. Parameters ---------- columns : array-like Object which may or may not be convertible into a MultiIndex Returns ------- boolean : Whether or not co...
https://github.com/pandas-dev/pandas/issues/33476
$ ~/miniconda3/bin/python read.py Traceback (most recent call last): File "read.py", line 4, in <module> df = pd.read_excel('df_empty.xlsx', engine='openpyxl', sheet_name='Sheet1', index_col=0, header=[0, 1]) File "/home/sasha/miniconda3/lib/python3.7/site-packages/pandas/io/excel/_base.py", line 334, in read_excel **k...
ValueError
def _maybe_dedup_names(self, names): # see gh-7160 and gh-9424: this helps to provide # immediate alleviation of the duplicate names # issue and appears to be satisfactory to users, # but ultimately, not needing to butcher the names # would be nice! if self.mangle_dupe_cols: names = list...
def _maybe_dedup_names(self, names): # see gh-7160 and gh-9424: this helps to provide # immediate alleviation of the duplicate names # issue and appears to be satisfactory to users, # but ultimately, not needing to butcher the names # would be nice! if self.mangle_dupe_cols: names = list...
https://github.com/pandas-dev/pandas/issues/33476
$ ~/miniconda3/bin/python read.py Traceback (most recent call last): File "read.py", line 4, in <module> df = pd.read_excel('df_empty.xlsx', engine='openpyxl', sheet_name='Sheet1', index_col=0, header=[0, 1]) File "/home/sasha/miniconda3/lib/python3.7/site-packages/pandas/io/excel/_base.py", line 334, in read_excel **k...
ValueError
def melt( frame: DataFrame, id_vars=None, value_vars=None, var_name=None, value_name="value", col_level=None, ) -> DataFrame: # TODO: what about the existing index? # If multiindex, gather names of columns on all level for checking presence # of `id_vars` and `value_vars` if isin...
def melt( frame: DataFrame, id_vars=None, value_vars=None, var_name=None, value_name="value", col_level=None, ) -> DataFrame: # TODO: what about the existing index? # If multiindex, gather names of columns on all level for checking presence # of `id_vars` and `value_vars` if isin...
https://github.com/pandas-dev/pandas/issues/34129
--------------------------------------------------------------------------- KeyError Traceback (most recent call last) ~/Repos/spec17/venv/lib/python3.8/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance) 2896 try: -> 2897 retur...
KeyError
def to_timestamp(self, freq=None, how="start", copy=True) -> "Series": """ Cast to DatetimeIndex of Timestamps, at *beginning* of period. Parameters ---------- freq : str, default frequency of PeriodIndex Desired frequency. how : {'s', 'e', 'start', 'end'} Convention for convert...
def to_timestamp(self, freq=None, how="start", copy=True) -> "Series": """ Cast to DatetimeIndex of Timestamps, at *beginning* of period. Parameters ---------- freq : str, default frequency of PeriodIndex Desired frequency. how : {'s', 'e', 'start', 'end'} Convention for convert...
https://github.com/pandas-dev/pandas/issues/33327
In [5]: import pandas as pd In [6]: pd.Series([0]).to_timestamp() --------------------------------------------------------------------------- AssertionError Traceback (most recent call last) <ipython-input-6-1a9d08d7daba> in <module> ----> 1 pd.Series([0]).to_timestamp() ~/sandbox/pandas/pa...
AssertionError
def to_period(self, freq=None, copy=True) -> "Series": """ Convert Series from DatetimeIndex to PeriodIndex with desired frequency (inferred from index if not passed). Parameters ---------- freq : str, default None Frequency associated with the PeriodIndex. copy : bool, default True...
def to_period(self, freq=None, copy=True) -> "Series": """ Convert Series from DatetimeIndex to PeriodIndex with desired frequency (inferred from index if not passed). Parameters ---------- freq : str, default None Frequency associated with the PeriodIndex. copy : bool, default True...
https://github.com/pandas-dev/pandas/issues/33327
In [5]: import pandas as pd In [6]: pd.Series([0]).to_timestamp() --------------------------------------------------------------------------- AssertionError Traceback (most recent call last) <ipython-input-6-1a9d08d7daba> in <module> ----> 1 pd.Series([0]).to_timestamp() ~/sandbox/pandas/pa...
AssertionError
def sum(self, axis: int = 0, min_count: int = 0, *args, **kwargs) -> Scalar: """ Sum of non-NA/null values Parameters ---------- axis : int, default 0 Not Used. NumPy compatibility. min_count : int, default 0 The required number of valid values to perform the summation. If fewer...
def sum(self, axis=0, *args, **kwargs): """ Sum of non-NA/null values Returns ------- sum : float """ nv.validate_sum(args, kwargs) valid_vals = self._valid_sp_values sp_sum = valid_vals.sum() if self._null_fill_value: return sp_sum else: nsparse = self.sp_in...
https://github.com/pandas-dev/pandas/issues/25777
In [202]: sparse_series.dtype Out[203]: Sparse[bool, False] In [208]: sparse_series.value_counts() Out[208]: False 51386 True 13 Name: C_3D Printing, dtype: int64 In [209]: sparse_series.sum() --------------------------------------------------------------------------- TypeError ...
TypeError
def na_value_for_dtype(dtype, compat: bool = True): """ Return a dtype compat na value Parameters ---------- dtype : string / dtype compat : bool, default True Returns ------- np.dtype or a pandas dtype Examples -------- >>> na_value_for_dtype(np.dtype('int64')) 0 ...
def na_value_for_dtype(dtype, compat: bool = True): """ Return a dtype compat na value Parameters ---------- dtype : string / dtype compat : bool, default True Returns ------- np.dtype or a pandas dtype Examples -------- >>> na_value_for_dtype(np.dtype('int64')) 0 ...
https://github.com/pandas-dev/pandas/issues/25777
In [202]: sparse_series.dtype Out[203]: Sparse[bool, False] In [208]: sparse_series.value_counts() Out[208]: False 51386 True 13 Name: C_3D Printing, dtype: int64 In [209]: sparse_series.sum() --------------------------------------------------------------------------- TypeError ...
TypeError
def check_below_min_count( shape: Tuple[int, ...], mask: Optional[np.ndarray], min_count: int ) -> bool: """ Check for the `min_count` keyword. Returns True if below `min_count` (when missing value should be returned from the reduction). Parameters ---------- shape : tuple The shape...
def check_below_min_count( shape: Tuple[int, ...], mask: Optional[np.ndarray], min_count: int ): """ Check for the `min_count` keyword. Returns True if below `min_count` (when missing value should be returned from the reduction). Parameters ---------- shape : tuple The shape of the ...
https://github.com/pandas-dev/pandas/issues/25777
In [202]: sparse_series.dtype Out[203]: Sparse[bool, False] In [208]: sparse_series.value_counts() Out[208]: False 51386 True 13 Name: C_3D Printing, dtype: int64 In [209]: sparse_series.sum() --------------------------------------------------------------------------- TypeError ...
TypeError
def _na_for_min_count( values: np.ndarray, axis: Optional[int] ) -> Union[Scalar, np.ndarray]: """ Return the missing value for `values`. Parameters ---------- values : ndarray axis : int or None axis for the reduction, required if values.ndim > 1. Returns ------- resul...
def _na_for_min_count( values: np.ndarray, axis: Optional[int] ) -> Union[Scalar, np.ndarray]: """ Return the missing value for `values`. Parameters ---------- values : ndarray axis : int or None axis for the reduction, required if values.ndim > 1. Returns ------- resul...
https://github.com/pandas-dev/pandas/issues/33704
Traceback (most recent call last): File "<ipython-input-17-be9940feb663>", line 1, in <module> df.max() File "pandas/core/generic.py", line 11215, in stat_func f, name, axis=axis, skipna=skipna, numeric_only=numeric_only File "pandas/core/frame.py", line 7907, in _reduce result = f(values) File "pandas/core/frame.py", ...
ValueError
def init_dict(data: Dict, index, columns, dtype: Optional[DtypeObj] = None): """ Segregate Series based on type and coerce into matrices. Needs to handle a lot of exceptional cases. """ arrays: Union[Sequence[Any], "Series"] if columns is not None: from pandas.core.series import Series ...
def init_dict(data: Dict, index, columns, dtype: Optional[DtypeObj] = None): """ Segregate Series based on type and coerce into matrices. Needs to handle a lot of exceptional cases. """ arrays: Union[Sequence[Any], "Series"] if columns is not None: from pandas.core.series import Series ...
https://github.com/pandas-dev/pandas/issues/33623
In [1]: import pandas as pd In [2]: pd.DataFrame({'a': ['b']}, dtype='string') Out[2]: a 0 b In [3]: pd.DataFrame(columns=['a'], dtype='string') --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-3-2e5...
TypeError
def putmask( self, mask, new, inplace: bool = False, axis: int = 0, transpose: bool = False, ) -> List["Block"]: """ See Block.putmask.__doc__ """ inplace = validate_bool_kwarg(inplace, "inplace") mask = _extract_bool_array(mask) new_values = self.values if inplace else...
def putmask( self, mask, new, inplace: bool = False, axis: int = 0, transpose: bool = False, ) -> List["Block"]: """ See Block.putmask.__doc__ """ inplace = validate_bool_kwarg(inplace, "inplace") mask = _extract_bool_array(mask) new_values = self.values if inplace else...
https://github.com/pandas-dev/pandas/issues/33980
Traceback (most recent call last): File "<ipython-input-15-b9da8f25067a>", line 1, in <module> a.update(b) File "C:\tools\anaconda3\envs\Simple\lib\site-packages\pandas\core\series.py", line 2810, in update self._data = self._data.putmask(mask=mask, new=other, inplace=True) File "C:\tools\anaconda3\envs\Simple\lib\s...
ValueError
def _get_listlike_indexer(self, key, axis: int, raise_missing: bool = False): """ Transform a list-like of keys into a new index and an indexer. Parameters ---------- key : list-like Targeted labels. axis: int Dimension on which the indexing is being made. raise_missing: boo...
def _get_listlike_indexer(self, key, axis: int, raise_missing: bool = False): """ Transform a list-like of keys into a new index and an indexer. Parameters ---------- key : list-like Targeted labels. axis: int Dimension on which the indexing is being made. raise_missing: boo...
https://github.com/pandas-dev/pandas/issues/11278
In [10]: series.loc[['2000-01-14', '2000-01-15']] --------------------------------------------------------------------------- KeyError Traceback (most recent call last) <ipython-input-10-e922e8a9ed74> in <module>() ----> 1 series.loc[['2000-01-14', '2000-01-15']] /Library/Frameworks/Py...
KeyError
def sanitize_array( data, index: Optional["Index"], dtype: Optional[DtypeObj] = None, copy: bool = False, raise_cast_failure: bool = False, ) -> ArrayLike: """ Sanitize input data to an ndarray or ExtensionArray, copy if specified, coerce to the dtype if specified. """ if isinst...
def sanitize_array( data, index: Optional["Index"], dtype: Optional[DtypeObj] = None, copy: bool = False, raise_cast_failure: bool = False, ) -> ArrayLike: """ Sanitize input data to an ndarray or ExtensionArray, copy if specified, coerce to the dtype if specified. """ if isinst...
https://github.com/pandas-dev/pandas/issues/26469
In [8]: pd.Series(None, index=[1, 2, 3], dtype='Int64') --------------------------------------------------------------------------- TypeError Traceback (most recent call last) ~/scipy/pandas/pandas/core/internals/construction.py in _try_cast(arr, take_fast_path, dtype, copy, raise_cast_f...
TypeError
def _try_cast( arr, dtype: Optional[DtypeObj], copy: bool, raise_cast_failure: bool, ): """ Convert input to numpy ndarray and optionally cast to a given dtype. Parameters ---------- arr : ndarray, scalar, list, tuple, iterator (catchall) Excludes: ExtensionArray, Series, In...
def _try_cast( arr, dtype: Optional[DtypeObj], copy: bool, raise_cast_failure: bool, ): """ Convert input to numpy ndarray and optionally cast to a given dtype. Parameters ---------- arr : ndarray, list, tuple, iterator (catchall) Excludes: ExtensionArray, Series, Index. ...
https://github.com/pandas-dev/pandas/issues/26469
In [8]: pd.Series(None, index=[1, 2, 3], dtype='Int64') --------------------------------------------------------------------------- TypeError Traceback (most recent call last) ~/scipy/pandas/pandas/core/internals/construction.py in _try_cast(arr, take_fast_path, dtype, copy, raise_cast_f...
TypeError
def maybe_cast_to_datetime(value, dtype, errors: str = "raise"): """ try to cast the array/value to a datetimelike dtype, converting float nan to iNaT """ from pandas.core.tools.timedeltas import to_timedelta from pandas.core.tools.datetimes import to_datetime if dtype is not None: ...
def maybe_cast_to_datetime(value, dtype, errors: str = "raise"): """ try to cast the array/value to a datetimelike dtype, converting float nan to iNaT """ from pandas.core.tools.timedeltas import to_timedelta from pandas.core.tools.datetimes import to_datetime if dtype is not None: ...
https://github.com/pandas-dev/pandas/issues/26469
In [8]: pd.Series(None, index=[1, 2, 3], dtype='Int64') --------------------------------------------------------------------------- TypeError Traceback (most recent call last) ~/scipy/pandas/pandas/core/internals/construction.py in _try_cast(arr, take_fast_path, dtype, copy, raise_cast_f...
TypeError
def _format_strings(self) -> List[str]: if self.float_format is None: float_format = get_option("display.float_format") if float_format is None: precision = get_option("display.precision") float_format = lambda x: f"{x: .{precision:d}g}" else: float_format = self....
def _format_strings(self) -> List[str]: if self.float_format is None: float_format = get_option("display.float_format") if float_format is None: precision = get_option("display.precision") float_format = lambda x: f"{x: .{precision:d}g}" else: float_format = self....
https://github.com/pandas-dev/pandas/issues/33770
import pandas as pd import numpy as np import text_extensions_for_pandas as tp # Integers work int_tensors = np.array([[1, 2], [3, 4]]) int_tensor_series = pd.Series(tp.TensorArray(int_tensors)) int_tensor_series 0 [1 2] 1 [3 4] dtype: TensorType # Boolean values don't work bool_tensors = np.array([[True, False],...
ValueError
def _make_concat_multiindex(indexes, keys, levels=None, names=None) -> MultiIndex: if (levels is None and isinstance(keys[0], tuple)) or ( levels is not None and len(levels) > 1 ): zipped = list(zip(*keys)) if names is None: names = [None] * len(zipped) if levels is ...
def _make_concat_multiindex(indexes, keys, levels=None, names=None) -> MultiIndex: if (levels is None and isinstance(keys[0], tuple)) or ( levels is not None and len(levels) > 1 ): zipped = list(zip(*keys)) if names is None: names = [None] * len(zipped) if levels is ...
https://github.com/pandas-dev/pandas/issues/33654
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-2-f6a5f4790f76> in <module> 3 s1 = pd.Series([1,2,3], name='a') 4 s2 = pd.Series([1,2,3], name='a') ----> 5 pd.concat([df, s1, s2], axis=1, keys=['a', 'b...
TypeError
def __init__( self, obj, path_or_buf: Optional[FilePathOrBuffer[str]] = None, sep: str = ",", na_rep: str = "", float_format: Optional[str] = None, cols=None, header: Union[bool, Sequence[Hashable]] = True, index: bool = True, index_label: Optional[Union[bool, Hashable, Sequence[...
def __init__( self, obj, path_or_buf: Optional[FilePathOrBuffer[str]] = None, sep: str = ",", na_rep: str = "", float_format: Optional[str] = None, cols=None, header: Union[bool, Sequence[Hashable]] = True, index: bool = True, index_label: Optional[Union[bool, Hashable, Sequence[...
https://github.com/pandas-dev/pandas/issues/27679
Exception ignored in: <function AbstractBufferedFile.__del__ at 0x7fe0ae8db440> Traceback (most recent call last): File "/home/languitar/.pyenv/versions/analytics-3.7/lib/python3.7/site-packages/fsspec/spec.py", line 1137, in __del__ self.close() File "/home/languitar/.pyenv/versions/analytics-3.7/lib/python3.7/site-pa...
botocore.exceptions.NoCredentialsError
def save(self) -> None: """ Create the writer & save. """ # GH21227 internal compression is not used when file-like passed. if self.compression and hasattr(self.path_or_buf, "write"): warnings.warn( "compression has no effect when passing file-like object as input.", ...
def save(self) -> None: """ Create the writer & save. """ # GH21227 internal compression is not used when file-like passed. if self.compression and hasattr(self.path_or_buf, "write"): warnings.warn( "compression has no effect when passing file-like object as input.", ...
https://github.com/pandas-dev/pandas/issues/27679
Exception ignored in: <function AbstractBufferedFile.__del__ at 0x7fe0ae8db440> Traceback (most recent call last): File "/home/languitar/.pyenv/versions/analytics-3.7/lib/python3.7/site-packages/fsspec/spec.py", line 1137, in __del__ self.close() File "/home/languitar/.pyenv/versions/analytics-3.7/lib/python3.7/site-pa...
botocore.exceptions.NoCredentialsError
def write( self, df: DataFrame, path, compression="snappy", index: Optional[bool] = None, partition_cols=None, **kwargs, ): self.validate_dataframe(df) path, _, _, should_close = get_filepath_or_buffer(path, mode="wb") from_pandas_kwargs: Dict[str, Any] = {"schema": kwargs.pop("...
def write( self, df: DataFrame, path, compression="snappy", index: Optional[bool] = None, partition_cols=None, **kwargs, ): self.validate_dataframe(df) path, _, _, _ = get_filepath_or_buffer(path, mode="wb") from_pandas_kwargs: Dict[str, Any] = {"schema": kwargs.pop("schema", No...
https://github.com/pandas-dev/pandas/issues/27679
Exception ignored in: <function AbstractBufferedFile.__del__ at 0x7fe0ae8db440> Traceback (most recent call last): File "/home/languitar/.pyenv/versions/analytics-3.7/lib/python3.7/site-packages/fsspec/spec.py", line 1137, in __del__ self.close() File "/home/languitar/.pyenv/versions/analytics-3.7/lib/python3.7/site-pa...
botocore.exceptions.NoCredentialsError
def _get_with(self, key): # other: fancy integer or otherwise if isinstance(key, slice): # _convert_slice_indexer to determin if this slice is positional # or label based, and if the latter, convert to positional slobj = self.index._convert_slice_indexer(key, kind="getitem") ret...
def _get_with(self, key): # other: fancy integer or otherwise if isinstance(key, slice): # _convert_slice_indexer to determin if this slice is positional # or label based, and if the latter, convert to positional slobj = self.index._convert_slice_indexer(key, kind="getitem") ret...
https://github.com/pandas-dev/pandas/issues/33642
ser = pd.Series(["A", "B"]) key = pd.Series(["C"]) ser[key] C NaN dtype: object ser[pd.Index(key)] C NaN dtype: object ser[np.array(key)] C NaN dtype: object ser[list(key)] Traceback (most recent call last): [...] File "/Users/bmendel/Desktop/pd/pandas/pandas/core/indexing.py", line 1312, in _validate_read...
KeyError
def __getitem__(self, key): if self.ndim == 2 and not self._axes_are_unique: # GH#33041 fall back to .loc if not isinstance(key, tuple) or not all(is_scalar(x) for x in key): raise ValueError("Invalid call for scalar access (getting)!") return self.obj.loc[key] return super(...
def __getitem__(self, key): if self.ndim != 1 or not is_scalar(key): # FIXME: is_scalar check is a kludge return super().__getitem__(key) # Like Index.get_value, but we do not allow positional fallback obj = self.obj loc = obj.index.get_loc(key) return obj.index._get_values_for_loc(...
https://github.com/pandas-dev/pandas/issues/33041
arr = np.random.randn(6).reshape(3, 2) df = pd.DataFrame(arr, columns=["A", "A"]) df.at[0, "A"] Traceback (most recent call last): File "<stdin>", line 1, in <module> File "pandas/core/indexing.py", line 2069, in __getitem__ return super().__getitem__(key) File "pandas/core/indexing.py", line 2034, in __getitem__ retu...
AttributeError
def __setitem__(self, key, value): if self.ndim == 2 and not self._axes_are_unique: # GH#33041 fall back to .loc if not isinstance(key, tuple) or not all(is_scalar(x) for x in key): raise ValueError("Invalid call for scalar access (setting)!") self.obj.loc[key] = value r...
def __setitem__(self, key, value): if isinstance(key, tuple): key = tuple(com.apply_if_callable(x, self.obj) for x in key) else: # scalar callable may return tuple key = com.apply_if_callable(key, self.obj) if not isinstance(key, tuple): key = _tuplify(self.ndim, key) if...
https://github.com/pandas-dev/pandas/issues/33041
arr = np.random.randn(6).reshape(3, 2) df = pd.DataFrame(arr, columns=["A", "A"]) df.at[0, "A"] Traceback (most recent call last): File "<stdin>", line 1, in <module> File "pandas/core/indexing.py", line 2069, in __getitem__ return super().__getitem__(key) File "pandas/core/indexing.py", line 2034, in __getitem__ retu...
AttributeError
def quantile(self, q=0.5, interpolation: str = "linear"): """ Return group values at the given quantile, a la numpy.percentile. Parameters ---------- q : float or array-like, default 0.5 (50% quantile) Value(s) between 0 and 1 providing the quantile(s) to compute. interpolation : {'line...
def quantile(self, q=0.5, interpolation: str = "linear"): """ Return group values at the given quantile, a la numpy.percentile. Parameters ---------- q : float or array-like, default 0.5 (50% quantile) Value(s) between 0 and 1 providing the quantile(s) to compute. interpolation : {'line...
https://github.com/pandas-dev/pandas/issues/33136
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-1-ef27f953b945> in <module> 4 {"a": ["x", "x", "y", "y"], "b": pd.array([1, 2, 3, 4], dtype="Int64")} 5 ) ----> 6 df.groupby("a")["b"].quantile(0.5) ...
TypeError
def pre_processor(vals: np.ndarray) -> Tuple[np.ndarray, Optional[Type]]: if is_object_dtype(vals): raise TypeError("'quantile' cannot be performed against 'object' dtypes!") inference = None if is_integer_dtype(vals.dtype): if is_extension_array_dtype(vals.dtype): vals = vals.t...
def pre_processor(vals: np.ndarray) -> Tuple[np.ndarray, Optional[Type]]: if is_object_dtype(vals): raise TypeError("'quantile' cannot be performed against 'object' dtypes!") inference = None if is_integer_dtype(vals): inference = np.int64 elif is_datetime64_dtype(vals): inferen...
https://github.com/pandas-dev/pandas/issues/33136
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-1-ef27f953b945> in <module> 4 {"a": ["x", "x", "y", "y"], "b": pd.array([1, 2, 3, 4], dtype="Int64")} 5 ) ----> 6 df.groupby("a")["b"].quantile(0.5) ...
TypeError
def __init__( self, filepath_or_buffer, index=None, encoding="ISO-8859-1", chunksize=None ): self._encoding = encoding self._lines_read = 0 self._index = index self._chunksize = chunksize if isinstance(filepath_or_buffer, str): ( filepath_or_buffer, encoding, ...
def __init__( self, filepath_or_buffer, index=None, encoding="ISO-8859-1", chunksize=None ): self._encoding = encoding self._lines_read = 0 self._index = index self._chunksize = chunksize if isinstance(filepath_or_buffer, str): ( filepath_or_buffer, encoding, ...
https://github.com/pandas-dev/pandas/issues/33069
Traceback (most recent call last): File "after.py", line 15, in <module> df = pd.read_sas(f, format="xport") File "/Users/swast/miniconda3/envs/scratch/lib/python3.7/site-packages/pandas/io/sas/sasreader.py", line 70, in read_sas filepath_or_buffer, index=index, encoding=encoding, chunksize=chunksize File "/Users/swast...
AttributeError
def _count_level(self, level, axis=0, numeric_only=False): if numeric_only: frame = self._get_numeric_data() else: frame = self count_axis = frame._get_axis(axis) agg_axis = frame._get_agg_axis(axis) if not isinstance(count_axis, ABCMultiIndex): raise TypeError( ...
def _count_level(self, level, axis=0, numeric_only=False): if numeric_only: frame = self._get_numeric_data() else: frame = self count_axis = frame._get_axis(axis) agg_axis = frame._get_agg_axis(axis) if not isinstance(count_axis, ABCMultiIndex): raise TypeError( ...
https://github.com/pandas-dev/pandas/issues/32841
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/pandas/pandas/core/groupby/generic.py", line 1784, in count blocks = [make_block(val, placement=loc) for val, loc in zip(counted, locs)] File "/pandas/pandas/core/groupby/generic.py", line 1784, in <listcomp> blocks = [make_block(val, placeme...
IndexError
def _convert_slice_indexer(self, key: slice, kind: str_t): """ Convert a slice indexer. By definition, these are labels unless 'iloc' is passed in. Floats are not allowed as the start, step, or stop of the slice. Parameters ---------- key : label of the slice bound kind : {'loc', 'geti...
def _convert_slice_indexer(self, key: slice, kind: str_t): """ Convert a slice indexer. By definition, these are labels unless 'iloc' is passed in. Floats are not allowed as the start, step, or stop of the slice. Parameters ---------- key : label of the slice bound kind : {'loc', 'geti...
https://github.com/pandas-dev/pandas/issues/16121
In [2]: df = pd.DataFrame(-1, index=['i', 'ii', 'iii'], columns=pd.MultiIndex.from_tuples([['A', 'a'], ['B', 'b']])) In [3]: df.loc[1:, 'A'] = '' In [4]: df Out[4]: A B a b i -1 -1 ii -1 iii -1 In [5]: df.loc[1:, 'A'] --------------------------------------------------------------------------- TypeError...
TypeError
def _make_reader(self, f): sep = self.delimiter if sep is None or len(sep) == 1: if self.lineterminator: raise ValueError( "Custom line terminators not supported in python parser (yet)" ) class MyDialect(csv.Dialect): delimiter = self.delimit...
def _make_reader(self, f): sep = self.delimiter if sep is None or len(sep) == 1: if self.lineterminator: raise ValueError( "Custom line terminators not supported in python parser (yet)" ) class MyDialect(csv.Dialect): delimiter = self.delimit...
https://github.com/pandas-dev/pandas/issues/31396
TypeError Traceback (most recent call last) <ipython-input-17-c89b3c3e691f> in <module> ----> 1 pd.read_csv('data.csv', sep=None, comment='#') ~/.local/share/virtualenvs/openqlab/lib/python3.8/site-packages/pandas/io/parsers.py in parser_f(filepath_or_buffer, sep, delimiter, header, nam...
TypeError
def __setitem__(self, key, value) -> None: value = extract_array(value, extract_numpy=True) key = check_array_indexer(self, key) scalar_value = lib.is_scalar(value) if not scalar_value: value = np.asarray(value, dtype=self._ndarray.dtype) self._ndarray[key] = value
def __setitem__(self, key, value) -> None: value = extract_array(value, extract_numpy=True) key = check_array_indexer(self, key) scalar_key = lib.is_scalar(key) scalar_value = lib.is_scalar(value) if not scalar_key and scalar_value: key = np.asarray(key) if not scalar_value: v...
https://github.com/pandas-dev/pandas/issues/31772
In [33]: df = pd.DataFrame({'A': ['a', 'b', 'c']}, dtype='string') In [34]: df.loc[0:, 'A'] = "test" --------------------------------------------------------------------------- IndexError Traceback (most recent call last) <ipython-input-34-bc65087be9d7> in <module> ----> 1 df.loc[0:, 'A'...
IndexError
def from_codes(cls, codes, categories=None, ordered=None, dtype=None): """ Make a Categorical type from codes and categories or dtype. This constructor is useful if you already have codes and categories/dtype and so do not need the (computation intensive) factorization step, which is usually done o...
def from_codes(cls, codes, categories=None, ordered=None, dtype=None): """ Make a Categorical type from codes and categories or dtype. This constructor is useful if you already have codes and categories/dtype and so do not need the (computation intensive) factorization step, which is usually done o...
https://github.com/pandas-dev/pandas/issues/31779
import pandas as pd codes = pd.Series([1, 0], dtype="Int64") pd.Categorical.from_codes(codes, categories=["foo", "bar"]) Traceback (most recent call last): File "<stdin>", line 1, in <module> File ".../lib/python3.7/site-packages/pandas/core/arrays/categorical.py", line 649, in from_codes raise ValueError("codes need t...
ValueError
def insert_statement(self, *, num_rows): names = list(map(str, self.frame.columns)) wld = "?" # wildcard char escape = _get_valid_sqlite_name if self.index is not None: for idx in self.index[::-1]: names.insert(0, idx) bracketed_names = [escape(column) for column in names] ...
def insert_statement(self): names = list(map(str, self.frame.columns)) wld = "?" # wildcard char escape = _get_valid_sqlite_name if self.index is not None: for idx in self.index[::-1]: names.insert(0, idx) bracketed_names = [escape(column) for column in names] col_names = ...
https://github.com/pandas-dev/pandas/issues/29921
INFO - ========================================================================== INFO - Inserting data one per row. INFO - Data inserted successfully! INFO - ========================================================================== INFO - Inserting data with multirow method. ERROR - Error while inserting data wi...
TypeError
def _execute_insert(self, conn, keys, data_iter): data_list = list(data_iter) conn.executemany(self.insert_statement(num_rows=1), data_list)
def _execute_insert(self, conn, keys, data_iter): data_list = list(data_iter) conn.executemany(self.insert_statement(), data_list)
https://github.com/pandas-dev/pandas/issues/29921
INFO - ========================================================================== INFO - Inserting data one per row. INFO - Data inserted successfully! INFO - ========================================================================== INFO - Inserting data with multirow method. ERROR - Error while inserting data wi...
TypeError
def _execute_insert_multi(self, conn, keys, data_iter): data_list = list(data_iter) flattened_data = [x for row in data_list for x in row] conn.execute(self.insert_statement(num_rows=len(data_list)), flattened_data)
def _execute_insert_multi(self, conn, keys, data_iter): """Alternative to _execute_insert for DBs support multivalue INSERT. Note: multi-value insert is usually faster for analytics DBs and tables containing a few columns but performance degrades quickly with increase of columns. """ data = [di...
https://github.com/pandas-dev/pandas/issues/29921
INFO - ========================================================================== INFO - Inserting data one per row. INFO - Data inserted successfully! INFO - ========================================================================== INFO - Inserting data with multirow method. ERROR - Error while inserting data wi...
TypeError
def pivot(data: "DataFrame", index=None, columns=None, values=None) -> "DataFrame": if columns is None: raise TypeError("pivot() missing 1 required argument: 'columns'") columns = columns if is_list_like(columns) else [columns] if values is None: cols: List[str] = [] if index is Non...
def pivot(data: "DataFrame", index=None, columns=None, values=None) -> "DataFrame": if columns is None: raise TypeError("pivot() missing 1 required argument: 'columns'") if values is None: cols = [columns] if index is None else [index, columns] append = index is None indexed = d...
https://github.com/pandas-dev/pandas/issues/21425
In [1]: df = pd.DataFrame({'lev1': [1, 1, 1, 1,2, 2, 2,2], 'lev2': [1, 1, 2, 2, 1, 1, 2, 2], 'lev3': [1, 2, 1, 2, 1, 2, 1, 2], 'values': range(8)}) In [2]: df Out[2]: lev1 lev2 lev3 values 0 1 1 1 0 1 1 1 2 1 2 1 2 1 2 3 1 2 2 3 4 2 1 ...
ValueError
def holidays(self, start=None, end=None, return_name=False): """ Returns a curve with holidays between start_date and end_date Parameters ---------- start : starting date, datetime-like, optional end : ending date, datetime-like, optional return_name : bool, optional If True, return...
def holidays(self, start=None, end=None, return_name=False): """ Returns a curve with holidays between start_date and end_date Parameters ---------- start : starting date, datetime-like, optional end : ending date, datetime-like, optional return_name : bool, optional If True, return...
https://github.com/pandas-dev/pandas/issues/31415
In [58]: cal.holidays(pd.Timestamp('01-Jan-2020'), pd.Timestamp('01-Jan-2021')) Traceback (most recent call last): File "<ipython-input-58-022244d4e794>", line 1, in <module> cal.holidays(pd.Timestamp('01-Jan-2020'), pd.Timestamp('01-Jan-2021')) File "C:\Users\dhirschf\envs\dev\lib\site-packages\pandas\tseries\holida...
AttributeError
def astype(self, dtype, copy=True): """ Cast to a NumPy array or IntegerArray with 'dtype'. Parameters ---------- dtype : str or dtype Typecode or data-type to which the array is cast. copy : bool, default True Whether to copy the data, even if not necessary. If False, a...
def astype(self, dtype, copy=True): """ Cast to a NumPy array or IntegerArray with 'dtype'. Parameters ---------- dtype : str or dtype Typecode or data-type to which the array is cast. copy : bool, default True Whether to copy the data, even if not necessary. If False, a...
https://github.com/pandas-dev/pandas/issues/31102
In [23]: a = pd.array([1, 0, pd.NA]) In [24]: a Out[24]: <IntegerArray> [1, 0, <NA>] Length: 3, dtype: Int64 In [25]: a.astype("boolean") --------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-25-41973ed53e...
ValueError
def _concat_objects(self, keys, values, not_indexed_same: bool = False): from pandas.core.reshape.concat import concat def reset_identity(values): # reset the identities of the components # of the values to prevent aliasing for v in com.not_none(*values): ax = v._get_axis(se...
def _concat_objects(self, keys, values, not_indexed_same: bool = False): from pandas.core.reshape.concat import concat def reset_identity(values): # reset the identities of the components # of the values to prevent aliasing for v in com.not_none(*values): ax = v._get_axis(se...
https://github.com/pandas-dev/pandas/issues/30667
Traceback (most recent call last): File "/home/hm106930/.local/share/virtualenvs/ipv-work-62kMEXht/lib/python3.6/site-packages/pandas/core/groupby/groupby.py", line 725, in apply result = self._python_apply_general(f) File "/home/hm106930/.local/share/virtualenvs/ipv-work-62kMEXht/lib/python3.6/site-packages/pandas/cor...
ValueError
def pivot_table( data, values=None, index=None, columns=None, aggfunc="mean", fill_value=None, margins=False, dropna=True, margins_name="All", observed=False, ) -> "DataFrame": index = _convert_by(index) columns = _convert_by(columns) if isinstance(aggfunc, list): ...
def pivot_table( data, values=None, index=None, columns=None, aggfunc="mean", fill_value=None, margins=False, dropna=True, margins_name="All", observed=False, ) -> "DataFrame": index = _convert_by(index) columns = _convert_by(columns) if isinstance(aggfunc, list): ...
https://github.com/pandas-dev/pandas/issues/17038
In [21]: df = pd.DataFrame({'k': [1, 2, 3], 'v': [4, 5, 6]}) In [22]: df.pivot_table(values='v', columns='k') Out[22]: k 1 2 3 v 4 5 6 In [23]: df.pivot_table(values='v', index='k') Out[23]: v k 1 4 2 5 3 6 In [24]: df2 = pd.DataFrame({'k1': [1, 2, 3], 'k2': [1, 2, 3], 'v': [4, 5, 6]}) In [25]: df2.pivot_t...
AttributeError
def rename( self, mapper: Optional[Renamer] = None, *, index: Optional[Renamer] = None, columns: Optional[Renamer] = None, axis: Optional[Axis] = None, copy: bool = True, inplace: bool = False, level: Optional[Level] = None, errors: str = "ignore", ) -> Optional["DataFrame"]: ...
def rename(self, *args, **kwargs): """ Alter axes labels. Function / dict values must be unique (1-to-1). Labels not contained in a dict / Series will be left as-is. Extra labels listed don't throw an error. See the :ref:`user guide <basics.rename>` for more. Parameters ---------- ...
https://github.com/pandas-dev/pandas/issues/29136
df = pd.DataFrame([[1]]) df.rename({0: 1}, columns={0: 2}, axis=1) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/williamayd/clones/pandas/pandas/util/_decorators.py", line 235, in wrapper return func(*args, **kwargs) File "/Users/williamayd/clones/pandas/pandas/core/frame.py", line...
TypeError
def rename( self: FrameOrSeries, mapper: Optional[Renamer] = None, *, index: Optional[Renamer] = None, columns: Optional[Renamer] = None, axis: Optional[Axis] = None, copy: bool = True, inplace: bool = False, level: Optional[Level] = None, errors: str = "ignore", ) -> Optional[Fr...
def rename(self, *args, **kwargs): """ Alter axes input function or functions. Function / dict values must be unique (1-to-1). Labels not contained in a dict / Series will be left as-is. Extra labels listed don't throw an error. Alternatively, change ``Series.name`` with a scalar value (Series only)...
https://github.com/pandas-dev/pandas/issues/29136
df = pd.DataFrame([[1]]) df.rename({0: 1}, columns={0: 2}, axis=1) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/williamayd/clones/pandas/pandas/util/_decorators.py", line 235, in wrapper return func(*args, **kwargs) File "/Users/williamayd/clones/pandas/pandas/core/frame.py", line...
TypeError
def add_prefix(self: FrameOrSeries, prefix: str) -> FrameOrSeries: """ Prefix labels with string `prefix`. For Series, the row labels are prefixed. For DataFrame, the column labels are prefixed. Parameters ---------- prefix : str The string to add before each label. Returns ...
def add_prefix(self: FrameOrSeries, prefix: str) -> FrameOrSeries: """ Prefix labels with string `prefix`. For Series, the row labels are prefixed. For DataFrame, the column labels are prefixed. Parameters ---------- prefix : str The string to add before each label. Returns ...
https://github.com/pandas-dev/pandas/issues/29136
df = pd.DataFrame([[1]]) df.rename({0: 1}, columns={0: 2}, axis=1) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/williamayd/clones/pandas/pandas/util/_decorators.py", line 235, in wrapper return func(*args, **kwargs) File "/Users/williamayd/clones/pandas/pandas/core/frame.py", line...
TypeError
def add_suffix(self: FrameOrSeries, suffix: str) -> FrameOrSeries: """ Suffix labels with string `suffix`. For Series, the row labels are suffixed. For DataFrame, the column labels are suffixed. Parameters ---------- suffix : str The string to add after each label. Returns ...
def add_suffix(self: FrameOrSeries, suffix: str) -> FrameOrSeries: """ Suffix labels with string `suffix`. For Series, the row labels are suffixed. For DataFrame, the column labels are suffixed. Parameters ---------- suffix : str The string to add after each label. Returns ...
https://github.com/pandas-dev/pandas/issues/29136
df = pd.DataFrame([[1]]) df.rename({0: 1}, columns={0: 2}, axis=1) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/williamayd/clones/pandas/pandas/util/_decorators.py", line 235, in wrapper return func(*args, **kwargs) File "/Users/williamayd/clones/pandas/pandas/core/frame.py", line...
TypeError
def argsort(self, axis=0, kind="quicksort", order=None): """ Override ndarray.argsort. Argsorts the value, omitting NA/null values, and places the result in the same locations as the non-NA values. Parameters ---------- axis : {0 or "index"} Has no effect but is accepted for compatibili...
def argsort(self, axis=0, kind="quicksort", order=None): """ Override ndarray.argsort. Argsorts the value, omitting NA/null values, and places the result in the same locations as the non-NA values. Parameters ---------- axis : int Has no effect but is accepted for compatibility with num...
https://github.com/pandas-dev/pandas/issues/29136
df = pd.DataFrame([[1]]) df.rename({0: 1}, columns={0: 2}, axis=1) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/williamayd/clones/pandas/pandas/util/_decorators.py", line 235, in wrapper return func(*args, **kwargs) File "/Users/williamayd/clones/pandas/pandas/core/frame.py", line...
TypeError
def rename( self, index=None, *, axis=None, copy=True, inplace=False, level=None, errors="ignore", ): """ Alter Series index labels or name. Function / dict values must be unique (1-to-1). Labels not contained in a dict / Series will be left as-is. Extra labels listed do...
def rename(self, index=None, **kwargs): """ Alter Series index labels or name. Function / dict values must be unique (1-to-1). Labels not contained in a dict / Series will be left as-is. Extra labels listed don't throw an error. Alternatively, change ``Series.name`` with a scalar value. S...
https://github.com/pandas-dev/pandas/issues/29136
df = pd.DataFrame([[1]]) df.rename({0: 1}, columns={0: 2}, axis=1) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/williamayd/clones/pandas/pandas/util/_decorators.py", line 235, in wrapper return func(*args, **kwargs) File "/Users/williamayd/clones/pandas/pandas/core/frame.py", line...
TypeError
def __init__(self, f: IO): self.mmap = mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ)
def __init__(self, f: BinaryIO, encoding: str): self.reader = codecs.getreader(encoding)(f)
https://github.com/pandas-dev/pandas/issues/24130
In [4]: with tempfile.TemporaryFile(mode='w+', encoding='utf16') as outfile: ...: outfile.write('foo') ...: outfile.seek(0) ...: pd.read_csv(outfile, encoding='utf16') UnicodeDecodeError: 'utf-16-le' codec can't decode byte 0x6f in position 2: truncated data In [4]: with tempfile.TemporaryFile(mode='w+', e...
UnicodeDecodeError
def __next__(self) -> str: newbytes = self.mmap.readline() # readline returns bytes, not str, but Python's CSV reader # expects str, so convert the output to str before continuing newline = newbytes.decode("utf-8") # mmap doesn't raise if reading past the allocated # data but instead returns a...
def __next__(self) -> bytes: return next(self.reader).encode("utf-8")
https://github.com/pandas-dev/pandas/issues/24130
In [4]: with tempfile.TemporaryFile(mode='w+', encoding='utf16') as outfile: ...: outfile.write('foo') ...: outfile.seek(0) ...: pd.read_csv(outfile, encoding='utf16') UnicodeDecodeError: 'utf-16-le' codec can't decode byte 0x6f in position 2: truncated data In [4]: with tempfile.TemporaryFile(mode='w+', e...
UnicodeDecodeError
def __init__(self, src, **kwds): self.kwds = kwds kwds = kwds.copy() ParserBase.__init__(self, kwds) encoding = kwds.get("encoding") if kwds.get("compression") is None and encoding: if isinstance(src, str): src = open(src, "rb") self.handles.append(src) # ...
def __init__(self, src, **kwds): self.kwds = kwds kwds = kwds.copy() ParserBase.__init__(self, kwds) if kwds.get("compression") is None and "utf-16" in (kwds.get("encoding") or ""): # if source is utf-16 plain text, convert source to utf-8 if isinstance(src, str): src = ope...
https://github.com/pandas-dev/pandas/issues/24130
In [4]: with tempfile.TemporaryFile(mode='w+', encoding='utf16') as outfile: ...: outfile.write('foo') ...: outfile.seek(0) ...: pd.read_csv(outfile, encoding='utf16') UnicodeDecodeError: 'utf-16-le' codec can't decode byte 0x6f in position 2: truncated data In [4]: with tempfile.TemporaryFile(mode='w+', e...
UnicodeDecodeError
def pct_change(self, periods=1, fill_method="pad", limit=None, freq=None, **kwargs): # TODO: Not sure if above is correct - need someone to confirm. axis = self._get_axis_number(kwargs.pop("axis", self._stat_axis_name)) if fill_method is None: data = self else: data = self.fillna(method=...
def pct_change(self, periods=1, fill_method="pad", limit=None, freq=None, **kwargs): # TODO: Not sure if above is correct - need someone to confirm. axis = self._get_axis_number(kwargs.pop("axis", self._stat_axis_name)) if fill_method is None: data = self else: data = self.fillna(method=...
https://github.com/pandas-dev/pandas/issues/30463
data.reset_index().groupby('index')[0].pct_change(1, fill_method=None, limit=1) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-18-60898304743e> in <module> ----> 1 data.reset_index().groupby('index')[...
TypeError
def init_ndarray(values, index, columns, dtype=None, copy=False): # input must be a ndarray, list, Series, index if isinstance(values, ABCSeries): if columns is None: if values.name is not None: columns = [values.name] if index is None: index = values.ind...
def init_ndarray(values, index, columns, dtype=None, copy=False): # input must be a ndarray, list, Series, index if isinstance(values, ABCSeries): if columns is None: if values.name is not None: columns = [values.name] if index is None: index = values.ind...
https://github.com/pandas-dev/pandas/issues/12513
TypeError Traceback (most recent call last) <ipython-input-4-7101cf798aa3> in <module>() ----> 1 df = pd.DataFrame(array_dim2 , dtype='datetime64[ns, UTC]') C:\D\Projects\Github\pandas\pandas\core\frame.py in __init__(self, data, index, columns, dtype, copy) 252 else: 253 ...
TypeError
def quantile(self, q=0.5, interpolation: str = "linear"): """ Return group values at the given quantile, a la numpy.percentile. Parameters ---------- q : float or array-like, default 0.5 (50% quantile) Value(s) between 0 and 1 providing the quantile(s) to compute. interpolation : {'line...
def quantile(self, q=0.5, interpolation: str = "linear"): """ Return group values at the given quantile, a la numpy.percentile. Parameters ---------- q : float or array-like, default 0.5 (50% quantile) Value(s) between 0 and 1 providing the quantile(s) to compute. interpolation : {'line...
https://github.com/pandas-dev/pandas/issues/30289
# Your code here df = pd.DataFrame(np.array([10*[_%4] for _ in range(100)])) df.groupby(0).quantile(0.5) # Out[19]: # 1 2 3 4 5 6 7 8 9 # 0 # 0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 # 1 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 # 2 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 # 3 ...
AssertionError
def __new__( cls, data=None, dtype=None, copy=False, name=None, tupleize_cols=True, **kwargs, ) -> "Index": from .range import RangeIndex from pandas import PeriodIndex, DatetimeIndex, TimedeltaIndex from .numeric import Float64Index, Int64Index, UInt64Index from .interval im...
def __new__( cls, data=None, dtype=None, copy=False, name=None, tupleize_cols=True, **kwargs, ) -> "Index": from .range import RangeIndex from pandas import PeriodIndex, DatetimeIndex, TimedeltaIndex from .numeric import Float64Index, Int64Index, UInt64Index from .interval im...
https://github.com/pandas-dev/pandas/issues/29069
In [5]: pd.Series([], name=[]) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-5-2c73ddde103e> in <module> ----> 1 pd.Series([], name=[]) ~/sandbox/pandas/pandas/core/series.py in __init__(self, data,...
TypeError
def _simple_new(cls, values, name=None, dtype=None): """ We require that we have a dtype compat for the values. If we are passed a non-dtype compat, then coerce using the constructor. Must be careful not to recurse. """ if isinstance(values, (ABCSeries, ABCIndexClass)): # Index._data mu...
def _simple_new(cls, values, name=None, dtype=None): """ We require that we have a dtype compat for the values. If we are passed a non-dtype compat, then coerce using the constructor. Must be careful not to recurse. """ if isinstance(values, (ABCSeries, ABCIndexClass)): # Index._data mu...
https://github.com/pandas-dev/pandas/issues/29069
In [5]: pd.Series([], name=[]) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-5-2c73ddde103e> in <module> ----> 1 pd.Series([], name=[]) ~/sandbox/pandas/pandas/core/series.py in __init__(self, data,...
TypeError
def _set_names(self, values, level=None): """ Set new names on index. Each name has to be a hashable type. Parameters ---------- values : str or sequence name(s) to set level : int, level name, or sequence of int/level names (default None) If the index is a MultiIndex (hierarchi...
def _set_names(self, values, level=None): """ Set new names on index. Each name has to be a hashable type. Parameters ---------- values : str or sequence name(s) to set level : int, level name, or sequence of int/level names (default None) If the index is a MultiIndex (hierarchi...
https://github.com/pandas-dev/pandas/issues/29069
In [5]: pd.Series([], name=[]) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-5-2c73ddde103e> in <module> ----> 1 pd.Series([], name=[]) ~/sandbox/pandas/pandas/core/series.py in __init__(self, data,...
TypeError
def droplevel(self, level=0): """ Return index with requested level(s) removed. If resulting index has only 1 level left, the result will be of Index type, not MultiIndex. .. versionadded:: 0.23.1 (support for non-MultiIndex) Parameters ---------- level : int, str, or list-like, defau...
def droplevel(self, level=0): """ Return index with requested level(s) removed. If resulting index has only 1 level left, the result will be of Index type, not MultiIndex. .. versionadded:: 0.23.1 (support for non-MultiIndex) Parameters ---------- level : int, str, or list-like, defau...
https://github.com/pandas-dev/pandas/issues/29069
In [5]: pd.Series([], name=[]) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-5-2c73ddde103e> in <module> ----> 1 pd.Series([], name=[]) ~/sandbox/pandas/pandas/core/series.py in __init__(self, data,...
TypeError
def __setstate__(self, state): """ Necessary for making this object picklable. """ if isinstance(state, dict): self._data = state.pop("data") for k, v in state.items(): setattr(self, k, v) elif isinstance(state, tuple): if len(state) == 2: nd_state, ...
def __setstate__(self, state): """ Necessary for making this object picklable. """ if isinstance(state, dict): self._data = state.pop("data") for k, v in state.items(): setattr(self, k, v) elif isinstance(state, tuple): if len(state) == 2: nd_state, ...
https://github.com/pandas-dev/pandas/issues/29069
In [5]: pd.Series([], name=[]) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-5-2c73ddde103e> in <module> ----> 1 pd.Series([], name=[]) ~/sandbox/pandas/pandas/core/series.py in __init__(self, data,...
TypeError
def __new__( cls, data=None, categories=None, ordered=None, dtype=None, copy=False, name=None, ): dtype = CategoricalDtype._from_values_or_dtype(data, categories, ordered, dtype) name = maybe_extract_name(name, data, cls) if not is_categorical_dtype(data): # don't allow...
def __new__( cls, data=None, categories=None, ordered=None, dtype=None, copy=False, name=None, ): dtype = CategoricalDtype._from_values_or_dtype(data, categories, ordered, dtype) if name is None and hasattr(data, "name"): name = data.name if not is_categorical_dtype(dat...
https://github.com/pandas-dev/pandas/issues/29069
In [5]: pd.Series([], name=[]) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-5-2c73ddde103e> in <module> ----> 1 pd.Series([], name=[]) ~/sandbox/pandas/pandas/core/series.py in __init__(self, data,...
TypeError