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 _interleave(self, items):
"""
Return ndarray from blocks with specified item order
Items must be contained in the blocks
"""
dtype = _interleaved_dtype(self.blocks)
items = _ensure_index(items)
result = np.empty(self.shape, dtype=dtype)
itemmask = np.zeros(len(items), dtype=bool)
... | def _interleave(self, items):
"""
Return ndarray from blocks with specified item order
Items must be contained in the blocks
"""
dtype = _interleaved_dtype(self.blocks)
items = _ensure_index(items)
result = np.empty(self.shape, dtype=dtype)
itemmask = np.zeros(len(items), dtype=bool)
... | https://github.com/pandas-dev/pandas/issues/2236 | import pandas as pd
def runNow():
#identify sheet
source = 'C:\Users\jlalonde\Desktop\startup_geno\startupgenome_w_id_xl_20121109.xlsx'
xls_file = pd.ExcelFile(source)
sd = xls_file.parse('Sheet1')
source_u = sd.drop_duplicates(cols = 'id_company', take_last=False)
source_r = source_u[['id_company','id_good','descripti... | Exception |
def _isnull_ndarraylike(obj):
from pandas import Series
values = np.asarray(obj)
if values.dtype.kind in ("O", "S", "U"):
# Working around NumPy ticket 1542
shape = values.shape
if values.dtype.kind in ("S", "U"):
result = np.zeros(values.shape, dtype=bool)
els... | def _isnull_ndarraylike(obj):
from pandas import Series
values = np.asarray(obj)
if values.dtype.kind in ("O", "S", "U"):
# Working around NumPy ticket 1542
shape = values.shape
if values.dtype.kind in ("S", "U"):
result = np.zeros(values.shape, dtype=bool)
els... | https://github.com/pandas-dev/pandas/issues/2146 | import pandas as pd
import numpy as np
print pd.Series(np.array([1100, 20], dtype='timedelta64[s]'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27_64\lib\site-packages\pandas\core\series.py", line 911, in __str__
return repr(self)
File "C:\Python27_64\lib\site-packages\pandas\... | TypeError |
def is_integer_dtype(arr_or_dtype):
if isinstance(arr_or_dtype, np.dtype):
tipo = arr_or_dtype.type
else:
tipo = arr_or_dtype.dtype.type
return issubclass(tipo, np.integer) and not (
issubclass(tipo, np.datetime64) or issubclass(tipo, np.timedelta64)
)
| def is_integer_dtype(arr_or_dtype):
if isinstance(arr_or_dtype, np.dtype):
tipo = arr_or_dtype.type
else:
tipo = arr_or_dtype.dtype.type
return issubclass(tipo, np.integer) and not issubclass(tipo, np.datetime64)
| https://github.com/pandas-dev/pandas/issues/2146 | import pandas as pd
import numpy as np
print pd.Series(np.array([1100, 20], dtype='timedelta64[s]'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27_64\lib\site-packages\pandas\core\series.py", line 911, in __str__
return repr(self)
File "C:\Python27_64\lib\site-packages\pandas\... | TypeError |
def __new__(
cls,
data=None,
freq=None,
start=None,
end=None,
periods=None,
copy=False,
name=None,
tz=None,
verify_integrity=True,
normalize=False,
**kwds,
):
dayfirst = kwds.pop("dayfirst", None)
yearfirst = kwds.pop("yearfirst", None)
warn = False
if "of... | def __new__(
cls,
data=None,
freq=None,
start=None,
end=None,
periods=None,
copy=False,
name=None,
tz=None,
verify_integrity=True,
normalize=False,
**kwds,
):
dayfirst = kwds.pop("dayfirst", None)
yearfirst = kwds.pop("yearfirst", None)
warn = False
if "of... | https://github.com/pandas-dev/pandas/issues/1866 | building [html]: targets for 22 source files that are out of date
updating environment: 218 added, 0 changed, 0 removed
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-767-cc6f0e841b62> in <module>()
1... | TypeError |
def take_2d_multi(arr, row_idx, col_idx, fill_value=np.nan, out=None):
dtype_str = arr.dtype.name
out_shape = len(row_idx), len(col_idx)
if dtype_str in ("int32", "int64", "bool"):
row_mask = row_idx == -1
col_mask = col_idx == -1
needs_masking = row_mask.any() or col_mask.any()
... | def take_2d_multi(arr, row_idx, col_idx, fill_value=np.nan):
dtype_str = arr.dtype.name
out_shape = len(row_idx), len(col_idx)
if dtype_str in ("int32", "int64", "bool"):
row_mask = row_idx == -1
col_mask = col_idx == -1
needs_masking = row_mask.any() or col_mask.any()
if ... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def resample(
self,
rule,
how=None,
axis=0,
fill_method=None,
closed="right",
label="right",
convention=None,
kind=None,
loffset=None,
limit=None,
base=0,
):
"""
Convenience method for frequency conversion and resampling of regular
time-series data.
Param... | def resample(
self,
rule,
how="mean",
axis=0,
fill_method=None,
closed="right",
label="right",
convention=None,
kind=None,
loffset=None,
limit=None,
base=0,
):
"""
Convenience method for frequency conversion and resampling of regular
time-series data.
Par... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
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, 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... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
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, 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... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def get_corr_func(method):
if method in ["kendall", "spearman"]:
from scipy.stats import kendalltau, spearmanr
def _pearson(a, b):
return np.corrcoef(a, b)[0, 1]
def _kendall(a, b):
rs = kendalltau(a, b)
if isinstance(rs, tuple):
return rs[0]
return rs
... | def get_corr_func(method):
if method in ["kendall", "spearman"]:
from scipy.stats import kendalltau, spearmanr
def _pearson(a, b):
return np.corrcoef(a, b)[0, 1]
def _kendall(a, b):
return kendalltau(a, b)[0]
def _spearman(a, b):
return spearmanr(a, b)[0]
_cor_met... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def _kendall(a, b):
rs = kendalltau(a, b)
if isinstance(rs, tuple):
return rs[0]
return rs
| def _kendall(a, b):
return kendalltau(a, b)[0]
| https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def reindex(
self,
major=None,
items=None,
minor=None,
method=None,
major_axis=None,
minor_axis=None,
copy=True,
):
"""
Conform panel to new axis or axes
Parameters
----------
major : Index or sequence, default None
Can also use 'major_axis' keyword
items... | def reindex(
self,
major=None,
items=None,
minor=None,
method=None,
major_axis=None,
minor_axis=None,
copy=True,
):
"""
Conform panel to new axis or axes
Parameters
----------
major : Index or sequence, default None
Can also use 'major_axis' keyword
items... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def block2d_to_block3d(
values, items, shape, major_labels, minor_labels, ref_items=None
):
"""
Developer method for pivoting DataFrame -> Panel. Used in HDFStore and
DataFrame.to_panel
"""
from pandas.core.internals import make_block
panel_shape = (len(items),) + shape
# TODO: lexsort... | def block2d_to_block3d(
values, items, shape, major_labels, minor_labels, ref_items=None
):
"""
Developer method for pivoting DataFrame -> Panel. Used in HDFStore and
DataFrame.to_panel
"""
from pandas.core.internals import make_block
panel_shape = (len(items),) + shape
# TODO: lexsort... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def _insert_column(self, key):
self.columns = self.columns.insert(len(self.columns), key)
| def _insert_column(self, key):
self.columns = Index(np.concatenate((self.columns, [key])))
| https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def __getitem__(self, key):
"""
Retrieve column or slice from DataFrame
"""
try:
# unsure about how kludgy this is
s = self._series[key]
s.name = key
return s
except (TypeError, KeyError):
if isinstance(key, slice):
date_rng = self.index[key]
... | 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]
... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def ewma(
arg, com=None, span=None, min_periods=0, freq=None, time_rule=None, adjust=True
):
com = _get_center_of_mass(com, span)
arg = _conv_timerule(arg, freq, time_rule)
def _ewma(v):
result = lib.ewma(v, com, int(adjust))
first_index = _first_valid_index(v)
result[first_inde... | 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... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def _ewma(v):
result = lib.ewma(v, com, int(adjust))
first_index = _first_valid_index(v)
result[first_index : first_index + min_periods] = NaN
return result
| def _ewma(v):
result = _tseries.ewma(v, com)
first_index = _first_valid_index(v)
result[first_index : first_index + min_periods] = NaN
return result
| https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
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, 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... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def call_cython(arg, window, minp):
minp = _use_window(minp, window)
return lib.roll_quantile(arg, window, minp, quantile)
| def call_cython(arg, window, minp):
minp = _use_window(minp, window)
return _tseries.roll_quantile(arg, window, minp, quantile)
| https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
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, 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... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def call_cython(arg, window, minp):
minp = _use_window(minp, window)
return lib.roll_generic(arg, window, minp, func)
| def call_cython(arg, window, minp):
minp = _use_window(minp, window)
return _tseries.roll_generic(arg, window, minp, func)
| https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
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,
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 : ... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def __init__(
self,
data,
kind=None,
by=None,
subplots=False,
sharex=True,
sharey=False,
use_index=True,
figsize=None,
grid=None,
legend=True,
rot=None,
ax=None,
fig=None,
title=None,
xlim=None,
ylim=None,
xticks=None,
yticks=None,
sort_col... | def __init__(
self,
data,
kind=None,
by=None,
subplots=False,
sharex=True,
sharey=False,
use_index=True,
figsize=None,
grid=None,
legend=True,
rot=None,
ax=None,
fig=None,
title=None,
xlim=None,
ylim=None,
xticks=None,
yticks=None,
sort_col... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def _iter_data(self):
from pandas.core.frame import DataFrame
if isinstance(self.data, (Series, np.ndarray)):
yield self.label, np.asarray(self.data)
elif isinstance(self.data, DataFrame):
df = self.data
if self.sort_columns:
columns = com._try_sort(df.columns)
... | 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... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def _maybe_right_yaxis(self, ax):
_types = (list, tuple, np.ndarray)
sec_true = isinstance(self.secondary_y, bool) and self.secondary_y
list_sec = isinstance(self.secondary_y, _types)
has_sec = list_sec and len(self.secondary_y) > 0
all_sec = list_sec and len(self.secondary_y) == self.nseries
i... | def _maybe_right_yaxis(self, ax):
ypos = ax.get_yaxis().get_ticks_position().strip().lower()
if self.secondary_y and ypos != "right":
orig_ax = ax
ax = ax.twinx()
if len(orig_ax.get_lines()) == 0: # no data on left y
orig_ax.get_yaxis().set_visible(False)
else:
... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def _setup_subplots(self):
if self.subplots:
nrows, ncols = self._get_layout()
if self.ax is None:
fig, axes = _subplots(
nrows=nrows,
ncols=ncols,
sharex=self.sharex,
sharey=self.sharey,
figsize=self.figsize... | def _setup_subplots(self):
if self.subplots:
nrows, ncols = self._get_layout()
if self.ax is None:
fig, axes = _subplots(
nrows=nrows,
ncols=ncols,
sharex=self.sharex,
sharey=self.sharey,
figsize=self.figsize... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def _adorn_subplots(self):
to_adorn = self.axes
# 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(self.xticks)
if self.ylim is not None:
ax.set_... | 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/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def _make_plot(self):
from scipy.stats import gaussian_kde
plotf = self._get_plot_function()
for i, (label, y) in enumerate(self._iter_data()):
ax = self._get_ax(i)
style = self._get_style(i, label)
label = com._stringify(label)
gkde = gaussian_kde(y)
sample_range ... | def _make_plot(self):
from scipy.stats import gaussian_kde
plotf = self._get_plot_function()
for i, (label, y) in enumerate(self._iter_data()):
ax, style = self._get_ax_and_style(i)
if self.style:
style = self.style
gkde = gaussian_kde(y)
sample_range = max(y) -... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def _post_plot_logic(self):
df = self.data
if self.subplots and self.legend:
for ax in self.axes:
ax.legend(loc="best")
| def _post_plot_logic(self):
df = self.data
if self.subplots and self.legend:
self.axes[0].legend(loc="best")
| https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def __init__(self, data, **kwargs):
self.mark_right = kwargs.pop("mark_right", True)
MPLPlot.__init__(self, data, **kwargs)
| def __init__(self, data, **kwargs):
MPLPlot.__init__(self, data, **kwargs)
| https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def _use_dynamic_x(self):
freq = self._index_freq()
ax = self._get_ax(0)
ax_freq = getattr(ax, "freq", None)
if freq is None: # convert irregular if axes has freq info
freq = ax_freq
else: # do not use tsplot if irregular was plotted first
if (ax_freq is None) and (len(ax.get_line... | def _use_dynamic_x(self):
freq = self._index_freq()
ax, _ = self._get_ax_and_style(0)
ax_freq = getattr(ax, "freq", None)
if freq is None: # convert irregular if axes has freq info
freq = ax_freq
else: # do not use tsplot if irregular was plotted first
if (ax_freq is None) and (le... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def _make_plot(self):
# this is slightly deceptive
if self.use_index and self._use_dynamic_x():
data = self._maybe_convert_index(self.data)
self._make_ts_plot(data, **self.kwds)
else:
import matplotlib.pyplot as plt
cycle = "".join(plt.rcParams.get("axes.color_cycle", list("... | def _make_plot(self):
# this is slightly deceptive
if self.use_index and self._use_dynamic_x():
data = self._maybe_convert_index(self.data)
self._make_ts_plot(data)
else:
x = self._get_xticks(convert_period=True)
plotf = self._get_plot_function()
for i, (label, y) i... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def _make_ts_plot(self, data, **kwargs):
from pandas.tseries.plotting import tsplot
import matplotlib.pyplot as plt
kwargs = kwargs.copy()
cycle = "".join(plt.rcParams.get("axes.color_cycle", list("bgrcmyk")))
colors = kwargs.pop("colors", "".join(cycle))
plotf = self._get_plot_function()
... | def _make_ts_plot(self, data, **kwargs):
from pandas.tseries.plotting import tsplot
plotf = self._get_plot_function()
if isinstance(data, Series):
ax, _ = self._get_ax_and_style(0) # self.axes[0]
label = com._stringify(self.label)
tsplot(data, plotf, ax=ax, label=label, style=sel... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def _maybe_convert_index(self, data):
# tsplot converts automatically, but don't want to convert index
# over and over for DataFrames
from pandas.core.frame import DataFrame
if isinstance(data.index, DatetimeIndex) and isinstance(data, DataFrame):
freq = getattr(data.index, "freq", None)
... | def _maybe_convert_index(self, data):
# tsplot converts automatically, but don't want to convert index
# over and over for DataFrames
from pandas.core.frame import DataFrame
if isinstance(data.index, DatetimeIndex) and isinstance(data, DataFrame):
freq = getattr(data.index, "freq", None)
... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def _post_plot_logic(self):
df = self.data
condition = (
not self._use_dynamic_x
and df.index.is_all_dates
and not self.subplots
or (self.subplots and self.sharex)
)
index_name = self._get_index_name()
for ax in self.axes:
if condition:
format_d... | 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._use_dynamic_x
and df.index.is_all_dates
and ... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def _make_plot(self):
colors = self.kwds.get("color", "brgyk")
rects = []
labels = []
ax = self._get_ax(0) # 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()):
label = com._str... | def _make_plot(self):
colors = self.kwds.get("color", "brgyk")
rects = []
labels = []
ax, _ = self._get_ax_and_style(0) # 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()):
kwd... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def plot_frame(
frame=None,
x=None,
y=None,
subplots=False,
sharex=True,
sharey=False,
use_index=True,
figsize=None,
grid=False,
legend=True,
rot=None,
ax=None,
style=None,
title=None,
xlim=None,
ylim=None,
logy=False,
xticks=None,
yticks=None,... | def plot_frame(
frame=None,
subplots=False,
sharex=True,
sharey=False,
use_index=True,
figsize=None,
grid=False,
legend=True,
rot=None,
ax=None,
title=None,
xlim=None,
ylim=None,
logy=False,
xticks=None,
yticks=None,
kind="line",
sort_columns=False... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def boxplot(
data,
column=None,
by=None,
ax=None,
fontsize=None,
rot=0,
grid=True,
figsize=None,
**kwds,
):
"""
Make a box plot from DataFrame column optionally grouped b ysome columns or
other inputs
Parameters
----------
data : DataFrame or Series
colum... | def boxplot(
data,
column=None,
by=None,
ax=None,
fontsize=None,
rot=0,
grid=True,
figsize=None,
**kwds,
):
"""
Make a box plot from DataFrame column optionally grouped b ysome columns or
other inputs
Parameters
----------
data : DataFrame or Series
colum... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def _subplots(
nrows=1,
ncols=1,
sharex=False,
sharey=False,
squeeze=True,
subplot_kw=None,
ax=None,
secondary_y=False,
data=None,
**fig_kw,
):
"""Create a figure with a set of subplots already made.
This utility wrapper makes it convenient to create common layouts of
... | def _subplots(
nrows=1,
ncols=1,
sharex=False,
sharey=False,
squeeze=True,
subplot_kw=None,
ax=None,
secondary_y=False,
data=None,
**fig_kw,
):
"""Create a figure with a set of subplots already made.
This utility wrapper makes it convenient to create common layouts of
... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def __new__(
cls,
data=None,
freq=None,
start=None,
end=None,
periods=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"]
warn = True
... | def __new__(
cls,
data=None,
freq=None,
start=None,
end=None,
periods=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"]
warn = True
... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def __repr__(self):
from pandas.core.format import _format_datetime64
values = self.values
freq = None
if self.offset is not None:
freq = self.offset.freqstr
summary = str(self.__class__)
if len(self) == 1:
first = _format_datetime64(values[0], tz=self.tz)
summary += "... | def __repr__(self):
from pandas.core.format import _format_datetime64
values = self.values
freq = None
if self.offset is not None:
freq = self.offset.freqstr
summary = str(self.__class__)
if len(self) > 0:
first = _format_datetime64(values[0], tz=self.tz)
last = _forma... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def intersection(self, other):
"""
Specialized intersection for DatetimeIndex objects. May be much faster
than Index.union
Parameters
----------
other : DatetimeIndex or array-like
Returns
-------
y : Index or DatetimeIndex
"""
if not isinstance(other, DatetimeIndex):
... | def intersection(self, other):
"""
Specialized intersection for DatetimeIndex objects. May be much faster
than Index.union
Parameters
----------
other : DatetimeIndex or array-like
Returns
-------
y : Index or DatetimeIndex
"""
if not isinstance(other, DatetimeIndex):
... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def get_value(self, series, key):
"""
Fast lookup of value from 1-dimensional ndarray. Only use this if you
know what you're doing
"""
try:
return Index.get_value(self, series, key)
except KeyError:
try:
loc = self._get_string_slice(key)
return series[loc]... | def get_value(self, series, key):
"""
Fast lookup of value from 1-dimensional ndarray. Only use this if you
know what you're doing
"""
try:
return Index.get_value(self, series, key)
except KeyError:
try:
loc = self._get_string_slice(key)
return series[loc]... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def date_range(
start=None, end=None, periods=None, freq="D", tz=None, normalize=False, name=None
):
"""
Return a fixed frequency datetime index, with day (calendar) as the default
frequency
Parameters
----------
start : string or datetime-like, default None
Left bound for generatin... | def date_range(start=None, end=None, periods=None, freq="D", tz=None, normalize=False):
"""
Return a fixed frequency datetime index, with day (calendar) as the default
frequency
Parameters
----------
start : string or datetime-like, default None
Left bound for generating dates
end :... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def bdate_range(
start=None, end=None, periods=None, freq="B", tz=None, normalize=True, name=None
):
"""
Return a fixed frequency datetime index, with business day as the default
frequency
Parameters
----------
start : string or datetime-like, default None
Left bound for generating ... | def bdate_range(start=None, end=None, periods=None, freq="B", tz=None, normalize=True):
"""
Return a fixed frequency datetime index, with business day as the default
frequency
Parameters
----------
start : string or datetime-like, default None
Left bound for generating dates
end : s... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def apply(self, other):
n = self.n
wkday, _ = lib.monthrange(other.year, other.month)
first = _get_firstbday(wkday)
if other.day > first and n <= 0:
# as if rolled forward already
n += 1
elif other.day < first and n > 0:
other = other + timedelta(days=first - other.day)
... | def apply(self, other):
n = self.n
wkday, _ = lib.monthrange(other.year, other.month)
first = _get_firstbday(wkday)
if other.day > first and n <= 0:
# as if rolled forward already
n += 1
other = other + relativedelta(months=n)
wkday, _ = lib.monthrange(other.year, other.month)... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def _from_arraylike(cls, data, freq):
if not isinstance(data, np.ndarray):
if np.isscalar(data) or isinstance(data, Period):
raise ValueError(
"PeriodIndex() must be called with a "
"collection of some kind, %s was passed" % repr(data)
)
# oth... | def _from_arraylike(cls, data, freq):
if not isinstance(data, np.ndarray):
if np.isscalar(data) or isinstance(data, Period):
raise ValueError(
"PeriodIndex() must be called with a "
"collection of some kind, %s was passed" % repr(data)
)
# oth... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def period_range(start=None, end=None, periods=None, freq="D", name=None):
"""
Return a fixed frequency datetime index, with day (calendar) as the default
frequency
Parameters
----------
start :
end :
periods : int, default None
Number of periods in the index
freq : str/Dat... | def period_range(start=None, end=None, periods=None, freq="D"):
"""
Return a fixed frequency datetime index, with day (calendar) as the default
frequency
Parameters
----------
start :
end :
normalize : bool, default False
Normalize start/end dates to midnight before generating ... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def tsplot(series, plotf, **kwargs):
"""
Plots a Series on the given Matplotlib axes or the current axes
Parameters
----------
axes : Axes
series : Series
Notes
_____
Supports same kwargs as Axes.plot
"""
# Used inferred freq is possible, need a test case for inferred
... | def tsplot(series, plotf, **kwargs):
"""
Plots a Series on the given Matplotlib axes or the current axes
Parameters
----------
axes : Axes
series : Series
Notes
_____
Supports same kwargs as Axes.plot
"""
# Used inferred freq is possible, need a test case for inferred
... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
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"]
for root, dirs, files in list(os.walk("pandas")):
for f in files:
if f in self._clean_exclude:
co... | 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"]
for root, dirs, files in list(os.walk("pandas")):
for f in files:
if f in self._clean_exclude:
co... | https://github.com/pandas-dev/pandas/issues/1628 | In [1]: from pandas import *
In [2]: a = DataFrame(columns=['column1'], data=[1])
In [3]: b = DataFrame(columns=['column1'])
In [4]: a.merge(b, on=['column1'], how='left')
IndexError Traceback (most recent call last)
IndexError: index out of range for array | IndexError |
def _dt_index_cmp(opname):
"""
Wrap comparison operations to convert datetime-like to datetime64
"""
def wrapper(self, other):
func = getattr(super(DatetimeIndex, self), opname)
if isinstance(other, datetime):
func = getattr(self, opname)
other = _to_m8(other)
... | def _dt_index_cmp(opname):
"""
Wrap comparison operations to convert datetime-like to datetime64
"""
def wrapper(self, other):
if isinstance(other, datetime):
func = getattr(self, opname)
result = func(_to_m8(other))
elif isinstance(other, np.ndarray):
... | https://github.com/pandas-dev/pandas/issues/1430 | from pandas import *
import numpy as np
periods = 1000
ind = DatetimeIndex(start='2012/1/1', freq='5min', periods=periods)
df = DataFrame({'high': np.arange(periods), 'low': np.arange(periods)}, index=ind)
grouped = df.groupby(lambda x: datetime(x.year, x.month, x.day))
In [9]: grouped.groups
ValueError ... | ValueError |
def wrapper(self, other):
func = getattr(super(DatetimeIndex, self), opname)
if isinstance(other, datetime):
func = getattr(self, opname)
other = _to_m8(other)
elif isinstance(other, list):
other = DatetimeIndex(other)
elif not isinstance(other, np.ndarray):
other = _ensu... | def wrapper(self, other):
if isinstance(other, datetime):
func = getattr(self, opname)
result = func(_to_m8(other))
elif isinstance(other, np.ndarray):
func = getattr(super(DatetimeIndex, self), opname)
result = func(other)
else:
other = _ensure_datetime64(other)
... | https://github.com/pandas-dev/pandas/issues/1430 | from pandas import *
import numpy as np
periods = 1000
ind = DatetimeIndex(start='2012/1/1', freq='5min', periods=periods)
df = DataFrame({'high': np.arange(periods), 'low': np.arange(periods)}, index=ind)
grouped = df.groupby(lambda x: datetime(x.year, x.month, x.day))
In [9]: grouped.groups
ValueError ... | ValueError |
def tsplot(series, plotf, *args, **kwargs):
"""
Plots a Series on the given Matplotlib axes object
Parameters
----------
axes : Axes
series : Series
Notes
_____
Supports same args and kwargs as Axes.plot
"""
# Used inferred freq is possible, need a test case for inferred
... | def tsplot(series, plotf, *args, **kwargs):
"""
Plots a Series on the given Matplotlib axes object
Parameters
----------
axes : Axes
series : Series
Notes
_____
Supports same args and kwargs as Axes.plot
"""
# Used inferred freq is possible, need a test case for inferred
... | https://github.com/pandas-dev/pandas/issues/1357 | In [4]: ts.plot()
Out[4]: <matplotlib.axes.AxesSubplot at 0x41cc310>
In [5]: ts.index.fr
ts.index.freq ts.index.freqstr
In [5]: ts.index.freq
Out[5]: <10 Days>
In [6]: ts.index.freq = None
---------------------------------------------------------------------------
AttributeError Traceb... | AttributeError |
def get_loc(self, key):
"""
Get integer location for requested label
Returns
-------
loc : int
"""
try:
return self._engine.get_loc(key)
except KeyError:
try:
return self._get_string_slice(key)
except (TypeError, KeyError):
pass
i... | def get_loc(self, key):
"""y
Get integer location for requested label
Returns
-------
loc : int
"""
try:
return self._engine.get_loc(key)
except KeyError:
try:
return self._get_string_slice(key)
except (TypeError, KeyError):
pass
... | 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 match(to_match, values, na_sentinel=-1):
"""
Compute locations of to_match into values
Parameters
----------
to_match : array-like
values to find positions of
values : array-like
Unique set of values
na_sentinel : int, default -1
Value to mark "not found"
Ex... | def match(values, index):
"""
Parameters
----------
Returns
-------
match : ndarray
"""
if com.is_float_dtype(index):
return _match_generic(values, index, lib.Float64HashTable, com._ensure_float64)
elif com.is_integer_dtype(index):
return _match_generic(values, ind... | 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 unique(values):
"""
Compute unique values (not necessarily sorted) efficiently from input array
of values
Parameters
----------
values : array-like
Returns
-------
uniques
"""
f = lambda htype, caster: _unique_generic(values, htype, caster)
return _hashtable_algo(f,... | def unique(values):
""" """
pass
| 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 count(values, uniques=None):
f = lambda htype, caster: _count_generic(values, htype, caster)
if uniques is not None:
raise NotImplementedError
else:
return _hashtable_algo(f, values.dtype)
| def count(values, uniques=None):
if uniques is not None:
raise NotImplementedError
else:
if com.is_float_dtype(values):
return _count_generic(values, lib.Float64HashTable, com._ensure_float64)
elif com.is_integer_dtype(values):
return _count_generic(values, lib.In... | 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 _count_generic(values, table_type, type_caster):
from pandas.core.series import Series
values = type_caster(values)
table = table_type(len(values))
uniques, labels, counts = table.factorize(values)
return Series(counts, index=uniques)
| def _count_generic(values, table_type, type_caster):
values = type_caster(values)
table = table_type(len(values))
uniques, labels, counts = table.factorize(values)
return Series(counts, index=uniques)
| 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 factorize(values, sort=False, order=None, na_sentinel=-1):
"""
Encode input values as an enumerated type or categorical variable
Parameters
----------
values : sequence
sort :
order :
Returns
-------
"""
values = np.asarray(values)
is_datetime = com.is_datetime64_dt... | def factorize(values, sort=False, order=None, na_sentinel=-1):
"""
Encode input values as an enumerated type or categorical variable
Parameters
----------
values : sequence
sort :
order :
Returns
-------
"""
hash_klass, values = _get_data_algo(values, _hashtables)
uniq... | 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 value_counts(values, sort=True, ascending=False):
"""
Compute a histogram of the counts of non-null values
Returns
-------
value_counts : Series
"""
from pandas.core.series import Series
from collections import defaultdict
if com.is_integer_dtype(values.dtype):
values =... | def value_counts(values, sort=True, ascending=False):
"""
Compute a histogram of the counts of non-null values
Returns
-------
value_counts : Series
"""
from collections import defaultdict
if com.is_integer_dtype(values.dtype):
values = com._ensure_int64(values)
keys, 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 _get_data_algo(values, func_map):
if com.is_float_dtype(values):
f = func_map["float64"]
values = com._ensure_float64(values)
elif com.is_datetime64_dtype(values):
f = func_map["int64"]
values = values.view("i8")
elif com.is_integer_dtype(values):
f = func_map["in... | def _get_data_algo(values, func_map):
if com.is_float_dtype(values):
f = func_map["float64"]
values = com._ensure_float64(values)
elif com.is_integer_dtype(values):
f = func_map["int64"]
values = com._ensure_int64(values)
else:
f = func_map["generic"]
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 isnull(obj):
"""
Replacement for numpy.isnan / -numpy.isfinite which is suitable
for use on object arrays.
Parameters
----------
arr: ndarray or object value
Returns
-------
boolean ndarray or boolean
"""
if lib.isscalar(obj):
return lib.checknull(obj)
from... | def isnull(obj):
"""
Replacement for numpy.isnan / -numpy.isfinite which is suitable
for use on object arrays.
Parameters
----------
arr: ndarray or object value
Returns
-------
boolean ndarray or boolean
"""
if np.isscalar(obj) or obj is None:
return lib.checknull(... | 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_take2d_function(dtype_str, axis=0):
if axis == 0:
return _take2d_axis0_dict[dtype_str]
elif axis == 1:
return _take2d_axis1_dict[dtype_str]
elif axis == "multi":
return _take2d_multi_dict[dtype_str]
else: # pragma: no cover
raise ValueError("bad axis: %s" % axis... | def _get_take2d_function(dtype_str, axis=0):
if axis == 0:
return _take2d_axis0_dict[dtype_str]
else:
return _take2d_axis1_dict[dtype_str]
| 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_1d(arr, indexer, out=None, fill_value=np.nan):
"""
Specialized Cython take which sets NaN values in one pass
"""
dtype_str = arr.dtype.name
n = len(indexer)
indexer = _ensure_int64(indexer)
out_passed = out is not None
take_f = _take1d_dict.get(dtype_str)
if dtype_str in... | def take_1d(arr, indexer, out=None, fill_value=np.nan):
"""
Specialized Cython take which sets NaN values in one pass
"""
dtype_str = arr.dtype.name
n = len(indexer)
if not isinstance(indexer, np.ndarray):
# Cython methods expects 32-bit integers
indexer = np.array(indexer, dty... | 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_2d(
arr, indexer, out=None, mask=None, needs_masking=None, axis=0, fill_value=np.nan
):
"""
Specialized Cython take which sets NaN values in one pass
"""
dtype_str = arr.dtype.name
out_shape = list(arr.shape)
out_shape[axis] = len(indexer)
out_shape = tuple(out_shape)
if n... | def take_2d(
arr, indexer, out=None, mask=None, needs_masking=None, axis=0, fill_value=np.nan
):
"""
Specialized Cython take which sets NaN values in one pass
"""
dtype_str = arr.dtype.name
out_shape = list(arr.shape)
out_shape[axis] = len(indexer)
out_shape = tuple(out_shape)
if n... | 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_fast(arr, indexer, mask, needs_masking, axis=0, out=None, fill_value=np.nan):
if arr.ndim == 2:
return take_2d(
arr,
indexer,
out=out,
mask=mask,
needs_masking=needs_masking,
axis=axis,
fill_value=fill_value,
... | def take_fast(arr, indexer, mask, needs_masking, axis=0, out=None, fill_value=np.nan):
if arr.ndim == 2:
return take_2d(
arr,
indexer,
out=out,
mask=mask,
needs_masking=needs_masking,
axis=axis,
fill_value=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 iterpairs(seq):
"""
Parameters
----------
seq: sequence
Returns
-------
iterator returning overlapping pairs of elements
Example
-------
>>> iterpairs([1, 2, 3, 4])
[(1, 2), (2, 3), (3, 4)
"""
# input may not be sliceable
seq_it = iter(seq)
seq_it_next =... | def iterpairs(seq):
"""
Parameters
----------
seq: sequence
Returns
-------
iterator returning overlapping pairs of elements
Example
-------
>>> iterpairs([1, 2, 3, 4])
[(1, 2), (2, 3), (3, 4)
"""
# input may not be sliceable
seq_it = iter(seq)
seq_it_next =... | 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 is_integer_dtype(arr_or_dtype):
if isinstance(arr_or_dtype, np.dtype):
tipo = arr_or_dtype.type
else:
tipo = arr_or_dtype.dtype.type
return issubclass(tipo, np.integer) and not issubclass(tipo, np.datetime64)
| def is_integer_dtype(arr_or_dtype):
if isinstance(arr_or_dtype, np.dtype):
tipo = arr_or_dtype.type
else:
tipo = arr_or_dtype.dtype.type
return issubclass(tipo, np.integer)
| 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 _astype_nansafe(arr, dtype):
if isinstance(dtype, basestring):
dtype = np.dtype(dtype)
if issubclass(arr.dtype.type, np.datetime64):
if dtype == object:
return lib.ints_to_pydatetime(arr.view(np.int64))
elif np.issubdtype(arr.dtype, np.floating) and np.issubdtype(dtype, np.i... | def _astype_nansafe(arr, dtype):
if np.issubdtype(arr.dtype, np.floating) and np.issubdtype(dtype, np.integer):
if np.isnan(arr).any():
raise ValueError("Cannot convert NA to integer")
return arr.astype(dtype)
| 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,
start=None,
end=None,
periods=None,
offset=datetools.bday,
time_rule=None,
tzinfo=None,
name=None,
**kwds,
):
import warnings
warnings.warn("DateRange is deprecated, use DatetimeIndex instead", FutureWarning)
if time_rule is None:
time_rule = k... | def __new__(
cls,
start=None,
end=None,
periods=None,
offset=datetools.bday,
time_rule=None,
tzinfo=None,
name=None,
**kwds,
):
time_rule = kwds.get("timeRule", time_rule)
if time_rule is not None:
offset = datetools.getOffset(time_rule)
if time_rule is 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 _expand_axes(self, key):
new_axes = []
for k, ax in zip(key, self.axes):
if k not in ax:
if type(k) != ax.dtype.type:
ax = ax.astype("O")
new_axes.append(ax.insert(len(ax), k))
else:
new_axes.append(ax)
return new_axes
| def _expand_axes(self, key):
new_axes = []
for k, ax in zip(key, self.axes):
if k not in ax:
new_axes.append(ax.insert(len(ax), k))
else:
new_axes.append(ax)
return new_axes
| 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 truncate(self, before=None, after=None, copy=True):
"""Function truncate a sorted DataFrame / Series before and/or after
some particular dates.
Parameters
----------
before : date
Truncate before date
after : date
Truncate after date
Returns
-------
truncated : ... | def truncate(self, before=None, after=None, copy=True):
"""Function truncate a sorted DataFrame / Series before and/or after
some particular dates.
Parameters
----------
before : date
Truncate before date
after : date
Truncate after date
Returns
-------
truncated : ... | 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 save(self, path):
com.save(self, path)
| def save(self, path):
save(self, path)
| 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 load(cls, path):
return com.load(path)
| def load(cls, path):
return load(path)
| 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, key):
if type(key) is tuple:
try:
return self.obj.get_value(*key)
except Exception:
pass
return self._getitem_tuple(key)
else:
return self._getitem_axis(key, axis=0)
| def __getitem__(self, key):
if isinstance(key, tuple):
try:
return self.obj.get_value(*key)
except Exception:
pass
return self._getitem_tuple(key)
else:
return self._getitem_axis(key, axis=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 _setitem_with_indexer(self, indexer, value):
# also has the side effect of consolidating in-place
if self.obj._is_mixed_type:
if not isinstance(indexer, tuple):
indexer = self._tuplify(indexer)
het_axis = self.obj._het_axis
het_idx = indexer[het_axis]
if isinsta... | def _setitem_with_indexer(self, indexer, value):
# also has the side effect of consolidating in-place
if self.obj._is_mixed_type:
if not isinstance(indexer, tuple):
indexer = self._tuplify(indexer)
het_axis = self.obj._het_axis
het_idx = indexer[het_axis]
if isinsta... | 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_tuple(self, tup):
try:
return self._getitem_lowerdim(tup)
except IndexingError:
pass
# ugly hack for GH #836
if self._multi_take_opportunity(tup):
return self._multi_take(tup)
# no shortcut needed
retval = self.obj
for i, key in enumerate(tup):
... | def _getitem_tuple(self, tup):
try:
return self._getitem_lowerdim(tup)
except IndexingError:
pass
# no shortcut needed
retval = self.obj
for i, key in enumerate(tup):
if i >= self.obj.ndim:
raise IndexingError("Too many indexers")
if _is_null_slice(key):... | 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_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/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_iterable(self, key, axis=0):
labels = self.obj._get_axis(axis)
def _reindex(keys, level=None):
try:
return self.obj.reindex_axis(keys, axis=axis, level=level)
except AttributeError:
# Series
assert axis == 0
return self.obj.reindex(ke... | def _getitem_iterable(self, key, axis=0):
labels = self.obj._get_axis(axis)
def _reindex(keys, level=None):
try:
return self.obj.reindex_axis(keys, axis=axis, level=level)
except AttributeError:
# Series
assert axis == 0
return self.obj.reindex(ke... | 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 _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/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_slice_axis(self, slice_obj, axis=0):
obj = self.obj
axis_name = obj._get_axis_name(axis)
labels = getattr(obj, axis_name)
int_slice = _is_index_slice(slice_obj)
start = slice_obj.start
stop = slice_obj.stop
# in case of providing all floats, use label-based indexing
float_sl... | def _get_slice_axis(self, slice_obj, axis=0):
obj = self.obj
axis_name = obj._get_axis_name(axis)
labels = getattr(obj, axis_name)
int_slice = _is_index_slice(slice_obj)
start = slice_obj.start
stop = slice_obj.stop
# in case of providing all floats, use label-based indexing
float_sl... | 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 _is_integer_dtype(arr):
return (
issubclass(arr.dtype.type, np.integer) and not arr.dtype.type == np.datetime64
)
| def _is_integer_dtype(arr):
return issubclass(arr.dtype.type, np.integer)
| 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 _is_list_like(obj):
# Consider namedtuples to be not list like as they are useful as indices
return (
np.iterable(obj)
and not isinstance(obj, basestring)
and not (isinstance(obj, tuple) and type(obj) is not tuple)
)
| def _is_list_like(obj):
return np.iterable(obj) and not isinstance(obj, basestring)
| 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 _is_valid_index(x):
return com.is_float(x)
| def _is_valid_index(x):
return (
com.is_integer(x)
or com.is_float(x)
and np.allclose(x, int(x), rtol=_eps, atol=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 ref_locs(self):
if self._ref_locs is None:
indexer = self.ref_items.get_indexer(self.items)
indexer = com._ensure_platform_int(indexer)
assert (indexer != -1).all()
self._ref_locs = indexer
return self._ref_locs
| def ref_locs(self):
if self._ref_locs is None:
indexer = self.ref_items.get_indexer(self.items)
assert (indexer != -1).all()
self._ref_locs = indexer
return self._ref_locs
| 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, inplace=False):
new_values = self.values if inplace else self.values.copy()
mask = com.isnull(new_values)
np.putmask(new_values, mask, value)
if inplace:
return self
else:
return make_block(new_values, self.items, self.ref_items)
| def fillna(self, value, inplace=False):
new_values = self.values if inplace else self.values.copy()
mask = com.isnull(new_values.ravel())
new_values.flat[mask] = value
if inplace:
return self
else:
return make_block(new_values, self.items, self.ref_items)
| 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 interpolate(self, method="pad", axis=0, inplace=False, limit=None, missing=None):
values = self.values if inplace else self.values.copy()
if values.ndim != 2:
raise NotImplementedError
transf = (lambda x: x) if axis == 0 else (lambda x: x.T)
if missing is None:
mask = None
els... | def interpolate(self, method="pad", axis=0, inplace=False):
values = self.values if inplace else self.values.copy()
if values.ndim != 2:
raise NotImplementedError
transf = (lambda x: x) if axis == 0 else (lambda x: x.T)
if method == "pad":
_pad(transf(values))
else:
_backf... | 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 should_store(self, value):
return not issubclass(
value.dtype.type, (np.integer, np.floating, np.complexfloating, np.bool_)
)
| def should_store(self, value):
return not issubclass(value.dtype.type, (np.integer, np.floating, np.bool_))
| 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_block(values, items, ref_items, do_integrity_check=False):
dtype = values.dtype
vtype = dtype.type
if issubclass(vtype, np.floating):
klass = FloatBlock
elif issubclass(vtype, np.complexfloating):
klass = ComplexBlock
elif issubclass(vtype, np.datetime64):
klass = D... | def make_block(values, items, ref_items, do_integrity_check=False):
dtype = values.dtype
vtype = dtype.type
if issubclass(vtype, np.floating):
klass = FloatBlock
elif issubclass(vtype, np.integer):
if vtype != np.int64:
values = values.astype("i8")
klass = IntBlock
... | 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):
# discard anything after 3rd, support beta pickling format for a little
# while longer
ax_arrays, bvalues, bitems = state[:3]
self.axes = [_ensure_index(ax) for ax in ax_arrays]
self.axes = _handle_legacy_indexes(self.axes)
blocks = []
for values, items in zi... | def __setstate__(self, state):
# discard anything after 3rd, support beta pickling format for a little
# while longer
ax_arrays, bvalues, bitems = state[:3]
self.axes = [_ensure_index(ax) for ax in ax_arrays]
blocks = []
for values, items in zip(bvalues, bitems):
blk = make_block(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 _verify_integrity(self):
_union_block_items(self.blocks)
mgr_shape = self.shape
for block in self.blocks:
assert block.ref_items is self.items
assert block.values.shape[1:] == mgr_shape[1:]
tot_items = sum(len(x.items) for x in self.blocks)
assert len(self.items) == tot_items
| def _verify_integrity(self):
_union_block_items(self.blocks)
mgr_shape = self.shape
for block in self.blocks:
assert block.values.shape[1:] == mgr_shape[1:]
tot_items = sum(len(x.items) for x in self.blocks)
assert len(self.items) == tot_items
| 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_numeric_data(self, copy=False):
num_blocks = [
b
for b in self.blocks
if (
isinstance(b, (IntBlock, FloatBlock, ComplexBlock))
and not isinstance(b, DatetimeBlock)
)
]
indexer = np.sort(np.concatenate([b.ref_locs for b in num_blocks]))
new... | def get_numeric_data(self, copy=False):
num_blocks = [b for b in self.blocks if isinstance(b, (IntBlock, FloatBlock))]
indexer = np.sort(np.concatenate([b.ref_locs for b in num_blocks]))
new_items = self.items.take(indexer)
new_blocks = []
for b in num_blocks:
b = b.copy(deep=False)
... | 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 from_blocks(cls, blocks, index):
# also checks for overlap
items = _union_block_items(blocks)
for blk in blocks:
blk.ref_items = items
return BlockManager(blocks, [items, index])
| def from_blocks(cls, blocks, index):
# also checks for overlap
items = _union_block_items(blocks)
return BlockManager(blocks, [items, index])
| 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 _interleave(self, items):
"""
Return ndarray from blocks with specified item order
Items must be contained in the blocks
"""
dtype = _interleaved_dtype(self.blocks)
items = _ensure_index(items)
result = np.empty(self.shape, dtype=dtype)
itemmask = np.zeros(len(items), dtype=bool)
... | def _interleave(self, items):
"""
Return ndarray from blocks with specified item order
Items must be contained in the blocks
"""
dtype = _interleaved_dtype(self.blocks)
items = _ensure_index(items)
result = np.empty(self.shape, dtype=dtype)
itemmask = np.zeros(len(items), dtype=bool)
... | 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_items(self, new_items, copy=True, fill_value=np.nan):
""" """
new_items = _ensure_index(new_items)
data = self
if not data.is_consolidated():
data = data.consolidate()
return data.reindex_items(new_items)
# TODO: this part could be faster (!)
new_items, indexer = sel... | def reindex_items(self, new_items, copy=True, fill_value=np.nan):
""" """
new_items = _ensure_index(new_items)
data = self
if not data.is_consolidated():
data = data.consolidate()
return data.reindex_items(new_items)
# TODO: this part could be faster (!)
new_items, indexer = sel... | 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 rename_axis(self, mapper, axis=1):
new_axis = Index([mapper(x) for x in self.axes[axis]])
assert new_axis.is_unique
new_axes = list(self.axes)
new_axes[axis] = new_axis
return BlockManager(self.blocks, new_axes)
| def rename_axis(self, mapper, axis=1):
new_axis = Index([mapper(x) for x in self.axes[axis]])
new_axis._verify_integrity()
new_axes = list(self.axes)
new_axes[axis] = new_axis
return BlockManager(self.blocks, new_axes)
| 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 rename_items(self, mapper, copydata=True):
new_items = Index([mapper(x) for x in self.items])
new_items.is_unique
new_blocks = []
for block in self.blocks:
newb = block.copy(deep=copydata)
newb.set_ref_items(new_items, maybe_rename=True)
new_blocks.append(newb)
new_axes ... | def rename_items(self, mapper, copydata=True):
new_items = Index([mapper(x) for x in self.items])
new_items._verify_integrity()
new_blocks = []
for block in self.blocks:
newb = block.copy(deep=copydata)
newb.set_ref_items(new_items, maybe_rename=True)
new_blocks.append(newb)
... | 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, inplace=False):
new_blocks = [
b.fillna(value, inplace=inplace) if b._can_hold_na else b for b in self.blocks
]
if inplace:
return self
return BlockManager(new_blocks, self.axes)
| def fillna(self, value, inplace=False):
""" """
new_blocks = [
b.fillna(value, inplace=inplace) if b._can_hold_na else b for b in self.blocks
]
if inplace:
return self
return BlockManager(new_blocks, self.axes)
| 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 form_blocks(data, axes):
# pre-filter out items if we passed it
items = axes[0]
if len(data) < len(items):
extra_items = items - Index(data.keys())
else:
extra_items = []
# put "leftover" items in float bucket, where else?
# generalize?
float_dict = {}
complex_dict ... | def form_blocks(data, axes):
# pre-filter out items if we passed it
items = axes[0]
if len(data) < len(items):
extra_items = items - Index(data.keys())
else:
extra_items = []
# put "leftover" items in float bucket, where else?
# generalize?
float_dict = {}
int_dict = {}... | 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 _stack_dict(dct, ref_items, dtype):
from pandas.core.series import Series
# fml
def _asarray_compat(x):
# asarray shouldn't be called on SparseSeries
if isinstance(x, Series):
return x.values
else:
return np.asarray(x)
def _shape_compat(x):
#... | def _stack_dict(dct, ref_items, dtype):
from pandas.core.series import Series
# fml
def _asarray_compat(x):
# asarray shouldn't be called on SparseSeries
if isinstance(x, Series):
return x.values
else:
return np.asarray(x)
def _shape_compat(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 _interleaved_dtype(blocks):
from collections import defaultdict
counts = defaultdict(lambda: 0)
for x in blocks:
counts[type(x)] += 1
have_int = counts[IntBlock] > 0
have_bool = counts[BoolBlock] > 0
have_object = counts[ObjectBlock] > 0
have_float = counts[FloatBlock] > 0
... | def _interleaved_dtype(blocks):
from collections import defaultdict
counts = defaultdict(lambda: 0)
for x in blocks:
counts[type(x)] += 1
have_int = counts[IntBlock] > 0
have_bool = counts[BoolBlock] > 0
have_object = counts[ObjectBlock] > 0
have_float = counts[FloatBlock] > 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.