Skip to content

CLN: eliminate depr warnings on 3.4 #7204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 22, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions pandas/core/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ def _to_str_columns(self):
*(_strlen(x) for x in cheader))

fmt_values = self._format_col(i)

fmt_values = _make_fixed_width(fmt_values, self.justify,
minimum=max_colwidth)

Expand Down Expand Up @@ -400,7 +400,7 @@ def _to_str_columns(self):
col_num = self.tr_col_num
col_width = len(strcols[col_num][0]) # infer from column header
strcols.insert(col_num + 1, ['...'.center(col_width)] * (len(str_index)))
if truncate_v:
if truncate_v:
n_header_rows = len(str_index) - len(frame)
row_num = self.tr_row_num
for ix,col in enumerate(strcols):
Expand Down Expand Up @@ -843,10 +843,10 @@ def _column_header():
if self.fmt.sparsify and lnum == 0:
ins_col = row_levels + self.fmt.tr_col_num - 1
row.insert(ins_col, '...')

for tag in list(tags.keys()):
if tag >= ins_col:
tags[tag+1] = tags.pop(tag)
tags[tag+1] = tags.pop(tag)
else:
row.insert(row_levels + self.fmt.tr_col_num, '...')

Expand Down Expand Up @@ -911,12 +911,12 @@ def _write_regular_rows(self, fmt_values, indent):
index_values = self.fmt.tr_frame.index.format()

for i in range(nrows):

if truncate_v and i == (self.fmt.tr_row_num):
str_sep_row = [ '...' for ele in row ]
self.write_tr(str_sep_row, indent, self.indent_delta, tags=None,
nindex_levels=1)

row = []
row.append(index_values[i])
row.extend(fmt_values[j][i] for j in range(ncols))
Expand Down Expand Up @@ -1101,7 +1101,7 @@ def __init__(self, obj, path_or_buf=None, sep=",", na_rep='', float_format=None,

if chunksize is None:
chunksize = (100000 / (len(self.cols) or 1)) or 1
self.chunksize = chunksize
self.chunksize = int(chunksize)

self.data_index = obj.index
if isinstance(obj.index, PeriodIndex):
Expand Down
44 changes: 22 additions & 22 deletions pandas/tools/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ def f(x):
ax.plot(x, y, color=colors[kls], label=label, **kwds)
else:
ax.plot(x, y, color=colors[kls], **kwds)

ax.legend(loc='upper right')
ax.grid()
return ax
Expand Down Expand Up @@ -754,7 +754,7 @@ class MPLPlot(object):
"""
_default_rot = 0

_pop_attributes = ['label', 'style', 'logy', 'logx', 'loglog',
_pop_attributes = ['label', 'style', 'logy', 'logx', 'loglog',
'mark_right']
_attr_defaults = {'logy': False, 'logx': False, 'loglog': False,
'mark_right': True}
Expand Down Expand Up @@ -1002,8 +1002,8 @@ def _add_table(self):
data = self.data
data = data.transpose()
else:
data = self.table
ax = self._get_ax(0)
data = self.table
ax = self._get_ax(0)
table(ax, data)

def _post_plot_logic(self):
Expand Down Expand Up @@ -1545,7 +1545,7 @@ def _is_ts_plot(self):
def _make_plot(self):
self._pos_prior = np.zeros(len(self.data))
self._neg_prior = np.zeros(len(self.data))

if self._is_ts_plot():
data = self._maybe_convert_index(self.data)
self._make_ts_plot(data)
Expand All @@ -1565,7 +1565,7 @@ def _make_plot(self):

errors = self._get_errorbars(label=label, index=i)
kwds = dict(kwds, **errors)

label = com.pprint_thing(label) # .encode('utf-8')
kwds['label'] = label

Expand Down Expand Up @@ -1613,7 +1613,7 @@ def _get_stacked_values(self, y, label):
def _get_ts_plot_function(self):
from pandas.tseries.plotting import tsplot
plotf = self._get_plot_function()

def _plot(data, ax, label, style, **kwds):
# errorbar function does not support style argument
if plotf.__name__ == 'errorbar':
Expand Down Expand Up @@ -1722,7 +1722,7 @@ def _get_plot_function(self):
raise ValueError("Log-y scales are not supported in area plot")
else:
f = LinePlot._get_plot_function(self)

def plotf(*args, **kwds):
lines = f(*args, **kwds)

Expand All @@ -1746,12 +1746,12 @@ def plotf(*args, **kwds):

self.plt.Axes.fill_between(*args, **kwds)
return lines

return plotf

def _add_legend_handle(self, handle, label, index=None):
from matplotlib.patches import Rectangle
# Because fill_between isn't supported in legend,
# Because fill_between isn't supported in legend,
# specifically add Rectangle handle here
alpha = self.kwds.get('alpha', 0.5)
handle = Rectangle((0, 0), 1, 1, fc=handle.get_color(), alpha=alpha)
Expand All @@ -1766,14 +1766,14 @@ def _post_plot_logic(self):
if self.xlim is None:
for ax in self.axes:
ax.set_xlim(0, len(self.data)-1)

if self.ylim is None:
if (self.data >= 0).all().all():
for ax in self.axes:
ax.set_ylim(0, None)
elif (self.data <= 0).all().all():
for ax in self.axes:
ax.set_ylim(None, 0)
ax.set_ylim(None, 0)


class BarPlot(MPLPlot):
Expand Down Expand Up @@ -1923,7 +1923,7 @@ def _args_adjust(self):
self.logy = False
self.logx = False
self.loglog = False

def _get_layout(self):
from pandas import DataFrame
if isinstance(self.data, DataFrame):
Expand Down Expand Up @@ -1982,8 +1982,8 @@ class HistPlot(MPLPlot):
_series_kinds = ['pie']
_all_kinds = _common_kinds + _dataframe_kinds + _series_kinds

_plot_klass = {'line': LinePlot, 'bar': BarPlot, 'barh': BarPlot,
'kde': KdePlot,
_plot_klass = {'line': LinePlot, 'bar': BarPlot, 'barh': BarPlot,
'kde': KdePlot,
'scatter': ScatterPlot, 'hexbin': HexBinPlot,
'area': AreaPlot, 'pie': PiePlot}

Expand Down Expand Up @@ -2101,7 +2101,7 @@ def plot_frame(frame=None, x=None, y=None, subplots=False, sharex=True,
elif kind in _series_kinds:
if y is None and subplots is False:
msg = "{0} requires either y column or 'subplots=True'"
raise ValueError(msg.format(kind))
raise ValueError(msg.format(kind))
elif y is not None:
if com.is_integer(y) and not frame.columns.holds_integer():
y = frame.columns[y]
Expand All @@ -2113,8 +2113,8 @@ def plot_frame(frame=None, x=None, y=None, subplots=False, sharex=True,
fontsize=fontsize, use_index=use_index, sharex=sharex,
sharey=sharey, xticks=xticks, yticks=yticks,
xlim=xlim, ylim=ylim, title=title, grid=grid,
figsize=figsize,
sort_columns=sort_columns,
figsize=figsize,
sort_columns=sort_columns,
**kwds)
else:
if x is not None:
Expand Down Expand Up @@ -2504,7 +2504,7 @@ def hist_frame(data, column=None, by=None, grid=True, xlabelsize=None,
The size of the figure to create in inches by default
layout: (optional) a tuple (rows, columns) for the layout of the histograms
bins: integer, default 10
Number of histogram bins to be used
Number of histogram bins to be used
kwds : other plotting keyword arguments
To be passed to hist function
"""
Expand Down Expand Up @@ -2538,7 +2538,7 @@ def hist_frame(data, column=None, by=None, grid=True, xlabelsize=None,
sharex=sharex, sharey=sharey, figsize=figsize)

for i, col in enumerate(com._try_sort(data.columns)):
ax = axes[i / ncols, i % ncols]
ax = axes[i // ncols, i % ncols]
ax.xaxis.set_visible(True)
ax.yaxis.set_visible(True)
ax.hist(data[col].dropna().values, bins=bins, **kwds)
Expand Down Expand Up @@ -2583,7 +2583,7 @@ def hist_series(self, by=None, ax=None, grid=True, xlabelsize=None,
figsize : tuple, default None
figure size in inches by default
bins: integer, default 10
Number of histogram bins to be used
Number of histogram bins to be used
kwds : keywords
To be passed to the actual plotting function

Expand Down Expand Up @@ -3046,7 +3046,7 @@ def on_right(i):
if naxes != nplots:
for ax in axarr[naxes:]:
ax.set_visible(False)

if squeeze:
# Reshape the array to have the final desired dimension (nrow,ncol),
# though discarding unneeded dimensions that equal 1. If we only have
Expand Down