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 _consolidate(blocks, items):
"""
Merge blocks having same dtype
"""
get_dtype = lambda x: x.dtype.name
# sort by dtype
grouper = itertools.groupby(sorted(blocks, key=get_dtype), lambda x: x.dtype)
new_blocks = []
for dtype, group_blocks in grouper:
new_block = _merge_blocks... | def _consolidate(blocks, items):
"""
Merge blocks having same dtype
"""
get_dtype = lambda x: x.dtype
# sort by dtype
grouper = itertools.groupby(sorted(blocks, key=get_dtype), lambda x: x.dtype)
new_blocks = []
for dtype, group_blocks in grouper:
new_block = _merge_blocks(list... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def _nanvar(values, axis=None, skipna=True, ddof=1):
mask = isnull(values)
if axis is not None:
count = (values.shape[axis] - mask.sum(axis)).astype(float)
else:
count = float(values.size - mask.sum())
if skipna:
values = values.copy()
np.putmask(values, mask, 0)
X... | def _nanvar(values, axis=None, skipna=True, ddof=1):
mask = isnull(values)
if axis is not None:
count = (values.shape[axis] - mask.sum(axis)).astype(float)
else:
count = float(values.size - mask.sum())
if skipna:
values = values.copy()
np.putmask(values, mask, 0)
X... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def _nanmin(values, axis=None, skipna=True):
mask = isnull(values)
if skipna and not issubclass(values.dtype.type, (np.integer, np.datetime64)):
values = values.copy()
np.putmask(values, mask, np.inf)
# numpy 1.6.1 workaround in Python 3.x
if values.dtype == np.object_ and sys.version_in... | def _nanmin(values, axis=None, skipna=True):
mask = isnull(values)
if skipna and not issubclass(values.dtype.type, np.integer):
values = values.copy()
np.putmask(values, mask, np.inf)
# numpy 1.6.1 workaround in Python 3.x
if values.dtype == np.object_ and sys.version_info[0] >= 3: # pr... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def _nanmax(values, axis=None, skipna=True):
mask = isnull(values)
if skipna and not issubclass(values.dtype.type, (np.integer, np.datetime64)):
values = values.copy()
np.putmask(values, mask, -np.inf)
# numpy 1.6.1 workaround in Python 3.x
if values.dtype == np.object_ and sys.version_i... | def _nanmax(values, axis=None, skipna=True):
mask = isnull(values)
if skipna and not issubclass(values.dtype.type, np.integer):
values = values.copy()
np.putmask(values, mask, -np.inf)
# numpy 1.6.1 workaround in Python 3.x
if values.dtype == np.object_ and sys.version_info[0] >= 3: # p... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def unique1d(values):
"""
Hash table-based unique
"""
if np.issubdtype(values.dtype, np.floating):
table = lib.Float64HashTable(len(values))
uniques = np.array(table.unique(com._ensure_float64(values)), dtype=np.float64)
elif np.issubdtype(values.dtype, np.datetime64):
table ... | def unique1d(values):
"""
Hash table-based unique
"""
if issubclass(values.dtype.type, np.floating):
if values.dtype != np.float64:
values = values.astype(np.float64)
table = lib.Float64HashTable(len(values))
uniques = np.array(table.unique(values), dtype=np.float64)
... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def swapaxes(self, axis1="major", axis2="minor", copy=True):
"""
Interchange axes and swap values axes appropriately
Returns
-------
y : Panel (new object)
"""
i = self._get_axis_number(axis1)
j = self._get_axis_number(axis2)
if i == j:
raise ValueError("Cannot specify the ... | def swapaxes(self, axis1="major", axis2="minor"):
"""
Interchange axes and swap values axes appropriately
Returns
-------
y : Panel (new object)
"""
i = self._get_axis_number(axis1)
j = self._get_axis_number(axis2)
if i == j:
raise ValueError("Cannot specify the same axis")... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def _extract_axis(data, axis=0, intersect=False):
if len(data) == 0:
index = Index([])
elif len(data) > 0:
raw_lengths = []
indexes = []
have_raw_arrays = False
have_frames = False
for v in data.values():
if isinstance(v, DataFrame):
... | def _extract_axis(data, axis=0, intersect=False):
from pandas.core.index import _union_indexes
if len(data) == 0:
index = Index([])
elif len(data) > 0:
raw_lengths = []
indexes = []
have_raw_arrays = False
have_frames = False
for v in data.values():
... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def get_new_values(self):
values = self.values
# place the values
length, width = self.full_shape
stride = values.shape[1]
result_width = width * stride
new_values = np.empty((length, result_width), dtype=values.dtype)
new_mask = np.zeros((length, result_width), dtype=bool)
if issubcla... | def get_new_values(self):
return self._reshape_values(self.values)
| https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def unstack(obj, level):
if isinstance(level, (tuple, list)):
return _unstack_multiple(obj, level)
if isinstance(obj, DataFrame):
if isinstance(obj.index, MultiIndex):
return _unstack_frame(obj, level)
else:
return obj.T.stack(dropna=False)
else:
unst... | def unstack(obj, level):
if isinstance(obj, DataFrame):
if isinstance(obj.index, MultiIndex):
return _unstack_frame(obj, level)
else:
return obj.T.stack(dropna=False)
else:
unstacker = _Unstacker(obj.values, obj.index, level=level)
return unstacker.get_res... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def _get_val_at(self, loc):
n = len(self)
if loc < 0:
loc += n
if loc >= len(self) or loc < 0:
raise Exception("Out of bounds access")
sp_loc = self.sp_index.lookup(loc)
if sp_loc == -1:
return self.fill_value
else:
return lib.get_value_at(self, sp_loc)
| def _get_val_at(self, loc):
n = len(self)
if loc < 0:
loc += n
if loc >= len(self) or loc < 0:
raise Exception("Out of bounds access")
sp_loc = self.sp_index.lookup(loc)
if sp_loc == -1:
return self.fill_value
else:
return _gin.get_value_at(self, sp_loc)
| https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def __getitem__(self, item):
"""
Retrieve column or slice from DataFrame
"""
try:
# unsure about how kludgy this is
s = self._series[item]
s.name = item
return s
except (TypeError, KeyError):
if isinstance(item, slice):
date_rng = self.index[item]
... | def __getitem__(self, item):
"""
Retrieve column or slice from DataFrame
"""
try:
# unsure about how kludgy this is
s = self._series[item]
s.name = item
return s
except (TypeError, KeyError):
if isinstance(item, slice):
dateRange = self.index[item]... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def _combine_frame(self, other, func, fill_value=None, level=None):
this, other = self.align(other, join="outer", level=level, copy=False)
new_index, new_columns = this.index, this.columns
if level is not None:
raise NotImplementedError
if self.empty and other.empty:
return SparseDataF... | def _combine_frame(self, other, func, fill_value=None, level=None):
this, other = self.align(other, join="outer", level=level, copy=False)
new_index, new_columns = this.index, this.columns
if level is not None:
raise NotImplementedError
if not self and not other:
return SparseDataFrame... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def _reindex_index(self, index, method, copy, level, fill_value=np.nan, limit=None):
if level is not None:
raise Exception("Reindex by level not supported for sparse")
if self.index.equals(index):
if copy:
return self.copy()
else:
return self
if len(self.ind... | def _reindex_index(self, index, method, copy, level, fill_value=np.nan):
if level is not None:
raise Exception("Reindex by level not supported for sparse")
if self.index.equals(index):
if copy:
return self.copy()
else:
return self
if len(self.index) == 0:
... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def _reindex_columns(self, columns, copy, level, fill_value, limit=None):
if level is not None:
raise Exception("Reindex by level not supported for sparse")
if com.notnull(fill_value):
raise NotImplementedError
if limit:
raise NotImplementedError
# TODO: fill value handling
... | def _reindex_columns(self, columns, copy, level, fill_value):
if level is not None:
raise Exception("Reindex by level not supported for sparse")
if com.notnull(fill_value):
raise NotImplementedError
# TODO: fill value handling
sdict = dict((k, v) for k, v in self.iteritems() if k in co... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def take(self, indices, axis=0):
"""
Analogous to ndarray.take, return SparseDataFrame corresponding to
requested indices along an axis
Parameters
----------
indices : list / array of ints
axis : {0, 1}
Returns
-------
taken : SparseDataFrame
"""
indices = com._ensure_p... | def take(self, indices, axis=0):
"""
Analogous to ndarray.take, return SparseDataFrame corresponding to
requested indices along an axis
Parameters
----------
indices : list / array of ints
axis : {0, 1}
Returns
-------
taken : SparseDataFrame
"""
new_values = self.value... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def shift(self, periods, freq=None, **kwds):
"""
Analogous to DataFrame.shift
"""
from pandas.core.series import _resolve_offset
offset = _resolve_offset(freq, kwds)
new_series = {}
if offset is None:
new_index = self.index
for col, s in self.iteritems():
new_se... | def shift(self, periods, offset=None, timeRule=None):
"""
Analogous to DataFrame.shift
"""
if timeRule is not None and offset is None:
offset = datetools.getOffset(timeRule)
new_series = {}
if offset is None:
new_index = self.index
for col, s in self.iteritems():
... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def fillna(self, value=None, method="pad", inplace=False, limit=None):
new_series = {}
for k, v in self.iterkv():
new_series[k] = v.fillna(value=value, method=method, limit=limit)
if inplace:
self._series = new_series
return self
else:
return self._constructor(new_series... | def fillna(self, value=None, method="pad", inplace=False):
new_series = {}
for k, v in self.iterkv():
new_series[k] = v.fillna(value=value, method=method)
if inplace:
self._series = new_series
return self
else:
return self._constructor(new_series, index=self.index, colum... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def __getstate__(self):
# pickling
return (
self._frames,
com._pickle_array(self.items),
com._pickle_array(self.major_axis),
com._pickle_array(self.minor_axis),
self.default_fill_value,
self.default_kind,
)
| def __getstate__(self):
# pickling
return (
self._frames,
_pickle_array(self.items),
_pickle_array(self.major_axis),
_pickle_array(self.minor_axis),
self.default_fill_value,
self.default_kind,
)
| https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def __setstate__(self, state):
frames, items, major, minor, fv, kind = state
self.default_fill_value = fv
self.default_kind = kind
self._items = _ensure_index(com._unpickle_array(items))
self._major_axis = _ensure_index(com._unpickle_array(major))
self._minor_axis = _ensure_index(com._unpickle_... | def __setstate__(self, state):
frames, items, major, minor, fv, kind = state
self.default_fill_value = fv
self.default_kind = kind
self._items = _ensure_index(_unpickle_array(items))
self._major_axis = _ensure_index(_unpickle_array(major))
self._minor_axis = _ensure_index(_unpickle_array(minor)... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def reindex(
self,
major=None,
items=None,
minor=None,
major_axis=None,
minor_axis=None,
copy=False,
):
"""
Conform / reshape panel axis labels to new input labels
Parameters
----------
major : array-like, default None
items : array-like, default None
minor : arr... | def reindex(
self,
major=None,
items=None,
minor=None,
major_axis=None,
minor_axis=None,
copy=False,
):
"""
Conform / reshape panel axis labels to new input labels
Parameters
----------
major : array-like, default None
items : array-like, default None
minor : arr... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
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... | def reindex(self, index=None, method=None, copy=True):
"""
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/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def fillna(self, value=None, method="pad", inplace=False, limit=None):
dense = self.to_dense()
filled = dense.fillna(value=value, method=method, limit=limit)
result = filled.to_sparse(kind=self.kind, fill_value=self.fill_value)
if inplace:
self.sp_values[:] = result.values
return self
... | def fillna(self, value=None, method="pad", inplace=False):
dense = self.to_dense()
filled = dense.fillna(value=value, method=method)
result = filled.to_sparse(kind=self.kind, fill_value=self.fill_value)
if inplace:
self.sp_values[:] = result.values
return self
else:
return r... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def shift(self, periods, freq=None, **kwds):
"""
Analogous to Series.shift
"""
from pandas.core.series import _resolve_offset
offset = _resolve_offset(freq, kwds)
# no special handling of fill values yet
if not isnull(self.fill_value):
dense_shifted = self.to_dense().shift(periods,... | def shift(self, periods, offset=None, timeRule=None):
"""
Analogous to Series.shift
"""
# no special handling of fill values yet
if not isnull(self.fill_value):
dense_shifted = self.to_dense().shift(periods, offset=offset, timeRule=timeRule)
return dense_shifted.to_sparse(fill_value=... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def generate_take_cython_file(path="generated.pyx"):
with open(path, "w") as f:
print >> f, header
print >> f, generate_ensure_dtypes()
for template in templates_1d:
print >> f, generate_from_template(template)
for template in templates_2d:
print >> f, gene... | def generate_take_cython_file(path="generated.pyx"):
with open(path, "w") as f:
for template in templates_1d:
print >> f, generate_from_template(template)
for template in templates_2d:
print >> f, generate_from_template(template, ndim=2)
for template in nobool_1d_te... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def quantileTS(frame, percentile):
"""
Return score at percentile for each point in time (cross-section)
Parameters
----------
frame: DataFrame
percentile: int
nth percentile
Returns
-------
Series (or TimeSeries)
"""
def func(x):
x = np.asarray(x.valid())
... | def quantileTS(frame, percentile):
"""
Return score at percentile for each point in time (cross-section)
Parameters
----------
frame: DataFrame
percentile: int
nth percentile
See also
--------
scipy.stats.scoreatpercentile
Returns
-------
Series (or TimeSeries)
... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def percentileRank(frame, column=None, kind="mean"):
"""
Return score at percentile for each point in time (cross-section)
Parameters
----------
frame: DataFrame
column: string or Series, optional
Column name or specific Series to compute percentiles for.
If not provided, percenti... | def percentileRank(frame, column=None, kind="mean"):
"""
Return score at percentile for each point in time (cross-section)
Parameters
----------
frame: DataFrame
column: string or Series, optional
Column name or specific Series to compute percentiles for.
If not provided, percenti... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def rolling_count(arg, window, freq=None, time_rule=None):
"""
Rolling count of number of non-NaN observations inside provided window.
Parameters
----------
arg : DataFrame or numpy ndarray-like
window : Number of observations used for calculating statistic
freq : None or string alias / da... | def rolling_count(arg, window, time_rule=None):
"""
Rolling count of number of non-NaN observations inside provided window.
Parameters
----------
arg : DataFrame or numpy ndarray-like
window : Number of observations used for calculating statistic
Returns
-------
rolling_count : ty... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def _rolling_moment(arg, window, func, minp, axis=0, freq=None, time_rule=None):
"""
Rolling statistical measure using supplied function. Designed to be
used with passed-in Cython array-based functions.
Parameters
----------
arg : DataFrame or numpy ndarray-like
window : Number of observat... | def _rolling_moment(arg, window, func, minp, axis=0, time_rule=None):
"""
Rolling statistical measure using supplied function. Designed to be
used with passed-in Cython array-based functions.
Parameters
----------
arg : DataFrame or numpy ndarray-like
window : Number of observations used f... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def ewma(arg, com=None, span=None, min_periods=0, freq=None, time_rule=None):
com = _get_center_of_mass(com, span)
arg = _conv_timerule(arg, freq, time_rule)
def _ewma(v):
result = _tseries.ewma(v, com)
first_index = _first_valid_index(v)
result[first_index : first_index + min_perio... | def ewma(arg, com=None, span=None, min_periods=0, time_rule=None):
com = _get_center_of_mass(com, span)
arg = _conv_timerule(arg, time_rule)
def _ewma(v):
result = _tseries.ewma(v, com)
first_index = _first_valid_index(v)
result[first_index : first_index + min_periods] = NaN
... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def ewmvar(
arg, com=None, span=None, min_periods=0, bias=False, freq=None, time_rule=None
):
com = _get_center_of_mass(com, span)
arg = _conv_timerule(arg, freq, time_rule)
moment2nd = ewma(arg * arg, com=com, min_periods=min_periods)
moment1st = ewma(arg, com=com, min_periods=min_periods)
res... | def ewmvar(arg, com=None, span=None, min_periods=0, bias=False, time_rule=None):
com = _get_center_of_mass(com, span)
arg = _conv_timerule(arg, time_rule)
moment2nd = ewma(arg * arg, com=com, min_periods=min_periods)
moment1st = ewma(arg, com=com, min_periods=min_periods)
result = moment2nd - momen... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def ewmcov(
arg1,
arg2,
com=None,
span=None,
min_periods=0,
bias=False,
freq=None,
time_rule=None,
):
X, Y = _prep_binary(arg1, arg2)
X = _conv_timerule(X, freq, time_rule)
Y = _conv_timerule(Y, freq, time_rule)
mean = lambda x: ewma(x, com=com, span=span, min_periods=m... | def ewmcov(arg1, arg2, com=None, span=None, min_periods=0, bias=False, time_rule=None):
X, Y = _prep_binary(arg1, arg2)
X = _conv_timerule(X, time_rule)
Y = _conv_timerule(Y, time_rule)
mean = lambda x: ewma(x, com=com, span=span, min_periods=min_periods)
result = mean(X * Y) - mean(X) * mean(Y)
... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def ewmcorr(arg1, arg2, com=None, span=None, min_periods=0, freq=None, time_rule=None):
X, Y = _prep_binary(arg1, arg2)
X = _conv_timerule(X, freq, time_rule)
Y = _conv_timerule(Y, freq, time_rule)
mean = lambda x: ewma(x, com=com, span=span, min_periods=min_periods)
var = lambda x: ewmvar(x, com=... | def ewmcorr(arg1, arg2, com=None, span=None, min_periods=0, time_rule=None):
X, Y = _prep_binary(arg1, arg2)
X = _conv_timerule(X, time_rule)
Y = _conv_timerule(Y, time_rule)
mean = lambda x: ewma(x, com=com, span=span, min_periods=min_periods)
var = lambda x: ewmvar(x, com=com, span=span, min_per... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def _conv_timerule(arg, freq, time_rule):
if time_rule is not None:
import warnings
warnings.warn(
"time_rule argument is deprecated, replace with freq", FutureWarning
)
freq = time_rule
types = (DataFrame, Series)
if freq is not None and isinstance(arg, types)... | def _conv_timerule(arg, time_rule):
types = (DataFrame, Series)
if time_rule is not None and isinstance(arg, types):
# Conform to whatever frequency needed.
arg = arg.asfreq(time_rule)
return arg
| https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def _rolling_func(func, desc, check_minp=_use_window):
@Substitution(desc, _unary_arg, _type_of_input)
@Appender(_doc_template)
@wraps(func)
def f(arg, window, min_periods=None, freq=None, time_rule=None):
def call_cython(arg, window, minp):
minp = check_minp(minp, window)
... | def _rolling_func(func, desc, check_minp=_use_window):
@Substitution(desc, _unary_arg, _type_of_input)
@Appender(_doc_template)
@wraps(func)
def f(arg, window, min_periods=None, time_rule=None):
def call_cython(arg, window, minp):
minp = check_minp(minp, window)
return fu... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def f(arg, window, min_periods=None, freq=None, time_rule=None):
def call_cython(arg, window, minp):
minp = check_minp(minp, window)
return func(arg, window, minp)
return _rolling_moment(
arg, window, call_cython, min_periods, freq=freq, time_rule=time_rule
)
| def f(arg, window, min_periods=None, time_rule=None):
def call_cython(arg, window, minp):
minp = check_minp(minp, window)
return func(arg, window, minp)
return _rolling_moment(arg, window, call_cython, min_periods, time_rule=time_rule)
| https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def rolling_quantile(
arg, window, quantile, min_periods=None, freq=None, time_rule=None
):
"""Moving quantile
Parameters
----------
arg : Series, DataFrame
window : Number of observations used for calculating statistic
quantile : 0 <= quantile <= 1
min_periods : int
Minimum num... | def rolling_quantile(arg, window, quantile, min_periods=None, time_rule=None):
"""Moving quantile
Parameters
----------
arg : Series, DataFrame
window : Number of observations used for calculating statistic
quantile : 0 <= quantile <= 1
min_periods : int
Minimum number of observatio... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def rolling_apply(arg, window, func, min_periods=None, freq=None, time_rule=None):
"""Generic moving function application
Parameters
----------
arg : Series, DataFrame
window : Number of observations used for calculating statistic
func : function
Must produce a single value from an ndar... | def rolling_apply(arg, window, func, min_periods=None, time_rule=None):
"""Generic moving function application
Parameters
----------
arg : Series, DataFrame
window : Number of observations used for calculating statistic
func : function
Must produce a single value from an ndarray input
... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def pivot_table(
data,
values=None,
rows=None,
cols=None,
aggfunc="mean",
fill_value=None,
margins=False,
):
"""
Create a spreadsheet-style pivot table as a DataFrame. The levels in the
pivot table will be stored in MultiIndex objects (hierarchical indexes) on
the index and c... | def pivot_table(
data,
values=None,
rows=None,
cols=None,
aggfunc="mean",
fill_value=None,
margins=False,
):
"""
Create a spreadsheet-style pivot table as a DataFrame. The levels in the
pivot table will be stored in MultiIndex objects (hierarchical indexes) on
the index and c... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def scatter_matrix(
frame,
alpha=0.5,
figsize=None,
ax=None,
grid=False,
diagonal="hist",
marker=".",
**kwds,
):
"""
Draw a matrix of scatter plots.
Parameters
----------
alpha : amount of transparency applied
figsize : a tuple (width, height) in inches
ax : ... | def scatter_matrix(frame, alpha=0.5, figsize=None, **kwds):
"""
Draw a matrix of scatter plots.
Parameters
----------
kwds : other plotting keyword arguments
To be passed to scatter function
Examples
--------
>>> df = DataFrame(np.random.randn(1000, 4), columns=['A','B','C','D'... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def _iter_data(self):
from pandas.core.frame import DataFrame
if isinstance(self.data, (Series, np.ndarray)):
yield com._stringify(self.label), np.asarray(self.data)
elif isinstance(self.data, DataFrame):
df = self.data
if self.sort_columns:
columns = com._try_sort(df.c... | def _iter_data(self):
from pandas.core.frame import DataFrame
from pandas.core.series import Series
if isinstance(self.data, (Series, np.ndarray)):
yield com._stringify(self.label), np.asarray(self.data)
elif isinstance(self.data, DataFrame):
df = self.data
if self.sort_columns... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def _adorn_subplots(self):
if self.subplots:
to_adorn = self.axes
else:
to_adorn = [self.ax]
# todo: sharex, sharey handling?
for ax in to_adorn:
if self.yticks is not None:
ax.set_yticks(self.yticks)
if self.xticks is not None:
ax.set_xticks(se... | def _adorn_subplots(self):
if self.subplots:
to_adorn = self.axes
else:
to_adorn = [self.ax]
# todo: sharex, sharey handling?
for ax in to_adorn:
if self.yticks is not None:
ax.set_yticks(self.yticks)
if self.xticks is not None:
ax.set_xticks(se... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def _get_xticks(self):
index = self.data.index
is_datetype = index.inferred_type in ("datetime", "date", "datetime64")
if self.use_index:
if index.is_numeric() or is_datetype:
"""
Matplotlib supports numeric values or datetime objects as
xaxis values. Tak... | def _get_xticks(self):
index = self.data.index
is_datetype = index.inferred_type in ("datetime", "date")
if self.use_index:
if index.is_numeric() or is_datetype:
"""
Matplotlib supports numeric values or datetime objects as
xaxis values. Taking LBYL appro... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def _make_plot(self):
# this is slightly deceptive
if self.use_index and self.has_ts_index:
data = self._maybe_convert_index(self.data)
self._make_ts_plot(data)
else:
x = self._get_xticks()
plotf = self._get_plot_function()
for i, (label, y) in enumerate(self._iter_... | def _make_plot(self):
# this is slightly deceptive
x = self._get_xticks()
plotf = self._get_plot_function()
for i, (label, y) in enumerate(self._iter_data()):
if self.subplots:
ax = self.axes[i]
style = "k"
else:
style = "" # empty string ignored
... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def _post_plot_logic(self):
df = self.data
if self.legend:
if self.subplots:
for ax in self.axes:
ax.legend(loc="best")
else:
self.axes[0].legend(loc="best")
condition = (
not self.has_ts_index
and df.index.is_all_dates
and no... | def _post_plot_logic(self):
df = self.data
if self.subplots and self.legend:
self.axes[0].legend(loc="best")
condition = (
df.index.is_all_dates and not self.subplots or (self.subplots and self.sharex)
)
for ax in self.axes:
if condition:
format_date_labels(ax)... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def _make_plot(self):
colors = "brgyk"
rects = []
labels = []
ax = self.axes[0]
bar_f = self.bar_f
pos_prior = neg_prior = np.zeros(len(self.data))
K = self.nseries
for i, (label, y) in enumerate(self._iter_data()):
kwds = self.kwds.copy()
if "color" not in kwds:
... | def _make_plot(self):
colors = "brgyk"
rects = []
labels = []
ax = self.axes[0]
bar_f = self.bar_f
pos_prior = neg_prior = np.zeros(len(self.data))
K = self.nseries
for i, (label, y) in enumerate(self._iter_data()):
kwds = self.kwds.copy()
if "color" not in kwds:
... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def plot_series(
series,
label=None,
kind="line",
use_index=True,
rot=None,
xticks=None,
yticks=None,
xlim=None,
ylim=None,
ax=None,
style=None,
grid=True,
logy=False,
**kwds,
):
"""
Plot the input series with the index on the x-axis using matplotlib
... | def plot_series(
series,
label=None,
kind="line",
use_index=True,
rot=None,
xticks=None,
yticks=None,
xlim=None,
ylim=None,
ax=None,
style=None,
grid=True,
logy=False,
**kwds,
):
"""
Plot the input series with the index on the x-axis using matplotlib
... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def boxplot(
data, column=None, by=None, ax=None, fontsize=None, rot=0, grid=True, figsize=None
):
"""
Make a box plot from DataFrame column optionally grouped b ysome columns or
other inputs
Parameters
----------
data : DataFrame or Series
column : column name or list of names, or vect... | def boxplot(
data, column=None, by=None, ax=None, fontsize=None, rot=0, grid=True, figsize=None
):
"""
Make a box plot from DataFrame column optionally grouped b ysome columns or
other inputs
Parameters
----------
data : DataFrame
column : column name or list of names, or vector
... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def scatter_plot(data, x, y, by=None, ax=None, figsize=None, grid=False):
"""
Returns
-------
fig : matplotlib.Figure
"""
import matplotlib.pyplot as plt
def plot_group(group, ax):
xvals = group[x].values
yvals = group[y].values
ax.scatter(xvals, yvals)
ax.g... | def scatter_plot(data, x, y, by=None, ax=None, figsize=None):
"""
Returns
-------
fig : matplotlib.Figure
"""
import matplotlib.pyplot as plt
def plot_group(group, ax):
xvals = group[x].values
yvals = group[y].values
ax.scatter(xvals, yvals)
if by is not None:
... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def plot_group(group, ax):
xvals = group[x].values
yvals = group[y].values
ax.scatter(xvals, yvals)
ax.grid(grid)
| def plot_group(group, ax):
xvals = group[x].values
yvals = group[y].values
ax.scatter(xvals, yvals)
| https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def hist_frame(
data,
grid=True,
xlabelsize=None,
xrot=None,
ylabelsize=None,
yrot=None,
ax=None,
**kwds,
):
"""
Draw Histogram the DataFrame's series using matplotlib / pylab.
Parameters
----------
grid : boolean, default True
Whether to show axis grid lines... | def hist_frame(
data,
grid=True,
xlabelsize=None,
xrot=None,
ylabelsize=None,
yrot=None,
ax=None,
**kwds,
):
"""
Draw Histogram the DataFrame's series using matplotlib / pylab.
Parameters
----------
grid : boolean, default True
Whether to show axis grid lines... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def _subplots(
nrows=1,
ncols=1,
sharex=False,
sharey=False,
squeeze=True,
subplot_kw=None,
ax=None,
**fig_kw,
):
"""Create a figure with a set of subplots already made.
This utility wrapper makes it convenient to create common layouts of
subplots, including the enclosing fi... | def _subplots(
nrows=1,
ncols=1,
sharex=False,
sharey=False,
squeeze=True,
subplot_kw=None,
ax=None,
**fig_kw,
):
"""Create a figure with a set of subplots already made.
This utility wrapper makes it convenient to create common layouts of
subplots, including the enclosing fi... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def initialize_options(self):
self.all = True
self._clean_me = []
self._clean_trees = []
self._clean_exclude = [
"np_datetime.c",
"np_datetime_strings.c",
"period.c",
"ujson.c",
"objToJSON.c",
"JSONtoObj.c",
"ultrajsonenc.c",
"ultrajsondec.... | def initialize_options(self):
self.all = True
self._clean_me = []
self._clean_trees = []
for root, dirs, files in list(os.walk("pandas")):
for f in files:
if os.path.splitext(f)[-1] in (".pyc", ".so", ".o", ".pyd", ".c"):
self._clean_me.append(pjoin(root, f))
... | https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def run_process():
runner = BenchmarkRunner(
benchmarks,
REPO_PATH,
REPO_URL,
BUILD,
DB_PATH,
TMP_DIR,
PREPARE,
always_clean=True,
run_option="eod",
start_date=START_DATE,
module_dependencies=dependencies,
)
runner.run()... | def run_process():
runner = BenchmarkRunner(
benchmarks,
REPO_PATH,
REPO_URL,
BUILD,
DB_PATH,
TMP_DIR,
PREPARE,
run_option="eod",
start_date=START_DATE,
module_dependencies=dependencies,
)
runner.run()
| https://github.com/pandas-dev/pandas/issues/1328 | In [17]: date_range(datetime.datetime.today(), periods=10, freq='2h20m')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/chang/Dropbox/git/pandas/<ipython-input-17-ff4e03382573> in <module>()
----> 1 date_range... | ValueError |
def __new__(
cls, data=None, freq=None, start=None, end=None, periods=None, copy=False, name=None
):
if isinstance(freq, Period):
freq = freq.freq
else:
freq = _freq_mod.get_standard_freq(freq)
if data is None:
subarr, freq = _get_ordinal_range(start, end, periods, freq)
... | def __new__(
cls, data=None, freq=None, start=None, end=None, periods=None, copy=False, name=None
):
if isinstance(freq, Period):
freq = freq.freq
else:
freq = _freq_mod.get_standard_freq(freq)
if data is None:
subarr, freq = _get_ordinal_range(start, end, periods, freq)
... | https://github.com/pandas-dev/pandas/issues/1118 | In [10]: PeriodIndex(val, periods=20)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/Users/wesm/code/pandas/<ipython-input-10-e39b42220b85> in <module>()
----> 1 PeriodIndex(val, periods=20)
/Users/wesm/code/panda... | ValueError |
def __new__(
cls, data=None, freq=None, start=None, end=None, periods=None, copy=False, name=None
):
if isinstance(freq, Period):
freq = freq.freq
else:
freq = _freq_mod.get_standard_freq(freq)
if data is None:
subarr, freq = _get_ordinal_range(start, end, periods, freq)
... | def __new__(
cls, data=None, freq=None, start=None, end=None, periods=None, copy=False, name=None
):
if isinstance(freq, Period):
freq = freq.freq
else:
freq = _freq_mod.get_standard_freq(freq)
if data is None:
subarr, freq = _get_ordinal_range(start, end, periods, freq)
... | https://github.com/pandas-dev/pandas/issues/1118 | In [10]: PeriodIndex(val, periods=20)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/Users/wesm/code/pandas/<ipython-input-10-e39b42220b85> in <module>()
----> 1 PeriodIndex(val, periods=20)
/Users/wesm/code/panda... | ValueError |
def __new__(
cls,
data=None,
freq=None,
start=None,
end=None,
periods=None,
dtype=None,
copy=False,
name=None,
tz=None,
verify_integrity=True,
normalize=False,
**kwds,
):
warn = False
if "offset" in kwds and kwds["offset"]:
freq = kwds["offset"]
... | def __new__(
cls,
data=None,
freq=None,
start=None,
end=None,
periods=None,
dtype=None,
copy=False,
name=None,
tz=None,
verify_integrity=True,
normalize=False,
**kwds,
):
warn = False
if "offset" in kwds and kwds["offset"]:
freq = kwds["offset"]
... | https://github.com/pandas-dev/pandas/issues/1095 | ======================================================================
ERROR: test_shift_multiple_of_same_base (__main__.TestLegacySupport)
----------------------------------------------------------------------
Traceback (most recent call last):
File "pandas/tests/test_timeseries.py", line 624, in test_shift_multiple_o... | AttributeError |
def generate_range(start=None, end=None, periods=None, offset=BDay(), time_rule=None):
"""
Generates a sequence of dates corresponding to the specified time
offset. Similar to dateutil.rrule except uses pandas DateOffset
objects to represent time increments
Parameters
----------
start : dat... | def generate_range(start=None, end=None, periods=None, offset=BDay(), time_rule=None):
"""
Generates a sequence of dates corresponding to the specified time
offset. Similar to dateutil.rrule except uses pandas DateOffset
objects to represent time increments
Parameters
----------
start : dat... | https://github.com/pandas-dev/pandas/issues/1095 | ======================================================================
ERROR: test_shift_multiple_of_same_base (__main__.TestLegacySupport)
----------------------------------------------------------------------
Traceback (most recent call last):
File "pandas/tests/test_timeseries.py", line 624, in test_shift_multiple_o... | AttributeError |
def _get_handle(path, mode, encoding=None):
if py3compat.PY3: # pragma: no cover
if encoding:
f = open(path, mode, encoding=encoding)
else:
f = open(path, mode, errors="replace")
else:
f = open(path, mode)
return f
| def _get_handle(path, mode, encoding=None):
if py3compat.PY3: # pragma: no cover
f = open(path, mode, encoding=encoding)
else:
f = open(path, mode)
return f
| https://github.com/pandas-dev/pandas/issues/795 | In [9]: df = read_clipboard(header=None, sep='\s+')
In [10]: df
Out[10]: ---------------------------------------------------------------------------
UnicodeDecodeError Traceback (most recent call last)
/Users/wesm/<ipython-input-10-7ed0097d7e9e> in <module>()
----> 1 df
/Users/wesm/code/repos/i... | UnicodeDecodeError |
def _getitem_lowerdim(self, tup):
from pandas.core.frame import DataFrame
ax0 = self.obj._get_axis(0)
# a bit kludgy
if isinstance(ax0, MultiIndex):
try:
return self._get_label(tup, axis=0)
except TypeError:
# slices are unhashable
pass
except... | def _getitem_lowerdim(self, tup):
from pandas.core.frame import DataFrame
ax0 = self.obj._get_axis(0)
# a bit kludgy
if isinstance(ax0, MultiIndex):
try:
return self._get_label(tup, axis=0)
except TypeError:
# slices are unhashable
pass
except... | https://github.com/pandas-dev/pandas/issues/709 | In [20]: df
Out[20]:
value
id
t1 a 1
b 2
c 3
t2 a 7
b 8
In [21]: df.ix[:, 'value']
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/home/wesm/Dropbox/book/svn/<ipython-input-21-7d089958dc90> in <module>()
... | TypeError |
def __init__(self, f, dialect=csv.excel, encoding="utf-8", **kwds):
f = UTF8Recoder(f, encoding)
self.reader = csv.reader(f, dialect=dialect, **kwds)
| def __init__(self, seq, key=lambda x: x):
for value in seq:
k = key(value)
self.setdefault(k, []).append(value)
| https://github.com/pandas-dev/pandas/issues/709 | In [20]: df
Out[20]:
value
id
t1 a 1
b 2
c 3
t2 a 7
b 8
In [21]: df.ix[:, 'value']
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/home/wesm/Dropbox/book/svn/<ipython-input-21-7d089958dc90> in <module>()
... | TypeError |
def _convert_to_indexer(self, obj, axis=0):
"""
Convert indexing key into something we can use to do actual fancy
indexing on an ndarray
Examples
ix[:5] -> slice(0, 5)
ix[[1,2,3]] -> [1,2,3]
ix[['foo', 'bar', 'baz']] -> [i, j, k] (indices of foo, bar, baz)
Going by Zen of Python?
"... | def _convert_to_indexer(self, obj, axis=0):
"""
Convert indexing key into something we can use to do actual fancy
indexing on an ndarray
Examples
ix[:5] -> slice(0, 5)
ix[[1,2,3]] -> [1,2,3]
ix[['foo', 'bar', 'baz']] -> [i, j, k] (indices of foo, bar, baz)
Going by Zen of Python?
"... | https://github.com/pandas-dev/pandas/issues/709 | In [20]: df
Out[20]:
value
id
t1 a 1
b 2
c 3
t2 a 7
b 8
In [21]: df.ix[:, 'value']
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/home/wesm/Dropbox/book/svn/<ipython-input-21-7d089958dc90> in <module>()
... | TypeError |
def unique(self):
"""
Return array of unique values in the Series. Significantly faster than
numpy.unique
Returns
-------
uniques : ndarray
"""
values = self.values
if issubclass(values.dtype.type, np.floating):
table = lib.Float64HashTable(len(values))
uniques = np.... | def unique(self):
"""
Return array of unique values in the Series. Significantly faster than
numpy.unique
Returns
-------
uniques : ndarray
"""
values = self.values
if not values.dtype == np.object_:
values = values.astype("O")
table = lib.PyObjectHashTable(len(values))
... | https://github.com/pandas-dev/pandas/issues/709 | In [20]: df
Out[20]:
value
id
t1 a 1
b 2
c 3
t2 a 7
b 8
In [21]: df.ix[:, 'value']
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/home/wesm/Dropbox/book/svn/<ipython-input-21-7d089958dc90> in <module>()
... | TypeError |
def from_csv(
cls, path, sep=",", parse_dates=True, header=None, index_col=0, encoding=None
):
"""
Read delimited file into Series
Parameters
----------
path : string
sep : string, default ','
Field delimiter
parse_dates : boolean, default True
Parse dates. Different def... | def from_csv(cls, path, sep=",", parse_dates=True):
"""
Read delimited file into Series
Parameters
----------
path : string
sep : string, default ','
Field delimiter
parse_dates : boolean, default True
Parse dates. Different default from read_table
Returns
-------
... | https://github.com/pandas-dev/pandas/issues/709 | In [20]: df
Out[20]:
value
id
t1 a 1
b 2
c 3
t2 a 7
b 8
In [21]: df.ix[:, 'value']
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/home/wesm/Dropbox/book/svn/<ipython-input-21-7d089958dc90> in <module>()
... | TypeError |
def to_csv(
self,
path,
index=True,
sep=",",
na_rep="",
header=False,
index_label=None,
mode="w",
nanRep=None,
encoding=None,
):
"""
Write Series to a comma-separated values (csv) file
Parameters
----------
path : string
File path
nanRep : string,... | def to_csv(self, path, index=True):
"""
Write the Series to a CSV file
Parameters
----------
path : string or None
Output filepath. If None, write to stdout
index : bool, optional
Include the index as row names or not
"""
f = open(path, "w")
csvout = csv.writer(f, li... | https://github.com/pandas-dev/pandas/issues/709 | In [20]: df
Out[20]:
value
id
t1 a 1
b 2
c 3
t2 a 7
b 8
In [21]: df.ix[:, 'value']
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/home/wesm/Dropbox/book/svn/<ipython-input-21-7d089958dc90> in <module>()
... | TypeError |
def _convert_to_indexer(self, obj, axis=0):
"""
Convert indexing key into something we can use to do actual fancy
indexing on an ndarray
Examples
ix[:5] -> slice(0, 5)
ix[[1,2,3]] -> [1,2,3]
ix[['foo', 'bar', 'baz']] -> [i, j, k] (indices of foo, bar, baz)
Going by Zen of Python?
"... | def _convert_to_indexer(self, obj, axis=0):
"""
Convert indexing key into something we can use to do actual fancy
indexing on an ndarray
Examples
ix[:5] -> slice(0, 5)
ix[[1,2,3]] -> [1,2,3]
ix[['foo', 'bar', 'baz']] -> [i, j, k] (indices of foo, bar, baz)
Going by Zen of Python?
"... | https://github.com/pandas-dev/pandas/issues/551 | Hi, I am currently trying to access and change elements of a multiindexed DataFrame with .ix. This works on read but not on write:
In [342]: arrays = [['bar', 'bar', 'baz', 'baz', 'foo', 'foo', 'qux', 'qux'],['one', 'two', 'one', 'two', 'one', 'two', 'one', 'two']]
In [343]: tuples = zip(*arrays)
In [344]: index = M... | KeyError |
def unstack(self, level=-1):
"""
"Unstack" level from MultiLevel index to produce reshaped DataFrame
Parameters
----------
level : int, string, or list of these, default last level
Level(s) to unstack, can pass level name
Examples
--------
>>> s
one a 1.
one b 2.
... | def unstack(self, level=-1):
"""
"Unstack" level from MultiLevel index to produce reshaped DataFrame
Parameters
----------
level : int, string, or list of these, default last level
Level(s) to unstack, can pass level name
Examples
--------
>>> s
one a 1.
one b 2.
... | https://github.com/pandas-dev/pandas/issues/451 | In [180]: df.unstack(level=[0,1])
Out[180]:
A A B B
bar foo bar foo
a b a b a b a b
0 266.666m 806.406m -1.627 -494.049m 246.100m 894.707m 1.301 120.3... | IndexError |
def set_index(self, col_or_cols, drop=True, inplace=False):
"""
Set the DataFrame index (row labels) using one or more existing
columns. By default yields a new object.
Parameters
----------
col_or_cols : column label or list of column labels
drop : boolean, default True
Delete colu... | def set_index(self, col_or_cols, drop=True, inplace=False):
"""
Set the DataFrame index (row labels) using one or more existing
columns. By default yields a new object.
Parameters
----------
col_or_cols : column label or list of column labels
drop : boolean, default True
Delete colu... | https://github.com/pandas-dev/pandas/issues/366 | df.as_matrix()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pandas/core/frame.py", line 671, in as_matrix
self._consolidate_inplace()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/... | AssertionError |
def unique_with_labels(values):
uniques = Index(lib.fast_unique(values))
labels = lib.get_unique_labels(values, uniques.indexMap)
uniques._cleanup()
return uniques, labels
| def unique_with_labels(values):
uniques = Index(lib.fast_unique(values))
labels = lib.get_unique_labels(values, uniques.indexMap)
return uniques, labels
| https://github.com/pandas-dev/pandas/issues/366 | df.as_matrix()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pandas/core/frame.py", line 671, in as_matrix
self._consolidate_inplace()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/... | AssertionError |
def from_blocks(cls, blocks, index):
# also checks for overlap
items = _union_block_items(blocks)
return BlockManager(blocks, [items, index])
| def from_blocks(cls, blocks, index):
# also checks for overlap
items = _union_block_items(blocks)
ndim = blocks[0].ndim
return BlockManager(blocks, [items, index])
| https://github.com/pandas-dev/pandas/issues/98 | In [1]: df = DataFrame(index=['a', 'b', 'c'])
In [2]: df.ix['a']
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (2, 0))
---------------------------------------------------------------------------
Inde... | IndexError |
def xs(self, key, axis=1, copy=True):
assert axis >= 1
i = self.axes[axis].get_loc(key)
slicer = [slice(None, None) for _ in range(self.ndim)]
slicer[axis] = i
slicer = tuple(slicer)
new_axes = list(self.axes)
new_axes.pop(axis)
new_blocks = []
if len(self.blocks) > 1:
if ... | def xs(self, key, axis=1, copy=True):
from pandas.core.series import Series
assert axis >= 1
i = self.axes[axis].get_loc(key)
slicer = [slice(None, None) for _ in range(self.ndim)]
slicer[axis] = i
slicer = tuple(slicer)
new_axes = list(self.axes)
new_axes.pop(axis)
if len(self.b... | https://github.com/pandas-dev/pandas/issues/98 | In [1]: df = DataFrame(index=['a', 'b', 'c'])
In [2]: df.ix['a']
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (2, 0))
---------------------------------------------------------------------------
Inde... | IndexError |
def sort(
graph: Mapping[K, DepGraphEntry[K, V, T]],
*,
allow_unresolved: bool = False,
) -> Tuple[V, ...]:
items = sort_ex(graph, allow_unresolved=allow_unresolved)
return tuple(i[1].item for i in items)
| def sort(
graph: Mapping[K, DepGraphEntry[K, V, T]],
*,
allow_unresolved: bool = False,
) -> Iterator[V]:
items = sort_ex(graph, allow_unresolved=allow_unresolved)
return (i[1].item for i in items)
| https://github.com/edgedb/edgedb/issues/2002 | ERROR: InternalServerError: 'UnionType' object has no attribute 'get_name'
Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
Server traceback:
Traceback (most recent call last):
File "/usr/lib/x86_64-linux-gnu/edgedb-... | AttributeError |
def derive_view(
stype: s_types.Type,
*,
derived_name: Optional[sn.QualName] = None,
derived_name_quals: Optional[Sequence[str]] = (),
derived_name_base: Optional[str] = None,
preserve_shape: bool = False,
preserve_path_id: bool = False,
is_insert: bool = False,
is_update: bool = Fal... | def derive_view(
stype: s_types.Type,
*,
derived_name: Optional[sn.QualName] = None,
derived_name_quals: Optional[Sequence[str]] = (),
derived_name_base: Optional[str] = None,
preserve_shape: bool = False,
preserve_path_id: bool = False,
is_insert: bool = False,
is_update: bool = Fal... | https://github.com/edgedb/edgedb/issues/2002 | ERROR: InternalServerError: 'UnionType' object has no attribute 'get_name'
Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
Server traceback:
Traceback (most recent call last):
File "/usr/lib/x86_64-linux-gnu/edgedb-... | AttributeError |
def get_name(self, schema: s_schema.Schema) -> sn.QualName:
component_ids = sorted(str(t.get_name(schema)) for t in self.types)
nqname = f"({' | '.join(component_ids)})"
return sn.QualName(name=nqname, module="__derived__")
| def get_name(self, schema: s_schema.Schema) -> sn.QualName:
return self.name
| https://github.com/edgedb/edgedb/issues/2002 | ERROR: InternalServerError: 'UnionType' object has no attribute 'get_name'
Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
Server traceback:
Traceback (most recent call last):
File "/usr/lib/x86_64-linux-gnu/edgedb-... | AttributeError |
def get(self, name: str, *, dummy: bool = False) -> GQLBaseType:
"""Get a special GQL type either by name or based on EdgeDB type."""
# normalize name and possibly add 'edb_base' to kwargs
edb_base = None
kwargs: Dict[str, Any] = {"dummy": dummy}
if not name.startswith("stdgraphql::"):
if e... | def get(self, name: str, *, dummy: bool = False) -> GQLBaseType:
"""Get a special GQL type either by name or based on EdgeDB type."""
# normalize name and possibly add 'edb_base' to kwargs
edb_base = None
kwargs: Dict[str, Any] = {"dummy": dummy}
if not name.startswith("stdgraphql::"):
if e... | https://github.com/edgedb/edgedb/issues/2002 | ERROR: InternalServerError: 'UnionType' object has no attribute 'get_name'
Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
Server traceback:
Traceback (most recent call last):
File "/usr/lib/x86_64-linux-gnu/edgedb-... | AttributeError |
def _alter_pointer_type(self, pointer, schema, orig_schema, context):
old_ptr_stor_info = types.get_pointer_storage_info(pointer, schema=orig_schema)
new_target = pointer.get_target(schema)
ptr_table = old_ptr_stor_info.table_type == "link"
is_link = isinstance(pointer, s_links.Link)
is_lprop = poi... | def _alter_pointer_type(self, pointer, schema, orig_schema, context):
old_ptr_stor_info = types.get_pointer_storage_info(pointer, schema=orig_schema)
new_target = pointer.get_target(schema)
ptr_table = old_ptr_stor_info.table_type == "link"
is_link = isinstance(pointer, s_links.Link)
is_lprop = poi... | https://github.com/edgedb/edgedb/issues/2002 | ERROR: InternalServerError: 'UnionType' object has no attribute 'get_name'
Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
Server traceback:
Traceback (most recent call last):
File "/usr/lib/x86_64-linux-gnu/edgedb-... | AttributeError |
def _canonicalize(
self,
schema: s_schema.Schema,
context: sd.CommandContext,
scls: so.Object,
) -> None:
super()._canonicalize(schema, context, scls)
assert isinstance(scls, Annotation)
# AnnotationValues have names derived from the abstract
# annotations. We unfortunately need to go u... | def _canonicalize(
self,
schema: s_schema.Schema,
context: sd.CommandContext,
scls: so.Object,
) -> List[sd.Command]:
assert isinstance(scls, Annotation)
commands = list(super()._canonicalize(schema, context, scls))
# AnnotationValues have names derived from the abstract
# annotations. ... | https://github.com/edgedb/edgedb/issues/2002 | ERROR: InternalServerError: 'UnionType' object has no attribute 'get_name'
Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
Server traceback:
Traceback (most recent call last):
File "/usr/lib/x86_64-linux-gnu/edgedb-... | AttributeError |
def populate_ddl_identity(
self,
schema: s_schema.Schema,
context: sd.CommandContext,
) -> s_schema.Schema:
schema = super().populate_ddl_identity(schema, context)
if not isinstance(self, sd.CreateObject):
anno = self.scls.get_annotation(schema)
else:
annoname = sn.shortname_from... | def populate_ddl_identity(
self,
schema: s_schema.Schema,
context: sd.CommandContext,
) -> s_schema.Schema:
schema = super().populate_ddl_identity(schema, context)
annoname = sn.shortname_from_fullname(self.classname)
anno = schema.get(annoname, type=Annotation)
self.set_ddl_identity("annota... | https://github.com/edgedb/edgedb/issues/2002 | ERROR: InternalServerError: 'UnionType' object has no attribute 'get_name'
Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
Server traceback:
Traceback (most recent call last):
File "/usr/lib/x86_64-linux-gnu/edgedb-... | AttributeError |
def as_delete_delta(
self,
*,
schema: s_schema.Schema,
context: so.ComparisonContext,
) -> sd.ObjectCommand[Constraint]:
return super().as_delete_delta(schema=schema, context=context)
| def as_delete_delta(
self,
*,
schema: s_schema.Schema,
context: so.ComparisonContext,
) -> sd.ObjectCommand[Constraint]:
return super().as_delete_delta(
schema=schema,
context=context,
)
| https://github.com/edgedb/edgedb/issues/2002 | ERROR: InternalServerError: 'UnionType' object has no attribute 'get_name'
Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
Server traceback:
Traceback (most recent call last):
File "/usr/lib/x86_64-linux-gnu/edgedb-... | AttributeError |
def _canonicalize(
self,
schema: s_schema.Schema,
context: sd.CommandContext,
scls: so.Object,
) -> None:
super()._canonicalize(schema, context, scls)
assert isinstance(scls, Constraint)
# Don't do anything for concrete constraints
if not scls.get_abstract(schema):
return
#... | def _canonicalize(
self,
schema: s_schema.Schema,
context: sd.CommandContext,
scls: so.Object,
) -> List[sd.Command]:
assert isinstance(scls, Constraint)
commands = list(super()._canonicalize(schema, context, scls))
# Don't do anything for concrete constraints
if not scls.get_abstract(s... | https://github.com/edgedb/edgedb/issues/2002 | ERROR: InternalServerError: 'UnionType' object has no attribute 'get_name'
Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
Server traceback:
Traceback (most recent call last):
File "/usr/lib/x86_64-linux-gnu/edgedb-... | AttributeError |
def _canonicalize(
self,
schema: s_schema.Schema,
context: CommandContext,
scls: so.Object,
) -> None:
mcls = self.get_schema_metaclass()
for refdict in mcls.get_refdicts():
all_refs = set(scls.get_field_value(schema, refdict.attr).objects(schema))
ref: so.Object
for re... | def _canonicalize(
self,
schema: s_schema.Schema,
context: CommandContext,
scls: so.Object,
) -> Sequence[Command]:
mcls = self.get_schema_metaclass()
commands = []
for refdict in mcls.get_refdicts():
all_refs = set(scls.get_field_value(schema, refdict.attr).objects(schema))
... | https://github.com/edgedb/edgedb/issues/2002 | ERROR: InternalServerError: 'UnionType' object has no attribute 'get_name'
Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
Server traceback:
Traceback (most recent call last):
File "/usr/lib/x86_64-linux-gnu/edgedb-... | AttributeError |
def apply(
self,
schema: s_schema.Schema,
context: CommandContext,
) -> s_schema.Schema:
if self.if_exists:
scls = self.get_object(schema, context, default=None)
if scls is None:
context.current().op.discard(self)
return schema
else:
scls = self.get_ob... | def apply(
self,
schema: s_schema.Schema,
context: CommandContext,
) -> s_schema.Schema:
if self.if_exists:
scls = self.get_object(schema, context, default=None)
if scls is None:
context.current().op.discard(self)
return schema
else:
scls = self.get_ob... | https://github.com/edgedb/edgedb/issues/2002 | ERROR: InternalServerError: 'UnionType' object has no attribute 'get_name'
Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
Server traceback:
Traceback (most recent call last):
File "/usr/lib/x86_64-linux-gnu/edgedb-... | AttributeError |
def validate_alter(
self,
schema: s_schema.Schema,
context: CommandContext,
) -> None:
self._validate_legal_command(schema, context)
| def validate_alter(
self,
schema: s_schema.Schema,
context: CommandContext,
) -> None:
pass
| https://github.com/edgedb/edgedb/issues/2002 | ERROR: InternalServerError: 'UnionType' object has no attribute 'get_name'
Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
Server traceback:
Traceback (most recent call last):
File "/usr/lib/x86_64-linux-gnu/edgedb-... | AttributeError |
def _alter_begin(
self,
schema: s_schema.Schema,
context: CommandContext,
) -> s_schema.Schema:
scls = self.scls
context.renames[self.classname] = self.new_name
context.renamed_objs.add(scls)
vn = scls.get_verbosename(schema)
schema = self._propagate_if_expr_refs(
schema,
... | def _alter_begin(
self,
schema: s_schema.Schema,
context: CommandContext,
) -> s_schema.Schema:
self._validate_legal_command(schema, context)
for op in self.get_prerequisites():
schema = op.apply(schema, context)
if not context.canonical:
schema = self.populate_ddl_identity(sch... | https://github.com/edgedb/edgedb/issues/2002 | ERROR: InternalServerError: 'UnionType' object has no attribute 'get_name'
Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
Server traceback:
Traceback (most recent call last):
File "/usr/lib/x86_64-linux-gnu/edgedb-... | AttributeError |
def _alter_innards(
self,
schema: s_schema.Schema,
context: CommandContext,
) -> s_schema.Schema:
if not context.canonical:
self._canonicalize(schema, context, self.scls)
return super()._alter_innards(schema, context)
| def _alter_innards(
self,
schema: s_schema.Schema,
context: CommandContext,
) -> s_schema.Schema:
for op in self.get_subcommands(include_prerequisites=False):
if not isinstance(op, AlterObjectProperty):
schema = op.apply(schema, context=context)
return schema
| https://github.com/edgedb/edgedb/issues/2002 | ERROR: InternalServerError: 'UnionType' object has no attribute 'get_name'
Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
Server traceback:
Traceback (most recent call last):
File "/usr/lib/x86_64-linux-gnu/edgedb-... | AttributeError |
def _alter_finalize(
self,
schema: s_schema.Schema,
context: CommandContext,
) -> s_schema.Schema:
return self._finalize_affected_refs(schema, context)
| def _alter_finalize(
self,
schema: s_schema.Schema,
context: CommandContext,
) -> s_schema.Schema:
schema = self._finalize_affected_refs(schema, context)
return schema
| https://github.com/edgedb/edgedb/issues/2002 | ERROR: InternalServerError: 'UnionType' object has no attribute 'get_name'
Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
Server traceback:
Traceback (most recent call last):
File "/usr/lib/x86_64-linux-gnu/edgedb-... | AttributeError |
def get_expr_referrers(
schema: s_schema.Schema, obj: so.Object
) -> Dict[so.Object, List[str]]:
"""Return schema referrers with refs in expressions."""
refs: Dict[Tuple[Type[so.Object], str], FrozenSet[so.Object]] = (
schema.get_referrers_ex(obj)
)
result: Dict[so.Object, List[str]] = {}
... | def get_expr_referrers(
schema: s_schema.Schema, obj: so.Object
) -> Dict[so.Object, List[str]]:
"""Return schema referrers with refs in expressions."""
refs = schema.get_referrers_ex(obj)
result: Dict[so.Object, List[str]] = {}
for (mcls, fn), referrers in refs.items():
field = mcls.get_f... | https://github.com/edgedb/edgedb/issues/2002 | ERROR: InternalServerError: 'UnionType' object has no attribute 'get_name'
Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
Server traceback:
Traceback (most recent call last):
File "/usr/lib/x86_64-linux-gnu/edgedb-... | AttributeError |
def _handle_alias_op(
self,
expr: s_expr.Expression,
classname: sn.QualName,
schema: s_schema.Schema,
context: sd.CommandContext,
is_alter: bool = False,
) -> Tuple[sd.Command, sd.ObjectCommand[Alias]]:
from . import ordering as s_ordering
ir = self._compile_alias_expr(expr.qlast, class... | def _handle_alias_op(
self,
expr: s_expr.Expression,
classname: sn.QualName,
schema: s_schema.Schema,
context: sd.CommandContext,
is_alter: bool = False,
) -> Tuple[sd.Command, sd.ObjectCommand[Alias]]:
from . import ordering as s_ordering
ir = self._compile_alias_expr(expr.qlast, class... | https://github.com/edgedb/edgedb/issues/2002 | ERROR: InternalServerError: 'UnionType' object has no attribute 'get_name'
Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
Server traceback:
Traceback (most recent call last):
File "/usr/lib/x86_64-linux-gnu/edgedb-... | AttributeError |
def _canonicalize(
self,
schema: s_schema.Schema,
context: sd.CommandContext,
scls: so.Object,
) -> None:
super()._canonicalize(schema, context, scls)
assert isinstance(scls, CallableObject)
# Don't do anything for concrete constraints
if not isinstance(scls, Function) and not scls.get_... | def _canonicalize(
self,
schema: s_schema.Schema,
context: sd.CommandContext,
scls: so.Object,
) -> List[sd.Command]:
assert isinstance(scls, CallableObject)
commands = list(super()._canonicalize(schema, context, scls))
# Don't do anything for concrete constraints
if not isinstance(scls... | https://github.com/edgedb/edgedb/issues/2002 | ERROR: InternalServerError: 'UnionType' object has no attribute 'get_name'
Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
Server traceback:
Traceback (most recent call last):
File "/usr/lib/x86_64-linux-gnu/edgedb-... | AttributeError |
def _prepare_id(
cls,
schema: s_schema.Schema,
data: Dict[str, Any],
) -> uuid.UUID:
name = data.get("name")
assert isinstance(name, (str, sn.Name))
try:
return get_known_type_id(name)
except errors.SchemaError:
return cls.generate_id(schema, data)
| def _prepare_id(cls, id: Optional[uuid.UUID], data: Dict[str, Any]) -> uuid.UUID:
if id is not None:
return id
name = data.get("name")
assert isinstance(name, (str, sn.Name))
try:
return get_known_type_id(name)
except errors.SchemaError:
return uuidgen.uuid1mc()
| https://github.com/edgedb/edgedb/issues/2002 | ERROR: InternalServerError: 'UnionType' object has no attribute 'get_name'
Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
Server traceback:
Traceback (most recent call last):
File "/usr/lib/x86_64-linux-gnu/edgedb-... | AttributeError |
def create_in_schema(
cls: Type[Object_T],
schema: s_schema.Schema,
*,
id: Optional[uuid.UUID] = None,
**data: Any,
) -> Tuple[s_schema.Schema, Object_T]:
if not cls.is_schema_object:
raise TypeError(f"{cls.__name__} type cannot be created in schema")
if not data.get("name"):
... | def create_in_schema(
cls: Type[Object_T],
schema: s_schema.Schema,
*,
id: Optional[uuid.UUID] = None,
**data: Any,
) -> Tuple[s_schema.Schema, Object_T]:
if not cls.is_schema_object:
raise TypeError(f"{cls.__name__} type cannot be created in schema")
if not data.get("name"):
... | https://github.com/edgedb/edgedb/issues/2002 | ERROR: InternalServerError: 'UnionType' object has no attribute 'get_name'
Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
Server traceback:
Traceback (most recent call last):
File "/usr/lib/x86_64-linux-gnu/edgedb-... | AttributeError |
def init_delta_command(
self: Object_T,
schema: s_schema.Schema,
cmdtype: Type[sd.ObjectCommand_T],
*,
classname: Optional[sn.Name] = None,
**kwargs: Any,
) -> sd.ObjectCommand_T:
from . import delta as sd
cls = type(self)
cmd = sd.get_object_delta_command(
objtype=cls,
... | def init_delta_command(
self: Object_T,
schema: s_schema.Schema,
cmdtype: Type[sd.ObjectCommand_T],
*,
classname: Optional[sn.Name] = None,
**kwargs: Any,
) -> sd.ObjectCommand_T:
from . import delta as sd
cls = type(self)
cmd = sd.get_object_delta_command(
objtype=cls,
... | https://github.com/edgedb/edgedb/issues/2002 | ERROR: InternalServerError: 'UnionType' object has no attribute 'get_name'
Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
Server traceback:
Traceback (most recent call last):
File "/usr/lib/x86_64-linux-gnu/edgedb-... | AttributeError |
def as_create_delta(
self: Object_T,
schema: s_schema.Schema,
context: ComparisonContext,
) -> sd.ObjectCommand[Object_T]:
from . import delta as sd
cls = type(self)
delta = self.init_delta_command(
schema,
sd.CreateObject,
canonical=True,
)
if context.generate_... | def as_create_delta(
self: Object_T,
schema: s_schema.Schema,
context: ComparisonContext,
) -> sd.ObjectCommand[Object_T]:
from . import delta as sd
cls = type(self)
delta = self.init_delta_command(
schema,
sd.CreateObject,
canonical=True,
)
if context.generate_... | https://github.com/edgedb/edgedb/issues/2002 | ERROR: InternalServerError: 'UnionType' object has no attribute 'get_name'
Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
Server traceback:
Traceback (most recent call last):
File "/usr/lib/x86_64-linux-gnu/edgedb-... | AttributeError |
def compare_values(
cls,
ours: ObjectCollection[Object_T],
theirs: ObjectCollection[Object_T],
*,
our_schema: s_schema.Schema,
their_schema: s_schema.Schema,
context: ComparisonContext,
compcoef: float,
) -> float:
if ours is not None:
our_names = cls._container(
... | def compare_values(
cls,
ours: ObjectCollection[Object_T],
theirs: ObjectCollection[Object_T],
*,
our_schema: s_schema.Schema,
their_schema: s_schema.Schema,
context: ComparisonContext,
compcoef: float,
) -> float:
if ours is not None:
our_names = tuple(
context.g... | https://github.com/edgedb/edgedb/issues/2002 | ERROR: InternalServerError: 'UnionType' object has no attribute 'get_name'
Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
Server traceback:
Traceback (most recent call last):
File "/usr/lib/x86_64-linux-gnu/edgedb-... | AttributeError |
def get_or_create_union_type(
schema: s_schema.Schema,
components: Iterable[ObjectType],
*,
opaque: bool = False,
module: Optional[str] = None,
) -> Tuple[s_schema.Schema, ObjectType, bool]:
name = s_types.get_union_type_name(
(c.get_name(schema) for c in components),
opaque=opaq... | def get_or_create_union_type(
schema: s_schema.Schema,
components: Iterable[ObjectType],
*,
opaque: bool = False,
module: Optional[str] = None,
) -> Tuple[s_schema.Schema, ObjectType, bool]:
type_id, name = s_types.get_union_type_id(
schema,
components,
opaque=opaque,
... | https://github.com/edgedb/edgedb/issues/2002 | ERROR: InternalServerError: 'UnionType' object has no attribute 'get_name'
Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
Server traceback:
Traceback (most recent call last):
File "/usr/lib/x86_64-linux-gnu/edgedb-... | AttributeError |
def get_or_create_intersection_type(
schema: s_schema.Schema,
components: Iterable[ObjectType],
*,
module: Optional[str] = None,
) -> Tuple[s_schema.Schema, ObjectType, bool]:
name = s_types.get_intersection_type_name(
(c.get_name(schema) for c in components),
module=module,
)
... | def get_or_create_intersection_type(
schema: s_schema.Schema,
components: Iterable[ObjectType],
*,
module: Optional[str] = None,
) -> Tuple[s_schema.Schema, ObjectType, bool]:
type_id, name = s_types.get_intersection_type_id(
schema,
components,
module=module,
)
objt... | https://github.com/edgedb/edgedb/issues/2002 | ERROR: InternalServerError: 'UnionType' object has no attribute 'get_name'
Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
Server traceback:
Traceback (most recent call last):
File "/usr/lib/x86_64-linux-gnu/edgedb-... | AttributeError |
def _trace_op(
op: sd.Command,
opbranch: List[sd.Command],
depgraph: DepGraph,
renames: Dict[sn.Name, sn.Name],
renames_r: Dict[sn.Name, sn.Name],
strongrefs: Dict[sn.Name, sn.Name],
old_schema: Optional[s_schema.Schema],
new_schema: s_schema.Schema,
) -> None:
def get_deps(key: DepG... | def _trace_op(
op: sd.Command,
opbranch: List[sd.Command],
depgraph: DepGraph,
renames: Dict[sn.Name, sn.Name],
renames_r: Dict[sn.Name, sn.Name],
strongrefs: Dict[sn.Name, sn.Name],
old_schema: Optional[s_schema.Schema],
new_schema: s_schema.Schema,
) -> None:
def get_deps(key: DepG... | https://github.com/edgedb/edgedb/issues/2002 | ERROR: InternalServerError: 'UnionType' object has no attribute 'get_name'
Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
Server traceback:
Traceback (most recent call last):
File "/usr/lib/x86_64-linux-gnu/edgedb-... | AttributeError |
def get_object(
schema: s_schema.Schema,
op: sd.ObjectCommand[so.Object],
name: Optional[sn.Name] = None,
) -> so.Object:
metaclass = op.get_schema_metaclass()
if name is None:
name = op.classname
if issubclass(metaclass, s_types.Collection):
if isinstance(name, sn.QualName):
... | def get_object(
schema: s_schema.Schema,
op: sd.ObjectCommand[so.Object],
name: Optional[sn.Name] = None,
) -> so.Object:
metaclass = op.get_schema_metaclass()
if name is None:
name = op.classname
if issubclass(metaclass, s_types.Collection):
if isinstance(name, sn.QualName):
... | https://github.com/edgedb/edgedb/issues/2002 | ERROR: InternalServerError: 'UnionType' object has no attribute 'get_name'
Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
Server traceback:
Traceback (most recent call last):
File "/usr/lib/x86_64-linux-gnu/edgedb-... | AttributeError |
def canonicalize_attributes(
self,
schema: s_schema.Schema,
context: sd.CommandContext,
) -> s_schema.Schema:
schema = super().canonicalize_attributes(schema, context)
target_ref = self.get_local_attribute_value("target")
inf_target_ref: Optional[s_types.TypeShell]
# When cardinality/requir... | def canonicalize_attributes(
self,
schema: s_schema.Schema,
context: sd.CommandContext,
) -> s_schema.Schema:
schema = super().canonicalize_attributes(schema, context)
target_ref = self.get_local_attribute_value("target")
inf_target_ref: Optional[s_types.TypeShell]
# When cardinality/requir... | https://github.com/edgedb/edgedb/issues/2002 | ERROR: InternalServerError: 'UnionType' object has no attribute 'get_name'
Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
Server traceback:
Traceback (most recent call last):
File "/usr/lib/x86_64-linux-gnu/edgedb-... | AttributeError |
def _process_create_or_alter_ast(
self,
schema: s_schema.Schema,
astnode: qlast.CreateConcretePointer,
context: sd.CommandContext,
) -> None:
"""Handle the CREATE {PROPERTY|LINK} AST node.
This may be called in the context of either Create or Alter.
"""
if astnode.is_required is not Non... | def _process_create_or_alter_ast(
self,
schema: s_schema.Schema,
astnode: qlast.CreateConcretePointer,
context: sd.CommandContext,
) -> None:
"""Handle the CREATE {PROPERTY|LINK} AST node.
This may be called in the context of either Create or Alter.
"""
if astnode.is_required is not Non... | https://github.com/edgedb/edgedb/issues/2002 | ERROR: InternalServerError: 'UnionType' object has no attribute 'get_name'
Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
Server traceback:
Traceback (most recent call last):
File "/usr/lib/x86_64-linux-gnu/edgedb-... | AttributeError |
def _alter_begin(
self,
schema: s_schema.Schema,
context: sd.CommandContext,
) -> s_schema.Schema:
orig_schema = schema
orig_rec = context.current().enable_recursion
context.current().enable_recursion = False
schema = super()._alter_begin(schema, context)
context.current().enable_recursi... | def _alter_begin(
self,
schema: s_schema.Schema,
context: sd.CommandContext,
) -> s_schema.Schema:
orig_schema = schema
orig_rec = context.current().enable_recursion
context.current().enable_recursion = False
schema = super()._alter_begin(schema, context)
context.current().enable_recursi... | https://github.com/edgedb/edgedb/issues/2002 | ERROR: InternalServerError: 'UnionType' object has no attribute 'get_name'
Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
Server traceback:
Traceback (most recent call last):
File "/usr/lib/x86_64-linux-gnu/edgedb-... | AttributeError |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.