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 _gotitem(self, key, ndim, subset=None):
# we are setting the index on the actual object
# here so our index is carried thru to the selected obj
# when we do the splitting for the groupby
if self.on is not None:
self._groupby.obj = self._groupby.obj.set_index(self._on)
self.on = None
... | def _gotitem(self, key, ndim, subset=None):
"""
sub-classes to define
return a sliced object
Parameters
----------
key : string / list of selections
ndim : 1,2
requested ndim of result
subset : object, default None
subset to act on
"""
# create a new object to p... | https://github.com/pandas-dev/pandas/issues/15130 | In [7]: dates_df.groupby('name').rolling('180D', on='date')['amount'].sum()
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-7-8896cb99a66a> in <module>()
----> 1 dates_df.groupby('name').rolling('180D'... | ValueError |
def _infer_columns(self):
names = self.names
num_original_columns = 0
clear_buffer = True
if self.header is not None:
header = self.header
# we have a mi columns, so read an extra line
if isinstance(header, (list, tuple, np.ndarray)):
have_mi_columns = True
... | def _infer_columns(self):
names = self.names
num_original_columns = 0
clear_buffer = True
if self.header is not None:
header = self.header
# we have a mi columns, so read an extra line
if isinstance(header, (list, tuple, np.ndarray)):
have_mi_columns = True
... | https://github.com/pandas-dev/pandas/issues/6710 | In [98]: mydata='1,2,3\n1,2\n1,2\n'
In [99]: pd.read_csv(StringIO(mydata), names=['a', 'b', 'c'], usecols=['a', 'c'])
Out[99]:
a c
0 1 3
1 1 NaN
2 1 NaN
[3 rows x 2 columns]
In [100]: mydata='1,2\n1,2,3\n4,5,6\n'
In [101]: pd.read_csv(StringIO(mydata), names=['a', 'b', 'c'], usecols=['a', 'c'])
----------------... | CParserError |
def _getitem_axis(self, key, axis=0):
labels = self.obj._get_axis(axis)
key = self._get_partial_string_timestamp_match_key(key, labels)
if isinstance(key, slice):
self._has_valid_type(key, axis)
return self._get_slice_axis(key, axis=axis)
elif is_bool_indexer(key):
return self._... | def _getitem_axis(self, key, axis=0):
labels = self.obj._get_axis(axis)
key = self._get_partial_string_timestamp_match_key(key, labels)
if isinstance(key, slice):
self._has_valid_type(key, axis)
return self._get_slice_axis(key, axis=axis)
elif is_bool_indexer(key):
return self._... | https://github.com/pandas-dev/pandas/issues/14730 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/home/owl/miniconda3/envs/p3/lib/python3.5/site-packages/pandas/core/indexing.py in _get_label(self, label, axis)
94 try:
---> 95 return sel... | TypeError |
def _write_body(self, indent):
self.write("<tbody>", indent)
indent += self.indent_delta
fmt_values = {}
for i in range(min(len(self.columns), self.max_cols)):
fmt_values[i] = self.fmt._format_col(i)
# write values
if self.fmt.index:
if isinstance(self.frame.index, MultiIndex):... | def _write_body(self, indent):
self.write("<tbody>", indent)
indent += self.indent_delta
fmt_values = {}
for i in range(min(len(self.columns), self.max_cols)):
fmt_values[i] = self.fmt._format_col(i)
# write values
if self.fmt.index:
if isinstance(self.frame.index, MultiIndex):... | https://github.com/pandas-dev/pandas/issues/14998 | ---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-7-c16b7151f39c> in <module>()
----> 1 df.to_html(max_rows=10, index=False)
/Users/tom.augspurger/Envs/py3/lib/python3.6/site-packages/pandas-0.19.0+265.... | IndexError |
def create_axes(
self,
axes,
obj,
validate=True,
nan_rep=None,
data_columns=None,
min_itemsize=None,
**kwargs,
):
"""create and return the axes
leagcy tables create an indexable column, indexable index,
non-indexable fields
Parameters:
-----------
axe... | def create_axes(
self,
axes,
obj,
validate=True,
nan_rep=None,
data_columns=None,
min_itemsize=None,
**kwargs,
):
"""create and return the axes
leagcy tables create an indexable column, indexable index,
non-indexable fields
Parameters:
-----------
axe... | https://github.com/pandas-dev/pandas/issues/10381 | In [25]: df.index.name = 'theindex'
In [26]: df.to_hdf('store.h5', 'test2', format='table', min_itemsize={'theindex': 10})
---------------------------------------------------------------------------
ValueError Traceback (most recent call last) | ValueError |
def nunique(self, dropna=True):
"""Returns number of unique elements in the group"""
ids, _, _ = self.grouper.group_info
val = self.obj.get_values()
try:
sorter = np.lexsort((val, ids))
except TypeError: # catches object dtypes
assert val.dtype == object, "val.dtype must be object... | def nunique(self, dropna=True):
"""Returns number of unique elements in the group"""
ids, _, _ = self.grouper.group_info
val = self.obj.get_values()
try:
sorter = np.lexsort((val, ids))
except TypeError: # catches object dtypes
assert val.dtype == object, "val.dtype must be object,... | https://github.com/pandas-dev/pandas/issues/12553 | In [18]: b = pandas.Series()
In [19]: g = b.groupby(level = 0)
In [20]: g.nunique()
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-20-fbbfc3108eac> in <module>()
----> 1 g.nunique()
/usr/local/lib/... | IndexError |
def read(self, nrows=None):
if (nrows is None) and (self.chunksize is not None):
nrows = self.chunksize
elif nrows is None:
nrows = self.row_count
if self._current_row_in_file_index >= self.row_count:
return None
m = self.row_count - self._current_row_in_file_index
if nrows... | def read(self, nrows=None):
if (nrows is None) and (self.chunksize is not None):
nrows = self.chunksize
elif nrows is None:
nrows = self.row_count
if self._current_row_in_file_index >= self.row_count:
return None
nd = (self.column_types == b"d").sum()
ns = (self.column_type... | https://github.com/pandas-dev/pandas/issues/13654 | import pandas as pd
f = pd.read_sas('test.sas7bdat', iterator=True)
for chunk in f:
print(f)
---------------------------------------------------------------------------
AbstractMethodError Traceback (most recent call last)
<ipython-input-3-bedf2769bffe> in <module>()
----> 1 for chunk in f:
2 ... | AbstractMethodError |
def _generate(
cls,
start,
end,
periods,
name,
offset,
tz=None,
normalize=False,
ambiguous="raise",
closed=None,
):
if com._count_not_none(start, end, periods) != 2:
raise ValueError("Must specify two of start, end, or periods")
_normalized = True
if start i... | def _generate(
cls,
start,
end,
periods,
name,
offset,
tz=None,
normalize=False,
ambiguous="raise",
closed=None,
):
if com._count_not_none(start, end, periods) != 2:
raise ValueError("Must specify two of start, end, or periods")
_normalized = True
if start i... | https://github.com/pandas-dev/pandas/issues/14682 | Traceback (most recent call last):
File "./t.py", line 7, in <module>
dfo = df.groupby(pd.TimeGrouper('5min'))
File "/usr/local/lib/python2.7/dist-packages/pandas/core/generic.py", line 3984, in groupby
**kwargs)
File "/usr/local/lib/python2.7/dist-packages/pandas/core/groupby.py", line 1501, in groupby
return klass(ob... | pytz.exceptions.AmbiguousTimeError |
def _adjust_dates_anchored(first, last, offset, closed="right", base=0):
# First and last offsets should be calculated from the start day to fix an
# error cause by resampling across multiple days when a one day period is
# not a multiple of the frequency.
#
# See https://github.com/pandas-dev/panda... | def _adjust_dates_anchored(first, last, offset, closed="right", base=0):
# First and last offsets should be calculated from the start day to fix an
# error cause by resampling across multiple days when a one day period is
# not a multiple of the frequency.
#
# See https://github.com/pandas-dev/panda... | https://github.com/pandas-dev/pandas/issues/14682 | Traceback (most recent call last):
File "./t.py", line 7, in <module>
dfo = df.groupby(pd.TimeGrouper('5min'))
File "/usr/local/lib/python2.7/dist-packages/pandas/core/generic.py", line 3984, in groupby
**kwargs)
File "/usr/local/lib/python2.7/dist-packages/pandas/core/groupby.py", line 1501, in groupby
return klass(ob... | pytz.exceptions.AmbiguousTimeError |
def read_clipboard(sep="\s+", **kwargs): # pragma: no cover
r"""
Read text from clipboard and pass to read_table. See read_table for the
full argument list
Parameters
----------
sep : str, default '\s+'.
A string or regex delimiter. The default of '\s+' denotes
one or more whit... | def read_clipboard(sep="\s+", **kwargs): # pragma: no cover
r"""
Read text from clipboard and pass to read_table. See read_table for the
full argument list
Parameters
----------
sep : str, default '\s+'.
A string or regex delimiter. The default of '\s+' denotes
one or more whit... | https://github.com/pandas-dev/pandas/issues/14362 | # Your code here
In [1]: df = pd.DataFrame(np.random.randn(10, 2))
In [2]: df.to_clipboard()
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
<ipython-input-2-1f8b11f0ff98> in <module>()
----> 1 df.to_clipboard()
c:... | OSError |
def to_clipboard(obj, excel=None, sep=None, **kwargs): # pragma: no cover
"""
Attempt to write text representation of object to the system clipboard
The clipboard can be then pasted into Excel for example.
Parameters
----------
obj : the object to write to the clipboard
excel : boolean, de... | def to_clipboard(obj, excel=None, sep=None, **kwargs): # pragma: no cover
"""
Attempt to write text representation of object to the system clipboard
The clipboard can be then pasted into Excel for example.
Parameters
----------
obj : the object to write to the clipboard
excel : boolean, de... | https://github.com/pandas-dev/pandas/issues/14362 | # Your code here
In [1]: df = pd.DataFrame(np.random.randn(10, 2))
In [2]: df.to_clipboard()
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
<ipython-input-2-1f8b11f0ff98> in <module>()
----> 1 df.to_clipboard()
c:... | OSError |
def read_clipboard(**kwargs): # pragma: no cover
"""
Read text from clipboard and pass to read_table. See read_table for the
full argument list
If unspecified, `sep` defaults to '\s+'
Returns
-------
parsed : DataFrame
"""
encoding = kwargs.pop("encoding", "utf-8")
# only utf... | def read_clipboard(**kwargs): # pragma: no cover
"""
Read text from clipboard and pass to read_table. See read_table for the
full argument list
If unspecified, `sep` defaults to '\s+'
Returns
-------
parsed : DataFrame
"""
from pandas.util.clipboard import clipboard_get
from p... | https://github.com/pandas-dev/pandas/issues/14362 | # Your code here
In [1]: df = pd.DataFrame(np.random.randn(10, 2))
In [2]: df.to_clipboard()
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
<ipython-input-2-1f8b11f0ff98> in <module>()
----> 1 df.to_clipboard()
c:... | OSError |
def _sanitize_array(data, index, dtype=None, copy=False, raise_cast_failure=False):
"""sanitize input data to an ndarray, copy if specified, coerce to the
dtype if specified
"""
if dtype is not None:
dtype = _coerce_to_dtype(dtype)
if isinstance(data, ma.MaskedArray):
mask = ma.get... | def _sanitize_array(data, index, dtype=None, copy=False, raise_cast_failure=False):
"""sanitize input data to an ndarray, copy if specified, coerce to the
dtype if specified
"""
if dtype is not None:
dtype = _coerce_to_dtype(dtype)
if isinstance(data, ma.MaskedArray):
mask = ma.get... | https://github.com/pandas-dev/pandas/issues/14381 | In [3]: pd.DataFrame(dict(a=None),index=[0])
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-3-20b65f605ca3> in <module>()
----> 1 pd.DataFrame(dict(a=None),index=[0])
miniconda2/envs/readout2/lib/pyt... | AttributeError |
def __init__(
self, index, grouper=None, obj=None, name=None, level=None, sort=True, in_axis=False
):
self.name = name
self.level = level
self.grouper = _convert_grouper(index, grouper)
self.index = index
self.sort = sort
self.obj = obj
self.in_axis = in_axis
# right place for this?... | def __init__(
self, index, grouper=None, obj=None, name=None, level=None, sort=True, in_axis=False
):
self.name = name
self.level = level
self.grouper = _convert_grouper(index, grouper)
self.index = index
self.sort = sort
self.obj = obj
self.in_axis = in_axis
# right place for this?... | https://github.com/pandas-dev/pandas/issues/14334 | In [27]: df.groupby([pd.Grouper(key='A')]).count()
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-27-f4f86763ebfc> in <module>()
----> 1 df.groupby([pd.Grouper(key='A')]).count()
/Users/measejm1/anac... | TypeError |
def _groupby_indices(values):
if is_categorical_dtype(values):
# we have a categorical, so we can do quite a bit
# bit better than factorizing again
reverse = dict(enumerate(values.categories))
codes = values.codes.astype("int64")
mask = 0 <= codes
counts = np.bincou... | def _groupby_indices(values):
if is_categorical_dtype(values):
# we have a categorical, so we can do quite a bit
# bit better than factorizing again
reverse = dict(enumerate(values.categories))
codes = values.codes.astype("int64")
_, counts = _hash.value_count_int64(codes, Fa... | https://github.com/pandas-dev/pandas/issues/13629 | 0
0
(0, 5] 3.333333
(5, 10] 7.500000
(10, 15] 11.000000
(15, 20] NaN
(20, 25] 24.500000
(25, 30] NaN
(30, 35] NaN
(35, 40] 36.000000
(40, 45] NaN
(45, 50] NaN
(50, 55] NaN
0
0
(0, 5] 3.5
(5, 10] 7.5
(10, 15] 11.0
(15, 20] 18.0
(20, 25] 24.5
(25, 30] 30.5
(3... | KeyError |
def _getitem_lowerdim(self, tup):
# we can directly get the axis result since the axis is specified
if self.axis is not None:
axis = self.obj._get_axis_number(self.axis)
return self._getitem_axis(tup, axis=axis)
# we may have a nested tuples indexer here
if self._is_nested_tuple_indexer... | def _getitem_lowerdim(self, tup):
# we can directly get the axis result since the axis is specified
if self.axis is not None:
axis = self.obj._get_axis_number(self.axis)
return self._getitem_axis(tup, axis=axis)
# we may have a nested tuples indexer here
if self._is_nested_tuple_indexer... | https://github.com/pandas-dev/pandas/issues/13797 | df1.iloc[0,0]
C:\Users\rikuhiro\Anaconda3\envs\pd-check\lib\site-packages\ipykernel\__main__.py:1: PerformanceWarning: indexing past lexsort depth may impact performance.
if __name__ == '__main__':
---------------------------------------------------------------------------
AttributeError Trac... | AttributeError |
def _convert_to_array(self, values, name=None, other=None):
"""converts values to ndarray"""
from pandas.tseries.timedeltas import to_timedelta
ovalues = values
supplied_dtype = None
if not is_list_like(values):
values = np.array([values])
# if this is a Series that contains relevant dt... | def _convert_to_array(self, values, name=None, other=None):
"""converts values to ndarray"""
from pandas.tseries.timedeltas import to_timedelta
ovalues = values
supplied_dtype = None
if not is_list_like(values):
values = np.array([values])
# if this is a Series that contains relevant dt... | https://github.com/pandas-dev/pandas/issues/14088 | import pytz
import datetime
import pandas as pd
foo = pd.Series(datetime.datetime(2016, 8, 23, 12, tzinfo=pytz.utc))
foo - datetime.datetime(2016, 8, 22, 12, tzinfo=pytz.utc)
---------------------------------------------------------------------------
ValueError Traceback (most recent ca... | ValueError |
def fillna(self, value=None, method=None, limit=None):
"""Fill NA/NaN values using the specified method.
Parameters
----------
method : {'backfill', 'bfill', 'pad', 'ffill', None}, default None
Method to use for filling holes in reindexed Series
pad / ffill: propagate last valid observa... | def fillna(self, value=None, method=None, limit=None):
"""Fill NA/NaN values using the specified method.
Parameters
----------
method : {'backfill', 'bfill', 'pad', 'ffill', None}, default None
Method to use for filling holes in reindexed Series
pad / ffill: propagate last valid observa... | https://github.com/pandas-dev/pandas/issues/14021 | ---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
/home/dan/.local/opt/miniconda3/envs/mathbs/lib/python3.5/site-packages/pandas/indexes/base.py in get_loc(self, key, method, tolerance)
1875 try:
-> 1876 ... | KeyError |
def _is_offset(self, arr_or_obj):
"""check if obj or all elements of list-like is DateOffset"""
if isinstance(arr_or_obj, pd.DateOffset):
return True
elif is_list_like(arr_or_obj) and len(arr_or_obj):
return all(isinstance(x, pd.DateOffset) for x in arr_or_obj)
return False
| def _is_offset(self, arr_or_obj):
"""check if obj or all elements of list-like is DateOffset"""
if isinstance(arr_or_obj, pd.DateOffset):
return True
elif is_list_like(arr_or_obj):
return all(isinstance(x, pd.DateOffset) for x in arr_or_obj)
else:
return False
| https://github.com/pandas-dev/pandas/issues/13844 | Date_Time Item Relative_Time
0 2/8/2015 6:00:30 1 20
/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pandas/core/ops.py:477: PerformanceWarning: Adding/subtracting array of DateOffsets to Series not vectorized
"Series not vectorized", PerformanceWarning)
Traceback (most... | TypeError |
def _validate_usecols_arg(usecols):
"""
Check whether or not the 'usecols' parameter
contains all integers (column selection by index)
or strings (column by name). Raises a ValueError
if that is not the case.
"""
msg = (
"The elements of 'usecols' must "
"either be all string... | def _validate_usecols_arg(usecols):
"""
Check whether or not the 'usecols' parameter
contains all integers (column selection by index)
or strings (column by name). Raises a ValueError
if that is not the case.
"""
msg = (
"The elements of 'usecols' must "
"either be all string... | https://github.com/pandas-dev/pandas/issues/12546 | ---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-6-e39439e21b50> in <module>()
17 iterator = True, chunksize = chunksize , engine = "python" )
18
---> 19 print(list(ite)[0])
/hom... | ValueError |
def _sanitize_array(data, index, dtype=None, copy=False, raise_cast_failure=False):
"""sanitize input data to an ndarray, copy if specified, coerce to the
dtype if specified
"""
if dtype is not None:
dtype = _coerce_to_dtype(dtype)
if isinstance(data, ma.MaskedArray):
mask = ma.get... | def _sanitize_array(data, index, dtype=None, copy=False, raise_cast_failure=False):
"""sanitize input data to an ndarray, copy if specified, coerce to the
dtype if specified
"""
if dtype is not None:
dtype = _coerce_to_dtype(dtype)
if isinstance(data, ma.MaskedArray):
mask = ma.get... | https://github.com/pandas-dev/pandas/issues/13646 | ======================================================================
FAIL: test_alignment_non_pandas (pandas.tests.frame.test_operators.TestDataFrameOperators)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\conda\Documents\pandas3.5\pandas\test... | AssertionError |
def _possibly_convert_platform(values):
"""try to do platform conversion, allow ndarray or list here"""
if isinstance(values, (list, tuple)):
values = lib.list_to_object_array(list(values))
if getattr(values, "dtype", None) == np.object_:
if hasattr(values, "_values"):
values = ... | def _possibly_convert_platform(values):
"""try to do platform conversion, allow ndarray or list here"""
if isinstance(values, (list, tuple)):
values = lib.list_to_object_array(values)
if getattr(values, "dtype", None) == np.object_:
if hasattr(values, "_values"):
values = values... | https://github.com/pandas-dev/pandas/issues/13646 | ======================================================================
FAIL: test_alignment_non_pandas (pandas.tests.frame.test_operators.TestDataFrameOperators)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\conda\Documents\pandas3.5\pandas\test... | AssertionError |
def get_service(self):
import httplib2
try:
from googleapiclient.discovery import build
except:
from apiclient.discovery import build
http = httplib2.Http()
http = self.credentials.authorize(http)
bigquery_service = build("bigquery", "v2", http=http)
return bigquery_servic... | def get_service(self):
import httplib2
from apiclient.discovery import build
http = httplib2.Http()
http = self.credentials.authorize(http)
bigquery_service = build("bigquery", "v2", http=http)
return bigquery_service
| https://github.com/pandas-dev/pandas/issues/13454 | import apiclient
apiclient.__version__
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-90-662a0f56e34b> in <module>()
1 import apiclient
----> 2 apiclient.__version__
AttributeError: 'module' object h... | AttributeError |
def run_query(self, query):
try:
from googleapiclient.errors import HttpError
except:
from apiclient.errors import HttpError
from oauth2client.client import AccessTokenRefreshError
_check_google_client_version()
job_collection = self.service.jobs()
job_data = {
"configu... | def run_query(self, query):
from apiclient.errors import HttpError
from oauth2client.client import AccessTokenRefreshError
_check_google_client_version()
job_collection = self.service.jobs()
job_data = {
"configuration": {
"query": {
"query": query
... | https://github.com/pandas-dev/pandas/issues/13454 | import apiclient
apiclient.__version__
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-90-662a0f56e34b> in <module>()
1 import apiclient
----> 2 apiclient.__version__
AttributeError: 'module' object h... | AttributeError |
def load_data(self, dataframe, dataset_id, table_id, chunksize):
try:
from googleapiclient.errors import HttpError
except:
from apiclient.errors import HttpError
job_id = uuid.uuid4().hex
rows = []
remaining_rows = len(dataframe)
if self.verbose:
total_rows = remaining_... | def load_data(self, dataframe, dataset_id, table_id, chunksize):
from apiclient.errors import HttpError
job_id = uuid.uuid4().hex
rows = []
remaining_rows = len(dataframe)
if self.verbose:
total_rows = remaining_rows
self._print("\n\n")
for index, row in dataframe.reset_index(... | https://github.com/pandas-dev/pandas/issues/13454 | import apiclient
apiclient.__version__
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-90-662a0f56e34b> in <module>()
1 import apiclient
----> 2 apiclient.__version__
AttributeError: 'module' object h... | AttributeError |
def verify_schema(self, dataset_id, table_id, schema):
try:
from googleapiclient.errors import HttpError
except:
from apiclient.errors import HttpError
try:
return (
(
self.service.tables()
.get(projectId=self.project_id, datasetId=dataset... | def verify_schema(self, dataset_id, table_id, schema):
from apiclient.errors import HttpError
try:
return (
(
self.service.tables()
.get(projectId=self.project_id, datasetId=dataset_id, tableId=table_id)
.execute()["schema"]
)
... | https://github.com/pandas-dev/pandas/issues/13454 | import apiclient
apiclient.__version__
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-90-662a0f56e34b> in <module>()
1 import apiclient
----> 2 apiclient.__version__
AttributeError: 'module' object h... | AttributeError |
def __init__(
self, project_id, dataset_id, reauth=False, verbose=False, private_key=None
):
try:
from googleapiclient.errors import HttpError
except:
from apiclient.errors import HttpError
self.http_error = HttpError
self.dataset_id = dataset_id
super(_Table, self).__init__(proj... | def __init__(
self, project_id, dataset_id, reauth=False, verbose=False, private_key=None
):
from apiclient.errors import HttpError
self.http_error = HttpError
self.dataset_id = dataset_id
super(_Table, self).__init__(project_id, reauth, verbose, private_key)
| https://github.com/pandas-dev/pandas/issues/13454 | import apiclient
apiclient.__version__
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-90-662a0f56e34b> in <module>()
1 import apiclient
----> 2 apiclient.__version__
AttributeError: 'module' object h... | AttributeError |
def __init__(self, project_id, reauth=False, verbose=False, private_key=None):
try:
from googleapiclient.errors import HttpError
except:
from apiclient.errors import HttpError
self.http_error = HttpError
super(_Dataset, self).__init__(project_id, reauth, verbose, private_key)
| def __init__(self, project_id, reauth=False, verbose=False, private_key=None):
from apiclient.errors import HttpError
self.http_error = HttpError
super(_Dataset, self).__init__(project_id, reauth, verbose, private_key)
| https://github.com/pandas-dev/pandas/issues/13454 | import apiclient
apiclient.__version__
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-90-662a0f56e34b> in <module>()
1 import apiclient
----> 2 apiclient.__version__
AttributeError: 'module' object h... | AttributeError |
def validate(self):
super(Window, self).validate()
window = self.window
if isinstance(window, (list, tuple, np.ndarray)):
pass
elif com.is_integer(window):
if window < 0:
raise ValueError("window must be non-negative")
try:
import scipy.signal as sig
... | def validate(self):
super(Window, self).validate()
window = self.window
if isinstance(window, (list, tuple, np.ndarray)):
pass
elif com.is_integer(window):
try:
import scipy.signal as sig
except ImportError:
raise ImportError("Please install scipy to gene... | https://github.com/pandas-dev/pandas/issues/13383 | In [171]: s = pd.Series(range(3))
In [172]: s.rolling(-1) # doesn't raise
Out[172]: Rolling [window=-1,center=False,axis=0]
In [173]: s.rolling(-1).mean() # Odd, indirect error
---------------------------------------------------------------------------
ValueError Traceback (most recent ... | ValueError |
def validate(self):
super(Rolling, self).validate()
if not com.is_integer(self.window):
raise ValueError("window must be an integer")
elif self.window < 0:
raise ValueError("window must be non-negative")
| def validate(self):
super(Rolling, self).validate()
if not com.is_integer(self.window):
raise ValueError("window must be an integer")
| https://github.com/pandas-dev/pandas/issues/13383 | In [171]: s = pd.Series(range(3))
In [172]: s.rolling(-1) # doesn't raise
Out[172]: Rolling [window=-1,center=False,axis=0]
In [173]: s.rolling(-1).mean() # Odd, indirect error
---------------------------------------------------------------------------
ValueError Traceback (most recent ... | ValueError |
def _comp_method_SERIES(op, name, str_rep, masker=False):
"""
Wrapper function for Series arithmetic operations, to avoid
code duplication.
"""
def na_op(x, y):
# dispatch to the categorical if we have a categorical
# in either operand
if is_categorical_dtype(x):
... | def _comp_method_SERIES(op, name, str_rep, masker=False):
"""
Wrapper function for Series arithmetic operations, to avoid
code duplication.
"""
def na_op(x, y):
# dispatch to the categorical if we have a categorical
# in either operand
if is_categorical_dtype(x):
... | https://github.com/pandas-dev/pandas/issues/13006 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-3-0803a1472416> in <module>()
1 import numpy as np
2 import pandas as pd
----> 3 np.float64(0) < pd.Series([1,2,3],dtype=np.float64)
global np.float64 = ... | TypeError |
def wrapper(self, other, axis=None):
# Validate the axis parameter
if axis is not None:
self._get_axis_number(axis)
if isinstance(other, ABCSeries):
name = _maybe_match_name(self, other)
if len(self) != len(other):
raise ValueError("Series lengths must match to compare")... | def wrapper(self, other, axis=None):
# Validate the axis parameter
if axis is not None:
self._get_axis_number(axis)
if isinstance(other, ABCSeries):
name = _maybe_match_name(self, other)
if len(self) != len(other):
raise ValueError("Series lengths must match to compare")... | https://github.com/pandas-dev/pandas/issues/13006 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-3-0803a1472416> in <module>()
1 import numpy as np
2 import pandas as pd
----> 3 np.float64(0) < pd.Series([1,2,3],dtype=np.float64)
global np.float64 = ... | TypeError |
def get_resampler_for_grouping(
groupby, rule, how=None, fill_method=None, limit=None, kind=None, **kwargs
):
"""return our appropriate resampler when grouping as well"""
tg = TimeGrouper(freq=rule, **kwargs)
resampler = tg._get_resampler(groupby.obj, kind=kind)
r = resampler._get_resampler_for_grou... | def get_resampler_for_grouping(
groupby, rule, how=None, fill_method=None, limit=None, kind=None, **kwargs
):
"""return our appropriate resampler when grouping as well"""
tg = TimeGrouper(freq=rule, **kwargs)
resampler = tg._get_resampler(groupby.obj, kind=kind)
r = resampler._get_resampler_for_grou... | https://github.com/pandas-dev/pandas/issues/13235 | TypeError Traceback (most recent call last)
<ipython-input-53-6e7ac0fde8b3> in <module>()
----> 1 df.groupby('col1').resample('1W', label='left').sum()
/Users/roycoding/venv-lib-upgrade/lib/python2.7/site-packages/pandas/core/groupby.pyc in resample(self, rule, *args, **kwargs)
1080 ... | TypeError |
def nested_to_record(ds, prefix="", level=0):
"""a simplified json_normalize
converts a nested dict into a flat dict ("record"), unlike json_normalize,
it does not attempt to extract a subset of the data.
Parameters
----------
ds : dict or list of dicts
prefix: the prefix, optional, defaul... | def nested_to_record(ds, prefix="", level=0):
"""a simplified json_normalize
converts a nested dict into a flat dict ("record"), unlike json_normalize,
it does not attempt to extract a subset of the data.
Parameters
----------
ds : dict or list of dicts
prefix: the prefix, optional, defaul... | https://github.com/pandas-dev/pandas/issues/13213 | Traceback (most recent call last):
File "...lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 2885, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-12-f866f9c7ec7c>", line 5, in <module>
pd.io.json.json_normalize(json.loads(testjson))
File ".../lib/python2.7/site-pac... | UnicodeEncodeError |
def _transform_fast(self, func):
"""
fast version of transform, only applicable to
builtin/cythonizable functions
"""
if isinstance(func, compat.string_types):
func = getattr(self, func)
ids, _, ngroup = self.grouper.group_info
cast = (self.size().fillna(0) > 0).any()
out = algo... | def _transform_fast(self, func):
"""
fast version of transform, only applicable to
builtin/cythonizable functions
"""
if isinstance(func, compat.string_types):
func = getattr(self, func)
ids, _, ngroup = self.grouper.group_info
mask = ids != -1
out = func().values[ids]
if n... | https://github.com/pandas-dev/pandas/issues/13191 | In [20]: df = pd.DataFrame({'grouping':[np.nan,1,1,3],
'v':[1.1, 2.1, 3.1, 4.5],
'd':pd.date_range('2014-1-1','2014-1-4')})
In [21]: df.groupby('grouping')['d'].transform('first')
---------------------------------------------------------------------------
TypeError Traceback (most recen... | TypeError |
def transform(self, func, *args, **kwargs):
"""
Call function producing a like-indexed DataFrame on each group and
return a DataFrame having the same indexes as the original object
filled with the transformed values
Parameters
----------
f : function
Function to apply to each subfra... | def transform(self, func, *args, **kwargs):
"""
Call function producing a like-indexed DataFrame on each group and
return a DataFrame having the same indexes as the original object
filled with the transformed values
Parameters
----------
f : function
Function to apply to each subfra... | https://github.com/pandas-dev/pandas/issues/13191 | In [20]: df = pd.DataFrame({'grouping':[np.nan,1,1,3],
'v':[1.1, 2.1, 3.1, 4.5],
'd':pd.date_range('2014-1-1','2014-1-4')})
In [21]: df.groupby('grouping')['d'].transform('first')
---------------------------------------------------------------------------
TypeError Traceback (most recen... | TypeError |
def __init__(self, obj, *args, **kwargs):
parent = kwargs.pop("parent", None)
groupby = kwargs.pop("groupby", None)
if parent is None:
parent = obj
# initialize our GroupByMixin object with
# the resampler attributes
for attr in self._attributes:
setattr(self, attr, kwargs.get(a... | def __init__(self, obj, *args, **kwargs):
parent = kwargs.pop("parent", None)
groupby = kwargs.pop("groupby", None)
if parent is None:
parent = obj
# initialize our GroupByMixin object with
# the resampler attributes
for attr in self._attributes:
setattr(self, attr, kwargs.get(a... | https://github.com/pandas-dev/pandas/issues/13174 | /usr/local/bin/ipython:1: FutureWarning: .resample() is now a deferred operation
use .resample(...).mean() instead of .resample(...)
#!/usr/local/opt/python/bin/python2.7
---------------------------------------------------------------------------
KeyError Traceback (most recent call las... | KeyError |
def get_value(self, series, key):
# somewhat broken encapsulation
from pandas.core.indexing import maybe_droplevels
# Label-based
s = _values_from_object(series)
k = _values_from_object(key)
def _try_mi(k):
# TODO: what if a level contains tuples??
loc = self.get_loc(k)
... | def get_value(self, series, key):
# somewhat broken encapsulation
from pandas.core.indexing import maybe_droplevels
from pandas.core.series import Series
# Label-based
s = _values_from_object(series)
k = _values_from_object(key)
def _try_mi(k):
# TODO: what if a level contains tupl... | https://github.com/pandas-dev/pandas/issues/13144 | Traceback (most recent call last):
File "/Users/bryan/anaconda3/lib/python3.5/site-packages/pandas/sparse/series.py", line 420, in _get_values
fastpath=True).__finalize__(self)
File "/Users/bryan/anaconda3/lib/python3.5/site-packages/pandas/sparse/series.py", line 222, in __init__
self.index = index
File "/Users/bryan/... | TypeError |
def _try_mi(k):
# TODO: what if a level contains tuples??
loc = self.get_loc(k)
new_values = series._values[loc]
new_index = self[loc]
new_index = maybe_droplevels(new_index, k)
return series._constructor(
new_values, index=new_index, name=series.name
).__finalize__(self)
| def _try_mi(k):
# TODO: what if a level contains tuples??
loc = self.get_loc(k)
new_values = series._values[loc]
new_index = self[loc]
new_index = maybe_droplevels(new_index, k)
return Series(new_values, index=new_index, name=series.name)
| https://github.com/pandas-dev/pandas/issues/13144 | Traceback (most recent call last):
File "/Users/bryan/anaconda3/lib/python3.5/site-packages/pandas/sparse/series.py", line 420, in _get_values
fastpath=True).__finalize__(self)
File "/Users/bryan/anaconda3/lib/python3.5/site-packages/pandas/sparse/series.py", line 222, in __init__
self.index = index
File "/Users/bryan/... | TypeError |
def __init__(
self,
data=None,
index=None,
sparse_index=None,
kind="block",
fill_value=None,
name=None,
dtype=None,
copy=False,
fastpath=False,
):
# we are called internally, so short-circuit
if fastpath:
# data is an ndarray, index is defined
if not isin... | def __init__(
self,
data=None,
index=None,
sparse_index=None,
kind="block",
fill_value=None,
name=None,
dtype=None,
copy=False,
fastpath=False,
):
# we are called internally, so short-circuit
if fastpath:
# data is an ndarray, index is defined
if not isin... | https://github.com/pandas-dev/pandas/issues/13144 | Traceback (most recent call last):
File "/Users/bryan/anaconda3/lib/python3.5/site-packages/pandas/sparse/series.py", line 420, in _get_values
fastpath=True).__finalize__(self)
File "/Users/bryan/anaconda3/lib/python3.5/site-packages/pandas/sparse/series.py", line 222, in __init__
self.index = index
File "/Users/bryan/... | TypeError |
def __getitem__(self, key):
try:
return self.index.get_value(self, key)
except InvalidIndexError:
pass
except KeyError:
if isinstance(key, (int, np.integer)):
return self._get_val_at(key)
elif key is Ellipsis:
return self
raise Exception("Requ... | def __getitem__(self, key):
try:
return self._get_val_at(self.index.get_loc(key))
except KeyError:
if isinstance(key, (int, np.integer)):
return self._get_val_at(key)
elif key is Ellipsis:
return self
raise Exception("Requested index not in this series!")... | https://github.com/pandas-dev/pandas/issues/13144 | Traceback (most recent call last):
File "/Users/bryan/anaconda3/lib/python3.5/site-packages/pandas/sparse/series.py", line 420, in _get_values
fastpath=True).__finalize__(self)
File "/Users/bryan/anaconda3/lib/python3.5/site-packages/pandas/sparse/series.py", line 222, in __init__
self.index = index
File "/Users/bryan/... | TypeError |
def _parse_raw_thead(self, table):
thead = self._parse_thead(table)
res = []
if thead:
res = lmap(self._text_getter, self._parse_th(thead[0]))
return np.atleast_1d(np.array(res).squeeze()) if res and len(res) == 1 else res
| def _parse_raw_thead(self, table):
thead = self._parse_thead(table)
res = []
if thead:
res = lmap(self._text_getter, self._parse_th(thead[0]))
return np.array(res).squeeze() if res and len(res) == 1 else res
| https://github.com/pandas-dev/pandas/issues/9178 | Traceback (most recent call last):
File "./posti.py", line 69, in <module>
dfs = read_html(html)
File "/usr/lib/python3.4/site-packages/pandas/io/html.py", line 851, in read_html
parse_dates, tupleize_cols, thousands, attrs, encoding)
File "/usr/lib/python3.4/site-packages/pandas/io/html.py", line 721, in _parse
infer_... | TypeError |
def _parse_raw_tfoot(self, table):
tfoot = self._parse_tfoot(table)
res = []
if tfoot:
res = lmap(self._text_getter, self._parse_td(tfoot[0]))
return np.atleast_1d(np.array(res).squeeze()) if res and len(res) == 1 else res
| def _parse_raw_tfoot(self, table):
tfoot = self._parse_tfoot(table)
res = []
if tfoot:
res = lmap(self._text_getter, self._parse_td(tfoot[0]))
return np.array(res).squeeze() if res and len(res) == 1 else res
| https://github.com/pandas-dev/pandas/issues/9178 | Traceback (most recent call last):
File "./posti.py", line 69, in <module>
dfs = read_html(html)
File "/usr/lib/python3.4/site-packages/pandas/io/html.py", line 851, in read_html
parse_dates, tupleize_cols, thousands, attrs, encoding)
File "/usr/lib/python3.4/site-packages/pandas/io/html.py", line 721, in _parse
infer_... | TypeError |
def is_null(self):
if self.block is None:
return True
if not self.block._can_hold_na:
return False
# Usually it's enough to check but a small fraction of values to see if
# a block is NOT null, chunks should help in such cases. 1000 value
# was chosen rather arbitrarily.
value... | def is_null(self):
if self.block is None:
return True
if not self.block._can_hold_na:
return False
# Usually it's enough to check but a small fraction of values to see if
# a block is NOT null, chunks should help in such cases. 1000 value
# was chosen rather arbitrarily.
value... | https://github.com/pandas-dev/pandas/issues/9765 | .
Expected:
A B C
0 1 0 0
1 0 0 0
2 1 0 1
3 0 0 0
Got:
A B C
0 1 NaN 0
1 0 NaN 0
2 1 NaN 1
3 0 NaN 0
F
======================================================================
FAIL: test_concat_sparse_to_df (__main__.TestSparseConcat)
--------------------------------------------------------------... | AssertionError |
def get_reindexed_values(self, empty_dtype, upcasted_na):
if upcasted_na is None:
# No upcasting is necessary
fill_value = self.block.fill_value
values = self.block.get_values()
else:
fill_value = upcasted_na
if self.is_null:
if getattr(self.block, "is_object... | def get_reindexed_values(self, empty_dtype, upcasted_na):
if upcasted_na is None:
# No upcasting is necessary
fill_value = self.block.fill_value
values = self.block.get_values()
else:
fill_value = upcasted_na
if self.is_null:
if getattr(self.block, "is_object... | https://github.com/pandas-dev/pandas/issues/9765 | .
Expected:
A B C
0 1 0 0
1 0 0 0
2 1 0 1
3 0 0 0
Got:
A B C
0 1 NaN 0
1 0 NaN 0
2 1 NaN 1
3 0 NaN 0
F
======================================================================
FAIL: test_concat_sparse_to_df (__main__.TestSparseConcat)
--------------------------------------------------------------... | AssertionError |
def __getitem__(self, key):
""" """
if com.is_integer(key):
return self._get_val_at(key)
elif isinstance(key, tuple):
data_slice = self.values[key]
else:
if isinstance(key, SparseArray):
key = np.asarray(key)
if hasattr(key, "__len__") and len(self) != len(ke... | def __getitem__(self, key):
""" """
if com.is_integer(key):
return self._get_val_at(key)
else:
if isinstance(key, SparseArray):
key = np.asarray(key)
if hasattr(key, "__len__") and len(self) != len(key):
return self.take(key)
else:
data_sli... | https://github.com/pandas-dev/pandas/issues/9765 | .
Expected:
A B C
0 1 0 0
1 0 0 0
2 1 0 1
3 0 0 0
Got:
A B C
0 1 NaN 0
1 0 NaN 0
2 1 NaN 1
3 0 NaN 0
F
======================================================================
FAIL: test_concat_sparse_to_df (__main__.TestSparseConcat)
--------------------------------------------------------------... | AssertionError |
def __init__(
self,
data=None,
index=None,
sparse_index=None,
kind="block",
fill_value=None,
name=None,
dtype=None,
copy=False,
fastpath=False,
):
# we are called internally, so short-circuit
if fastpath:
# data is an ndarray, index is defined
if not isin... | def __init__(
self,
data=None,
index=None,
sparse_index=None,
kind="block",
fill_value=None,
name=None,
dtype=None,
copy=False,
fastpath=False,
):
# we are called internally, so short-circuit
if fastpath:
# data is an ndarray, index is defined
data = Singl... | https://github.com/pandas-dev/pandas/issues/9765 | .
Expected:
A B C
0 1 0 0
1 0 0 0
2 1 0 1
3 0 0 0
Got:
A B C
0 1 NaN 0
1 0 NaN 0
2 1 NaN 1
3 0 NaN 0
F
======================================================================
FAIL: test_concat_sparse_to_df (__main__.TestSparseConcat)
--------------------------------------------------------------... | AssertionError |
def get_result(self):
# series only
if self._is_series:
# stack blocks
if self.axis == 0:
# concat Series with length to keep dtype as much
non_empties = [x for x in self.objs if len(x) > 0]
if len(non_empties) > 0:
values = [x._values for x in... | def get_result(self):
# series only
if self._is_series:
# stack blocks
if self.axis == 0:
# concat Series with length to keep dtype as much
non_empties = [x for x in self.objs if len(x) > 0]
if len(non_empties) > 0:
values = [x._values for x in... | https://github.com/pandas-dev/pandas/issues/9765 | .
Expected:
A B C
0 1 0 0
1 0 0 0
2 1 0 1
3 0 0 0
Got:
A B C
0 1 NaN 0
1 0 NaN 0
2 1 NaN 1
3 0 NaN 0
F
======================================================================
FAIL: test_concat_sparse_to_df (__main__.TestSparseConcat)
--------------------------------------------------------------... | AssertionError |
def to_hierarchical(self, n_repeat, n_shuffle=1):
"""
Return a MultiIndex reshaped to conform to the
shapes given by n_repeat and n_shuffle.
Useful to replicate and rearrange a MultiIndex for combination
with another Index with n_repeat items.
Parameters
----------
n_repeat : int
... | def to_hierarchical(self, n_repeat, n_shuffle=1):
"""
Return a MultiIndex reshaped to conform to the
shapes given by n_repeat and n_shuffle.
Useful to replicate and rearrange a MultiIndex for combination
with another Index with n_repeat items.
Parameters
----------
n_repeat : int
... | https://github.com/pandas-dev/pandas/issues/12527 | isinstance(n, int)
True
df.loc[(n, 0), 'dest']
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/site-packages/pandas/core/indexing.py", line 1196, in __getitem__
return self._getitem_tuple(key)
File "/usr/local/lib/python3.5/site-packages/pandas/core/indexing.py", li... | IndexError |
def _maybe_upcast(values, fill_value=np.nan, dtype=None, copy=False):
"""provide explict type promotion and coercion
Parameters
----------
values : the ndarray that we want to maybe upcast
fill_value : what we want to fill with
dtype : if None, then use the dtype of the values, else coerce to t... | def _maybe_upcast(values, fill_value=np.nan, dtype=None, copy=False):
"""provide explict type promotion and coercion
Parameters
----------
values : the ndarray that we want to maybe upcast
fill_value : what we want to fill with
dtype : if None, then use the dtype of the values, else coerce to t... | https://github.com/pandas-dev/pandas/issues/12473 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-13-ba941613799a> in <module>()
----> 1 df.publication_timestamp.map(lambda x: x)
/Users/johria/.pyenv/versions/3.5.1/lib/python3.5/site-packages/pandas/... | TypeError |
def _sanitize_column(self, key, value):
# Need to make sure new columns (which go into the BlockManager as new
# blocks) are always copied
def reindexer(value):
# reindex if necessary
if value.index.equals(self.index) or not len(self.index):
value = value._values.copy()
... | def _sanitize_column(self, key, value):
# Need to make sure new columns (which go into the BlockManager as new
# blocks) are always copied
def reindexer(value):
# reindex if necessary
if value.index.equals(self.index) or not len(self.index):
value = value._values.copy()
... | https://github.com/pandas-dev/pandas/issues/12473 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-13-ba941613799a> in <module>()
----> 1 df.publication_timestamp.map(lambda x: x)
/Users/johria/.pyenv/versions/3.5.1/lib/python3.5/site-packages/pandas/... | TypeError |
def _apply_standard(self, func, axis, ignore_failures=False, reduce=True):
# skip if we are mixed datelike and trying reduce across axes
# GH6125
if reduce and axis == 1 and self._is_mixed_type and self._is_datelike_mixed_type:
reduce = False
# try to reduce first (by default)
# this only m... | def _apply_standard(self, func, axis, ignore_failures=False, reduce=True):
# skip if we are mixed datelike and trying reduce across axes
# GH6125
if reduce and axis == 1 and self._is_mixed_type and self._is_datelike_mixed_type:
reduce = False
# try to reduce first (by default)
# this only m... | https://github.com/pandas-dev/pandas/issues/12473 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-13-ba941613799a> in <module>()
----> 1 df.publication_timestamp.map(lambda x: x)
/Users/johria/.pyenv/versions/3.5.1/lib/python3.5/site-packages/pandas/... | TypeError |
def should_store(self, value):
return not (
issubclass(
value.dtype.type,
(np.integer, np.floating, np.complexfloating, np.datetime64, np.bool_),
)
or is_extension_type(value)
)
| def should_store(self, value):
return not (
issubclass(
value.dtype.type,
(np.integer, np.floating, np.complexfloating, np.datetime64, np.bool_),
)
or is_internal_type(value)
)
| https://github.com/pandas-dev/pandas/issues/12473 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-13-ba941613799a> in <module>()
----> 1 df.publication_timestamp.map(lambda x: x)
/Users/johria/.pyenv/versions/3.5.1/lib/python3.5/site-packages/pandas/... | TypeError |
def set(self, item, value, check=False):
"""
Set new item in-place. Does not consolidate. Adds new Block if not
contained in the current set of items
if check, then validate that we are not setting the same data in-place
"""
# FIXME: refactor, clearly separate broadcasting & zip-like assignment
... | def set(self, item, value, check=False):
"""
Set new item in-place. Does not consolidate. Adds new Block if not
contained in the current set of items
if check, then validate that we are not setting the same data in-place
"""
# FIXME: refactor, clearly separate broadcasting & zip-like assignment
... | https://github.com/pandas-dev/pandas/issues/12473 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-13-ba941613799a> in <module>()
----> 1 df.publication_timestamp.map(lambda x: x)
/Users/johria/.pyenv/versions/3.5.1/lib/python3.5/site-packages/pandas/... | TypeError |
def map(self, arg, na_action=None):
"""
Map values of Series using input correspondence (which can be
a dict, Series, or function)
Parameters
----------
arg : function, dict, or Series
na_action : {None, 'ignore'}
If 'ignore', propagate NA values
Examples
--------
>>> x... | def map(self, arg, na_action=None):
"""
Map values of Series using input correspondence (which can be
a dict, Series, or function)
Parameters
----------
arg : function, dict, or Series
na_action : {None, 'ignore'}
If 'ignore', propagate NA values
Examples
--------
>>> x... | https://github.com/pandas-dev/pandas/issues/12473 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-13-ba941613799a> in <module>()
----> 1 df.publication_timestamp.map(lambda x: x)
/Users/johria/.pyenv/versions/3.5.1/lib/python3.5/site-packages/pandas/... | TypeError |
def map_f(values, f):
return lib.map_infer_mask(values, f, isnull(values).view(np.uint8))
| def map_f(values, f):
return lib.map_infer_mask(values, f, mask.view(np.uint8))
| https://github.com/pandas-dev/pandas/issues/12473 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-13-ba941613799a> in <module>()
----> 1 df.publication_timestamp.map(lambda x: x)
/Users/johria/.pyenv/versions/3.5.1/lib/python3.5/site-packages/pandas/... | TypeError |
def apply(self, func, convert_dtype=True, args=(), **kwds):
"""
Invoke function on values of Series. Can be ufunc (a NumPy function
that applies to the entire Series) or a Python function that only works
on single values
Parameters
----------
func : function
convert_dtype : boolean, def... | def apply(self, func, convert_dtype=True, args=(), **kwds):
"""
Invoke function on values of Series. Can be ufunc (a NumPy function
that applies to the entire Series) or a Python function that only works
on single values
Parameters
----------
func : function
convert_dtype : boolean, def... | https://github.com/pandas-dev/pandas/issues/12473 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-13-ba941613799a> in <module>()
----> 1 df.publication_timestamp.map(lambda x: x)
/Users/johria/.pyenv/versions/3.5.1/lib/python3.5/site-packages/pandas/... | TypeError |
def _sanitize_array(data, index, dtype=None, copy=False, raise_cast_failure=False):
"""sanitize input data to an ndarray, copy if specified, coerce to the
dtype if specified
"""
if dtype is not None:
dtype = _coerce_to_dtype(dtype)
if isinstance(data, ma.MaskedArray):
mask = ma.get... | def _sanitize_array(data, index, dtype=None, copy=False, raise_cast_failure=False):
"""sanitize input data to an ndarray, copy if specified, coerce to the
dtype if specified
"""
if dtype is not None:
dtype = _coerce_to_dtype(dtype)
if isinstance(data, ma.MaskedArray):
mask = ma.get... | https://github.com/pandas-dev/pandas/issues/12473 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-13-ba941613799a> in <module>()
----> 1 df.publication_timestamp.map(lambda x: x)
/Users/johria/.pyenv/versions/3.5.1/lib/python3.5/site-packages/pandas/... | TypeError |
def _try_cast(arr, take_fast_path):
# perf shortcut as this is the most common case
if take_fast_path:
if _possibly_castable(arr) and not copy and dtype is None:
return arr
try:
subarr = _possibly_cast_to_datetime(arr, dtype)
if not is_extension_type(subarr):
... | def _try_cast(arr, take_fast_path):
# perf shortcut as this is the most common case
if take_fast_path:
if _possibly_castable(arr) and not copy and dtype is None:
return arr
try:
subarr = _possibly_cast_to_datetime(arr, dtype)
if not is_internal_type(subarr):
... | https://github.com/pandas-dev/pandas/issues/12473 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-13-ba941613799a> in <module>()
----> 1 df.publication_timestamp.map(lambda x: x)
/Users/johria/.pyenv/versions/3.5.1/lib/python3.5/site-packages/pandas/... | TypeError |
def map(self, mapper):
"""
Apply mapper function to its values.
Parameters
----------
mapper : callable
Function to be applied.
Returns
-------
applied : array
"""
return self._arrmap(self.values, mapper)
| def map(self, mapper):
return self._arrmap(self.values, mapper)
| https://github.com/pandas-dev/pandas/issues/12473 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-13-ba941613799a> in <module>()
----> 1 df.publication_timestamp.map(lambda x: x)
/Users/johria/.pyenv/versions/3.5.1/lib/python3.5/site-packages/pandas/... | TypeError |
def _convert_obj(self, obj):
obj = super(PeriodIndexResampler, self)._convert_obj(obj)
offset = to_offset(self.freq)
if offset.n > 1:
if self.kind == "period": # pragma: no cover
print("Warning: multiple of frequency -> timestamps")
# Cannot have multiple of periods, convert t... | def _convert_obj(self, obj):
obj = super(PeriodIndexResampler, self)._convert_obj(obj)
offset = to_offset(self.freq)
if offset.n > 1:
if self.kind == "period": # pragma: no cover
print("Warning: multiple of frequency -> timestamps")
# Cannot have multiple of periods, convert t... | https://github.com/pandas-dev/pandas/issues/12774 | In [38]: pd.Series(1, index=pd.period_range(start='2000', periods=100)).resample('M').count()
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-38-295afa97781f> in <module>()
----> 1 pd.Series(1, index=p... | TypeError |
def _get_new_index(self):
"""return our new index"""
ax = self.ax
if len(ax) == 0:
values = []
else:
start = ax[0].asfreq(self.freq, how=self.convention)
end = ax[-1].asfreq(self.freq, how="end")
values = period_range(start, end, freq=self.freq).values
return ax._sh... | def _get_new_index(self):
"""return our new index"""
ax = self.ax
ax_attrs = ax._get_attributes_dict()
ax_attrs["freq"] = self.freq
obj = self._selected_obj
if len(ax) == 0:
new_index = PeriodIndex(data=[], **ax_attrs)
return obj.reindex(new_index)
start = ax[0].asfreq(self... | https://github.com/pandas-dev/pandas/issues/12774 | In [38]: pd.Series(1, index=pd.period_range(start='2000', periods=100)).resample('M').count()
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-38-295afa97781f> in <module>()
----> 1 pd.Series(1, index=p... | TypeError |
def _downsample(self, how, **kwargs):
"""
Downsample the cython defined function
Parameters
----------
how : string / cython mapped function
**kwargs : kw args passed to how function
"""
# we may need to actually resample as if we are timestamps
if self.kind == "timestamp":
... | def _downsample(self, how, **kwargs):
"""
Downsample the cython defined function
Parameters
----------
how : string / cython mapped function
**kwargs : kw args passed to how function
"""
# we may need to actually resample as if we are timestamps
if self.kind == "timestamp":
... | https://github.com/pandas-dev/pandas/issues/12774 | In [38]: pd.Series(1, index=pd.period_range(start='2000', periods=100)).resample('M').count()
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-38-295afa97781f> in <module>()
----> 1 pd.Series(1, index=p... | TypeError |
def _upsample(self, method, limit=None):
"""
method : string {'backfill', 'bfill', 'pad', 'ffill'}
method for upsampling
limit : int, default None
Maximum size gap to fill when reindexing
See also
--------
.fillna
"""
# we may need to actually resample as if we are time... | def _upsample(self, method, limit=None):
"""
method : string {'backfill', 'bfill', 'pad', 'ffill'}
method for upsampling
limit : int, default None
Maximum size gap to fill when reindexing
See also
--------
.fillna
"""
# we may need to actually resample as if we are time... | https://github.com/pandas-dev/pandas/issues/12774 | In [38]: pd.Series(1, index=pd.period_range(start='2000', periods=100)).resample('M').count()
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-38-295afa97781f> in <module>()
----> 1 pd.Series(1, index=p... | TypeError |
def _groupby_and_aggregate(self, grouper, how, *args, **kwargs):
if grouper is None:
return self._downsample(how, **kwargs)
return super(PeriodIndexResampler, self)._groupby_and_aggregate(
grouper, how, *args, **kwargs
)
| def _groupby_and_aggregate(self, grouper, how, *args, **kwargs):
"""revaluate the obj with a groupby aggregation"""
if grouper is None:
self._set_binner()
grouper = self.grouper
obj = self._selected_obj
try:
grouped = groupby(obj, by=None, grouper=grouper, axis=self.axis)
... | https://github.com/pandas-dev/pandas/issues/12774 | In [38]: pd.Series(1, index=pd.period_range(start='2000', periods=100)).resample('M').count()
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-38-295afa97781f> in <module>()
----> 1 pd.Series(1, index=p... | TypeError |
def __getitem__(self, key):
try:
return self._get_val_at(self.index.get_loc(key))
except KeyError:
if isinstance(key, (int, np.integer)):
return self._get_val_at(key)
elif key is Ellipsis:
return self
raise Exception("Requested index not in this series!")... | def __getitem__(self, key):
""" """
try:
return self._get_val_at(self.index.get_loc(key))
except KeyError:
if isinstance(key, (int, np.integer)):
return self._get_val_at(key)
raise Exception("Requested index not in this series!")
except TypeError:
# Could no... | https://github.com/pandas-dev/pandas/issues/9467 | In [2]: import pandas as pd
In [3]: ss = pd.Series(range(10)).to_sparse()
In [4]: ss[...]
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-4-f0ccf654123b> in <module>()
----> 1 ss[...]
/Users/shoyer/... | Exception |
def _wrap_result(self, result, use_codes=True, name=None, expand=None):
from pandas.core.index import Index, MultiIndex
# for category, we do the stuff on the categories, so blow it up
# to the full series again
# But for some operations, we have to do the stuff on the full values,
# so make it pos... | def _wrap_result(self, result, use_codes=True, name=None, expand=None):
from pandas.core.index import Index, MultiIndex
# for category, we do the stuff on the categories, so blow it up
# to the full series again
# But for some operations, we have to do the stuff on the full values,
# so make it pos... | https://github.com/pandas-dev/pandas/issues/12617 | Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/pwaller/.local/src/pandas/pandas/core/strings.py", line 1432, in partition
return self._wrap_result(result, expand=expand)
File "/home/pwaller/.local/src/pandas/pandas/core/strings.py", line 1348, in _wrap_result
return MultiIndex.from_... | ValueError |
def _apply_filter(self, indices, dropna):
if len(indices) == 0:
indices = np.array([], dtype="int64")
else:
indices = np.sort(np.concatenate(indices))
if dropna:
filtered = self._selected_obj.take(indices, axis=self.axis)
else:
mask = np.empty(len(self._selected_obj.index... | def _apply_filter(self, indices, dropna):
if len(indices) == 0:
indices = []
else:
indices = np.sort(np.concatenate(indices))
if dropna:
filtered = self._selected_obj.take(indices, axis=self.axis)
else:
mask = np.empty(len(self._selected_obj.index), dtype=bool)
ma... | https://github.com/pandas-dev/pandas/issues/12768 | AttributeError Traceback (most recent call last)
<ipython-input-11-ffb9adbc134a> in <module>()
----> 1 pd.DataFrame({'a': [1,1,2], 'b':[1,2,0]}).groupby('a').filter(lambda x: x['b'].sum() > 5, dropna=False)
....../local/lib/python2.7/site-packages/pandas/core/groupby.py in filter(self, func,... | AttributeError |
def __getitem__(self, key):
""" """
if com.is_integer(key):
return self._get_val_at(key)
else:
if isinstance(key, SparseArray):
key = np.asarray(key)
if hasattr(key, "__len__") and len(self) != len(key):
return self.take(key)
else:
data_sli... | def __getitem__(self, key):
""" """
if com.is_integer(key):
return self._get_val_at(key)
else:
if isinstance(key, SparseArray):
key = np.asarray(key)
if hasattr(key, "__len__") and len(self) != len(key):
indices = self.sp_index
if hasattr(indices, ... | https://github.com/pandas-dev/pandas/issues/10560 | In [2]: pd.__version__
Out[2]: '0.16.2-123-gdf1f5cf'
In [3]: pd.options.display.max_rows = 3
In [4]: pd.Series(randn(3)).to_sparse()
Out[4]:
0 1.100684
1 -0.924482
2 -0.106069
dtype: float64
BlockIndex
Block locations: array([0], dtype=int32)
Block lengths: array([3], dtype=int32)
In [5]: pd.Series(randn(4)).... | TypeError |
def take(self, indices, axis=0):
"""
Sparse-compatible version of ndarray.take
Returns
-------
taken : ndarray
"""
if axis:
raise ValueError("axis must be 0, input was {0}".format(axis))
if com.is_integer(indices):
# return scalar
return self[indices]
indic... | def take(self, indices, axis=0):
"""
Sparse-compatible version of ndarray.take
Returns
-------
taken : ndarray
"""
if axis:
raise ValueError("axis must be 0, input was {0}".format(axis))
indices = np.atleast_1d(np.asarray(indices, dtype=int))
# allow -1 to indicate missing ... | https://github.com/pandas-dev/pandas/issues/10560 | In [2]: pd.__version__
Out[2]: '0.16.2-123-gdf1f5cf'
In [3]: pd.options.display.max_rows = 3
In [4]: pd.Series(randn(3)).to_sparse()
Out[4]:
0 1.100684
1 -0.924482
2 -0.106069
dtype: float64
BlockIndex
Block locations: array([0], dtype=int32)
Block lengths: array([3], dtype=int32)
In [5]: pd.Series(randn(4)).... | TypeError |
def _reindex_index(
self, index, method, copy, level, fill_value=np.nan, limit=None, takeable=False
):
if level is not None:
raise TypeError("Reindex by level not supported for sparse")
if self.index.equals(index):
if copy:
return self.copy()
else:
return sel... | def _reindex_index(
self, index, method, copy, level, fill_value=np.nan, limit=None, takeable=False
):
if level is not None:
raise TypeError("Reindex by level not supported for sparse")
if self.index.equals(index):
if copy:
return self.copy()
else:
return sel... | https://github.com/pandas-dev/pandas/issues/10560 | In [2]: pd.__version__
Out[2]: '0.16.2-123-gdf1f5cf'
In [3]: pd.options.display.max_rows = 3
In [4]: pd.Series(randn(3)).to_sparse()
Out[4]:
0 1.100684
1 -0.924482
2 -0.106069
dtype: float64
BlockIndex
Block locations: array([0], dtype=int32)
Block lengths: array([3], dtype=int32)
In [5]: pd.Series(randn(4)).... | TypeError |
def reindex(self, index=None, method=None, copy=True, limit=None, **kwargs):
"""
Conform SparseSeries to new Index
See Series.reindex docstring for general behavior
Returns
-------
reindexed : SparseSeries
"""
new_index = _ensure_index(index)
if self.index.equals(new_index):
... | def reindex(self, index=None, method=None, copy=True, limit=None):
"""
Conform SparseSeries to new Index
See Series.reindex docstring for general behavior
Returns
-------
reindexed : SparseSeries
"""
new_index = _ensure_index(index)
if self.index.equals(new_index):
if copy... | https://github.com/pandas-dev/pandas/issues/10560 | In [2]: pd.__version__
Out[2]: '0.16.2-123-gdf1f5cf'
In [3]: pd.options.display.max_rows = 3
In [4]: pd.Series(randn(3)).to_sparse()
Out[4]:
0 1.100684
1 -0.924482
2 -0.106069
dtype: float64
BlockIndex
Block locations: array([0], dtype=int32)
Block lengths: array([3], dtype=int32)
In [5]: pd.Series(randn(4)).... | TypeError |
def describe(self, percentiles=None, include=None, exclude=None):
if self.ndim >= 3:
msg = "describe is not implemented on on Panel or PanelND objects."
raise NotImplementedError(msg)
if percentiles is not None:
# get them all to be in [0, 1]
self._check_percentile(percentiles)
... | def describe(self, percentiles=None, include=None, exclude=None):
if self.ndim >= 3:
msg = "describe is not implemented on on Panel or PanelND objects."
raise NotImplementedError(msg)
if percentiles is not None:
# get them all to be in [0, 1]
self._check_percentile(percentiles)
... | https://github.com/pandas-dev/pandas/issues/11558 | {
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import random\n",
"import pandas as pd\n",
"\n",
"df = pd.DataFrame(\n",
" {'a': range(10),\n",
" 'medium': [random.choice(['painting', 'sculpt... | AttributeError |
def _shallow_copy(self, values=None, **kwargs):
if values is None:
values = self.values
attributes = self._get_attributes_dict()
attributes.update(kwargs)
return self._simple_new(values, **attributes)
| def _shallow_copy(self, values=None, **kwargs):
"""
create a new Index with the same class as the caller, don't copy the
data, use the same object attributes with passed in attributes taking
precedence
*this is an internal non-public method*
Parameters
----------
values : the values to... | https://github.com/pandas-dev/pandas/issues/11558 | {
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import random\n",
"import pandas as pd\n",
"\n",
"df = pd.DataFrame(\n",
" {'a': range(10),\n",
" 'medium': [random.choice(['painting', 'sculpt... | AttributeError |
def _shallow_copy(self, values=None, **kwargs):
if values is None:
return RangeIndex(
name=self.name, fastpath=True, **dict(self._get_data_as_items())
)
else:
kwargs.setdefault("name", self.name)
return self._int64index._shallow_copy(values, **kwargs)
| def _shallow_copy(self, values=None, **kwargs):
"""create a new Index, don't copy the data, use the same object attributes
with passed in attributes taking precedence"""
if values is None:
return RangeIndex(
name=self.name, fastpath=True, **dict(self._get_data_as_items())
)
e... | https://github.com/pandas-dev/pandas/issues/11558 | {
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import random\n",
"import pandas as pd\n",
"\n",
"df = pd.DataFrame(\n",
" {'a': range(10),\n",
" 'medium': [random.choice(['painting', 'sculpt... | AttributeError |
def get_loc(self, key, method=None):
"""
Get integer location for requested label
Parameters
----------
key : label
method : {None}
* default: exact matches only.
Returns
-------
loc : int if unique index, possibly slice or mask if not
"""
codes = self.categories.ge... | def get_loc(self, key, method=None):
"""
Get integer location for requested label
Parameters
----------
key : label
method : {None}
* default: exact matches only.
Returns
-------
loc : int if unique index, possibly slice or mask if not
"""
codes = self.categories.ge... | https://github.com/pandas-dev/pandas/issues/11558 | {
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import random\n",
"import pandas as pd\n",
"\n",
"df = pd.DataFrame(\n",
" {'a': range(10),\n",
" 'medium': [random.choice(['painting', 'sculpt... | AttributeError |
def __init__(
self, data=None, index=None, dtype=None, name=None, copy=False, fastpath=False
):
# we are called internally, so short-circuit
if fastpath:
# data is an ndarray, index is defined
if not isinstance(data, SingleBlockManager):
data = SingleBlockManager(data, index, fas... | def __init__(
self, data=None, index=None, dtype=None, name=None, copy=False, fastpath=False
):
# we are called internally, so short-circuit
if fastpath:
# data is an ndarray, index is defined
if not isinstance(data, SingleBlockManager):
data = SingleBlockManager(data, index, fas... | https://github.com/pandas-dev/pandas/issues/12574 | In [37]: pd.Series(pd.Categorical([1,2,3]), dtype='category')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-37-87a1a3228158> in <module>()
----> 1 pd.Series(pd.Categorical([1,2,3]), dtype='category')... | ValueError |
def _period_alias_dictionary():
"""
Build freq alias dictionary to support freqs from original c_dates.c file
of the scikits.timeseries library.
"""
alias_dict = {}
M_aliases = ["M", "MTH", "MONTH", "MONTHLY"]
B_aliases = ["B", "BUS", "BUSINESS", "BUSINESSLY", "WEEKDAY"]
D_aliases = ["D... | def _period_alias_dictionary():
"""
Build freq alias dictionary to support freqs from original c_dates.c file
of the scikits.timeseries library.
"""
alias_dict = {}
M_aliases = ["M", "MTH", "MONTH", "MONTHLY"]
B_aliases = ["B", "BUS", "BUSINESS", "BUSINESSLY", "WEEKDAY"]
D_aliases = ["D... | https://github.com/pandas-dev/pandas/issues/11854 | from pandas.tseries.frequencies import _period_str_to_code
_period_str_to_code('Min')
8000
_period_str_to_code('T')
8000
_period_str_to_code('minute')
sys:1: FutureWarning: Freq "MINUTE" is deprecated, use "Min" as alternative.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "***/site-packag... | KeyError |
def _parse_excel(
self,
sheetname=0,
header=0,
skiprows=None,
skip_footer=0,
index_col=None,
has_index_names=None,
parse_cols=None,
parse_dates=False,
date_parser=None,
na_values=None,
thousands=None,
convert_float=True,
verbose=False,
squeeze=False,
**kwd... | def _parse_excel(
self,
sheetname=0,
header=0,
skiprows=None,
skip_footer=0,
index_col=None,
has_index_names=None,
parse_cols=None,
parse_dates=False,
date_parser=None,
na_values=None,
thousands=None,
convert_float=True,
verbose=False,
squeeze=False,
**kwd... | https://github.com/pandas-dev/pandas/issues/9002 | df = pd.read_excel(r'\\path_to_Excel_file',
'Sheet1', parse_cols=['MODEL_YEAR'])
returns:
---------------------------------------------------------------------------
StopIteration Traceback (most recent call last)
<ipython-input-29-336e4fd9eea1> in <module>()
4
5 df = pd.read_excel(r'\\pat... | IndexError |
def _sanitize_array(data, index, dtype=None, copy=False, raise_cast_failure=False):
"""sanitize input data to an ndarray, copy if specified, coerce to the
dtype if specified
"""
if dtype is not None:
dtype = _coerce_to_dtype(dtype)
if isinstance(data, ma.MaskedArray):
mask = ma.get... | def _sanitize_array(data, index, dtype=None, copy=False, raise_cast_failure=False):
"""sanitize input data to an ndarray, copy if specified, coerce to the
dtype if specified
"""
if dtype is not None:
dtype = _coerce_to_dtype(dtype)
if isinstance(data, ma.MaskedArray):
mask = ma.get... | https://github.com/pandas-dev/pandas/issues/12336 | In [2]: pd.Series([0,0,0], dtype="category")
Out[2]:
0 0
1 0
2 0
dtype: category
Categories (1, int64): [0]
In [3]: pd.Series(0, index=range(3), dtype="category")
---------------------------------------------------------------------------
AttributeError Traceback (most recent call l... | AttributeError |
def create_from_value(value, index, dtype):
# return a new empty value suitable for the dtype
if is_datetimetz(dtype):
subarr = DatetimeIndex([value] * len(index), dtype=dtype)
elif is_categorical_dtype(dtype):
subarr = Categorical([value] * len(index))
else:
if not isinstance(d... | def create_from_value(value, index, dtype):
# return a new empty value suitable for the dtype
if is_datetimetz(dtype):
subarr = DatetimeIndex([value] * len(index), dtype=dtype)
else:
if not isinstance(dtype, (np.dtype, type(np.dtype))):
dtype = dtype.dtype
subarr = np.em... | https://github.com/pandas-dev/pandas/issues/12336 | In [2]: pd.Series([0,0,0], dtype="category")
Out[2]:
0 0
1 0
2 0
dtype: category
Categories (1, int64): [0]
In [3]: pd.Series(0, index=range(3), dtype="category")
---------------------------------------------------------------------------
AttributeError Traceback (most recent call l... | AttributeError |
def nunique(self, dropna=True):
"""Returns number of unique elements in the group"""
ids, _, _ = self.grouper.group_info
val = self.obj.get_values()
try:
sorter = np.lexsort((val, ids))
except TypeError: # catches object dtypes
assert val.dtype == object, "val.dtype must be object,... | def nunique(self, dropna=True):
"""Returns number of unique elements in the group"""
ids, _, _ = self.grouper.group_info
val = self.obj.get_values()
try:
sorter = np.lexsort((val, ids))
except TypeError: # catches object dtypes
assert val.dtype == object, "val.dtype must be object,... | https://github.com/pandas-dev/pandas/issues/12352 | Traceback (most recent call last):
File "test.py", line 6, in <module>
tmp.groupby(pd.TimeGrouper('D')).ID.nunique()
File "/usr/lib/python3/dist-packages/pandas/core/groupby.py", line 2697, in nunique
name=self.name)
File "/usr/lib/python3/dist-packages/pandas/core/series.py", line 227, in __init__
data = SingleBlockMa... | ValueError |
def __init__(
self,
data,
precision=None,
table_styles=None,
uuid=None,
caption=None,
table_attributes=None,
):
self.ctx = defaultdict(list)
self._todo = []
if not isinstance(data, (pd.Series, pd.DataFrame)):
raise TypeError
if data.ndim == 1:
data = data.to_... | def __init__(
self,
data,
precision=None,
table_styles=None,
uuid=None,
caption=None,
table_attributes=None,
):
self.ctx = defaultdict(list)
self._todo = []
if not isinstance(data, (pd.Series, pd.DataFrame)):
raise TypeError
if data.ndim == 1:
data = data.to_... | https://github.com/pandas-dev/pandas/issues/12125 | ---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
/usr/local/lib/python3.5/site-packages/IPython/core/formatters.py in __call__(self, obj)
339 method = _safe_get_formatter_method(obj, self.print_method)
340... | KeyError |
def _translate(self):
"""
Convert the DataFrame in `self.data` and the attrs from `_build_styles`
into a dictionary of {head, body, uuid, cellstyle}
"""
table_styles = self.table_styles or []
caption = self.caption
ctx = self.ctx
precision = self.precision
uuid = self.uuid or str(uui... | def _translate(self):
"""
Convert the DataFrame in `self.data` and the attrs from `_build_styles`
into a dictionary of {head, body, uuid, cellstyle}
"""
table_styles = self.table_styles or []
caption = self.caption
ctx = self.ctx
precision = self.precision
uuid = self.uuid or str(uui... | https://github.com/pandas-dev/pandas/issues/12125 | ---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
/usr/local/lib/python3.5/site-packages/IPython/core/formatters.py in __call__(self, obj)
339 method = _safe_get_formatter_method(obj, self.print_method)
340... | KeyError |
def apply(self, func, axis=0, subset=None, **kwargs):
"""
Apply a function column-wise, row-wise, or table-wase,
updating the HTML representation with the result.
.. versionadded:: 0.17.1
Parameters
----------
func: function
axis: int, str or None
apply to each column (``axis=0... | def apply(self, func, axis=0, subset=None, **kwargs):
"""
Apply a function column-wise, row-wise, or table-wase,
updating the HTML representation with the result.
.. versionadded:: 0.17.1
Parameters
----------
func: function
axis: int, str or None
apply to each column (``axis=0... | https://github.com/pandas-dev/pandas/issues/12125 | ---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
/usr/local/lib/python3.5/site-packages/IPython/core/formatters.py in __call__(self, obj)
339 method = _safe_get_formatter_method(obj, self.print_method)
340... | KeyError |
def applymap(self, func, subset=None, **kwargs):
"""
Apply a function elementwise, updating the HTML
representation with the result.
.. versionadded:: 0.17.1
Parameters
----------
func : function
subset : IndexSlice
a valid indexer to limit ``data`` to *before* applying the
... | def applymap(self, func, subset=None, **kwargs):
"""
Apply a function elementwise, updating the HTML
representation with the result.
.. versionadded:: 0.17.1
Parameters
----------
func : function
subset : IndexSlice
a valid indexer to limit ``data`` to *before* applying the
... | https://github.com/pandas-dev/pandas/issues/12125 | ---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
/usr/local/lib/python3.5/site-packages/IPython/core/formatters.py in __call__(self, obj)
339 method = _safe_get_formatter_method(obj, self.print_method)
340... | KeyError |
def set_precision(self, precision):
"""
Set the precision used to render.
.. versionadded:: 0.17.1
Parameters
----------
precision: int
Returns
-------
self : Styler
"""
self.precision = precision
return self
| def set_precision(self, precision):
"""
Set the precision used to render.
.. versionadded:: 0.17.1
Parameters
----------
precision: int
Returns
-------
self
"""
self.precision = precision
return self
| https://github.com/pandas-dev/pandas/issues/12125 | ---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
/usr/local/lib/python3.5/site-packages/IPython/core/formatters.py in __call__(self, obj)
339 method = _safe_get_formatter_method(obj, self.print_method)
340... | KeyError |
def set_table_attributes(self, attributes):
"""
Set the table attributes. These are the items
that show up in the opening ``<table>`` tag in addition
to to automatic (by default) id.
.. versionadded:: 0.17.1
Parameters
----------
precision: int
Returns
-------
self : Style... | def set_table_attributes(self, attributes):
"""
Set the table attributes. These are the items
that show up in the opening ``<table>`` tag in addition
to to automatic (by default) id.
.. versionadded:: 0.17.1
Parameters
----------
precision: int
Returns
-------
self
"""... | https://github.com/pandas-dev/pandas/issues/12125 | ---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
/usr/local/lib/python3.5/site-packages/IPython/core/formatters.py in __call__(self, obj)
339 method = _safe_get_formatter_method(obj, self.print_method)
340... | KeyError |
def use(self, styles):
"""
Set the styles on the current Styler, possibly using styles
from ``Styler.export``.
.. versionadded:: 0.17.1
Parameters
----------
styles: list
list of style functions
Returns
-------
self : Styler
See Also
--------
Styler.export... | def use(self, styles):
"""
Set the styles on the current Styler, possibly using styles
from ``Styler.export``.
.. versionadded:: 0.17.1
Parameters
----------
styles: list
list of style functions
Returns
-------
self
See Also
--------
Styler.export
"""
... | https://github.com/pandas-dev/pandas/issues/12125 | ---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
/usr/local/lib/python3.5/site-packages/IPython/core/formatters.py in __call__(self, obj)
339 method = _safe_get_formatter_method(obj, self.print_method)
340... | KeyError |
def set_uuid(self, uuid):
"""
Set the uuid for a Styler.
.. versionadded:: 0.17.1
Parameters
----------
uuid: str
Returns
-------
self : Styler
"""
self.uuid = uuid
return self
| def set_uuid(self, uuid):
"""
Set the uuid for a Styler.
.. versionadded:: 0.17.1
Parameters
----------
uuid: str
Returns
-------
self
"""
self.uuid = uuid
return self
| https://github.com/pandas-dev/pandas/issues/12125 | ---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
/usr/local/lib/python3.5/site-packages/IPython/core/formatters.py in __call__(self, obj)
339 method = _safe_get_formatter_method(obj, self.print_method)
340... | KeyError |
def set_caption(self, caption):
"""
Se the caption on a Styler
.. versionadded:: 0.17.1
Parameters
----------
caption: str
Returns
-------
self : Styler
"""
self.caption = caption
return self
| def set_caption(self, caption):
"""
Se the caption on a Styler
.. versionadded:: 0.17.1
Parameters
----------
caption: str
Returns
-------
self
"""
self.caption = caption
return self
| https://github.com/pandas-dev/pandas/issues/12125 | ---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
/usr/local/lib/python3.5/site-packages/IPython/core/formatters.py in __call__(self, obj)
339 method = _safe_get_formatter_method(obj, self.print_method)
340... | KeyError |
def set_table_styles(self, table_styles):
"""
Set the table styles on a Styler. These are placed in a
``<style>`` tag before the generated HTML table.
.. versionadded:: 0.17.1
Parameters
----------
table_styles: list
Each individual table_style should be a dictionary with
`... | def set_table_styles(self, table_styles):
"""
Set the table styles on a Styler. These are placed in a
``<style>`` tag before the generated HTML table.
.. versionadded:: 0.17.1
Parameters
----------
table_styles: list
Each individual table_style should be a dictionary with
`... | https://github.com/pandas-dev/pandas/issues/12125 | ---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
/usr/local/lib/python3.5/site-packages/IPython/core/formatters.py in __call__(self, obj)
339 method = _safe_get_formatter_method(obj, self.print_method)
340... | KeyError |
def highlight_null(self, null_color="red"):
"""
Shade the background ``null_color`` for missing values.
.. versionadded:: 0.17.1
Parameters
----------
null_color: str
Returns
-------
self : Styler
"""
self.applymap(self._highlight_null, null_color=null_color)
return se... | def highlight_null(self, null_color="red"):
"""
Shade the background ``null_color`` for missing values.
.. versionadded:: 0.17.1
Parameters
----------
null_color: str
Returns
-------
self
"""
self.applymap(self._highlight_null, null_color=null_color)
return self
| https://github.com/pandas-dev/pandas/issues/12125 | ---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
/usr/local/lib/python3.5/site-packages/IPython/core/formatters.py in __call__(self, obj)
339 method = _safe_get_formatter_method(obj, self.print_method)
340... | KeyError |
def background_gradient(self, cmap="PuBu", low=0, high=0, axis=0, subset=None):
"""
Color the background in a gradient according to
the data in each column (optionally row).
Requires matplotlib.
.. versionadded:: 0.17.1
Parameters
----------
cmap: str or colormap
matplotlib col... | def background_gradient(self, cmap="PuBu", low=0, high=0, axis=0, subset=None):
"""
Color the background in a gradient according to
the data in each column (optionally row).
Requires matplotlib.
.. versionadded:: 0.17.1
Parameters
----------
cmap: str or colormap
matplotlib col... | https://github.com/pandas-dev/pandas/issues/12125 | ---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
/usr/local/lib/python3.5/site-packages/IPython/core/formatters.py in __call__(self, obj)
339 method = _safe_get_formatter_method(obj, self.print_method)
340... | KeyError |
def bar(self, subset=None, axis=0, color="#d65f5f", width=100):
"""
Color the background ``color`` proptional to the values in each column.
Excludes non-numeric data by default.
.. versionadded:: 0.17.1
Parameters
----------
subset: IndexSlice, default None
a valid slice for ``data... | def bar(self, subset=None, axis=0, color="#d65f5f", width=100):
"""
Color the background ``color`` proptional to the values in each column.
Excludes non-numeric data by default.
.. versionadded:: 0.17.1
Parameters
----------
subset: IndexSlice, default None
a valid slice for ``data... | https://github.com/pandas-dev/pandas/issues/12125 | ---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
/usr/local/lib/python3.5/site-packages/IPython/core/formatters.py in __call__(self, obj)
339 method = _safe_get_formatter_method(obj, self.print_method)
340... | KeyError |
def highlight_max(self, subset=None, color="yellow", axis=0):
"""
Highlight the maximum by shading the background
.. versionadded:: 0.17.1
Parameters
----------
subset: IndexSlice, default None
a valid slice for ``data`` to limit the style application to
color: str, default 'yellow... | def highlight_max(self, subset=None, color="yellow", axis=0):
"""
Highlight the maximum by shading the background
.. versionadded:: 0.17.1
Parameters
----------
subset: IndexSlice, default None
a valid slice for ``data`` to limit the style application to
color: str, default 'yellow... | https://github.com/pandas-dev/pandas/issues/12125 | ---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
/usr/local/lib/python3.5/site-packages/IPython/core/formatters.py in __call__(self, obj)
339 method = _safe_get_formatter_method(obj, self.print_method)
340... | KeyError |
def highlight_min(self, subset=None, color="yellow", axis=0):
"""
Highlight the minimum by shading the background
.. versionadded:: 0.17.1
Parameters
----------
subset: IndexSlice, default None
a valid slice for ``data`` to limit the style application to
color: str, default 'yellow... | def highlight_min(self, subset=None, color="yellow", axis=0):
"""
Highlight the minimum by shading the background
.. versionadded:: 0.17.1
Parameters
----------
subset: IndexSlice, default None
a valid slice for ``data`` to limit the style application to
color: str, default 'yellow... | https://github.com/pandas-dev/pandas/issues/12125 | ---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
/usr/local/lib/python3.5/site-packages/IPython/core/formatters.py in __call__(self, obj)
339 method = _safe_get_formatter_method(obj, self.print_method)
340... | KeyError |
def _apply_standard(self, func, axis, ignore_failures=False, reduce=True):
# skip if we are mixed datelike and trying reduce across axes
# GH6125
if reduce and axis == 1 and self._is_mixed_type and self._is_datelike_mixed_type:
reduce = False
# try to reduce first (by default)
# this only m... | def _apply_standard(self, func, axis, ignore_failures=False, reduce=True):
# skip if we are mixed datelike and trying reduce across axes
# GH6125
if reduce and axis == 1 and self._is_mixed_type and self._is_datelike_mixed_type:
reduce = False
# try to reduce first (by default)
# this only m... | https://github.com/pandas-dev/pandas/issues/12244 | In [29]: df = pd.DataFrame({'dt': pd.date_range("2015-01-01", periods=3, tz='Europe/Brussels')})
In [30]: df
Out[30]:
dt
0 2015-01-01 00:00:00+01:00
1 2015-01-02 00:00:00+01:00
2 2015-01-03 00:00:00+01:00
In [31]: df.apply(lambda x: x)
---------------------------------------------------------------------------
TypeEr... | TypeError |
def sort_values(self, return_indexer=False, ascending=True):
"""
Return sorted copy of Index
"""
if return_indexer:
_as = self.argsort()
if not ascending:
_as = _as[::-1]
sorted_index = self.take(_as)
return sorted_index, _as
else:
sorted_values = ... | def sort_values(self, return_indexer=False, ascending=True):
"""
Return sorted copy of Index
"""
if return_indexer:
_as = self.argsort()
if not ascending:
_as = _as[::-1]
sorted_index = self.take(_as)
return sorted_index, _as
else:
sorted_values = ... | https://github.com/pandas-dev/pandas/issues/11718 | In [1]: import pandas as pd
In [2]: pd.Timestamp(None, tz='utc') - pd.Timestamp('now', tz='utc')
Traceback (most recent call last):
File "<ipython-input-2-5e0738cec5fa>", line 1, in <module>
pd.Timestamp(None, tz='utc') - pd.Timestamp('now', tz='utc')
File "pandas\tslib.pyx", line 1099, in pandas.tslib._NaT.__sub__ ... | TypeError |
def _sub_datelike(self, other):
# subtract a datetime from myself, yielding a TimedeltaIndex
from pandas import TimedeltaIndex
other = Timestamp(other)
if other is tslib.NaT:
result = self._nat_new(box=False)
# require tz compat
elif not self._has_same_tz(other):
raise TypeError... | def _sub_datelike(self, other):
# subtract a datetime from myself, yielding a TimedeltaIndex
from pandas import TimedeltaIndex
other = Timestamp(other)
# require tz compat
if not self._has_same_tz(other):
raise TypeError(
"Timestamp subtraction must have the same timezones or ... | https://github.com/pandas-dev/pandas/issues/11718 | In [1]: import pandas as pd
In [2]: pd.Timestamp(None, tz='utc') - pd.Timestamp('now', tz='utc')
Traceback (most recent call last):
File "<ipython-input-2-5e0738cec5fa>", line 1, in <module>
pd.Timestamp(None, tz='utc') - pd.Timestamp('now', tz='utc')
File "pandas\tslib.pyx", line 1099, in pandas.tslib._NaT.__sub__ ... | TypeError |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.