Upgrading pandas 0.15 to 0.16
Breaking0.15.2 → 0.16.2Breaking3Deprecated1New8Changed1Other3
BreakingUpgrade verdict
3 breaking changes.
In plain terms
- Categorical values are now ordered by default, which can change how comparisons and sorting behave.
- The seconds value of a time duration now behaves like Python's built-in timedelta, which may change results for existing code.
- Slicing with .loc now behaves like .ix, which can change the rows and columns returned by existing slices.
- Three plotting and R integration modules are deprecated; users should switch to external packages such as seaborn, pandas-qt and rpy2.
Must act 4 items need code or config changes
What you must change
Breaking3
Changes the default for ordering in the Categorical constructor.
CategoricalMakes a backwards incompatible change to Timedelta so the .seconds attribute conforms with datetime.timedelta.
TimedeltaTimedelta.secondsChanges the .loc slicing API to conform with the behavior of .ix.
.loc.ixDeprecations to plan for
Deprecated1
Deprecates the pandas.tools.rplot, pandas.sandbox.qtpandas and pandas.rpy modules.
pandas.tools.rplotpandas.sandbox.qtpandaspandas.rpyAPI changes
Generated by DepDelta from published Python source. Not mixed with prose notes.
- removed:
export value_range - removed:
variable e - added:
variable module
- added:
function is_platform_linux() - added:
function is_platform_mac() - added:
function is_platform_windows() - added:
variable PY2
- changed:
function factorize(values, sort=…, order=…, na_sentinel=…) → function factorize(values, sort=…, order=…, na_sentinel=…, size_hint=…)
- added:
class AccessorProperty(object) - added:
constructor AccessorProperty(accessor_cls, construct_accessor) - added:
field IndexOpsMixin.str
- changed:
method Categorical.fillna(fill_value=…, method=…, limit=…, **kwargs) → method Categorical.fillna(value=…, method=…, limit=…) - changed:
method Categorical.order(inplace=…, ascending=…, na_position=…, **kwargs) → method Categorical.order(inplace=…, ascending=…, na_position=…) - changed:
method Categorical.sort(inplace=…, ascending=…, na_position=…, **kwargs) → method Categorical.sort(inplace=…, ascending=…, na_position=…) - added:
function maybe_to_categorical(array) - added:
method Categorical.as_ordered(inplace=…) - added:
method Categorical.as_unordered(inplace=…) - added:
method Categorical.astype(dtype) - added:
method Categorical.check_for_ordered(op) - added:
method Categorical.dropna() - added:
method Categorical.is_dtype_equal(other) - added:
method Categorical.itemsize() - added:
method Categorical.repeat(repeats) - added:
method Categorical.set_ordered(value, inplace=…) - added:
method Categorical.size() - added:
method Categorical.value_counts(dropna=…)
- changed:
function interpolate_1d(xvalues, yvalues, method=…, limit=…, fill_value=…, bounds_error=…, **kwargs) → function interpolate_1d(xvalues, yvalues, method=…, limit=…, fill_value=…, bounds_error=…, order=…) - changed:
function pprint_thing(thing, _nest_lvl=…, escape_chars=…, default_escapes=…, quote_strings=…) → function pprint_thing(thing, _nest_lvl=…, escape_chars=…, default_escapes=…, quote_strings=…, max_seq_items=…) - added:
class AbstractMethodError(NotImplementedError) - added:
constructor AbstractMethodError(class_instance) - added:
function is_any_int_dtype(arr_or_dtype) - added:
function is_bool_indexer(key) - added:
function is_categorical(array) - added:
function is_datetime_or_timedelta_dtype(arr_or_dtype) - added:
function is_datetimelike(arr) - added:
function is_dtype_equal(source, target) - added:
function is_floating_dtype(arr_or_dtype) - added:
function is_int_or_datetime_dtype(arr_or_dtype) - added:
function is_null_datelike_scalar(other) - added:
function is_null_slice(obj) - added:
variable ABCCategoricalIndex - added:
variable ABCIndexClass
- changed:
constructor CSVFormatter(obj, path_or_buf=…, sep=…, na_rep=…, float_format=…, cols=…, header=…, index=…, index_label=…, mode=…, nanRep=…, encoding=…, quoting=…, line_terminator=…, chunksize=…, engine=…, tupleize_cols=…, quotechar=…, date_format=…, doublequote=…, escapechar=…) → constructor CSVFormatter(obj, path_or_buf=…, sep=…, na_rep=…, float_format=…, cols=…, header=…, index=…, index_label=…, mode=…, nanRep=…, encoding=…, quoting=…, line_terminator=…, chunksize=…, engine=…, tupleize_cols=…, quotechar=…, date_format=…, doublequote=…, escapechar=…, decimal=…) - changed:
constructor HTMLFormatter(formatter, classes=…, max_rows=…, max_cols=…) → constructor HTMLFormatter(formatter, classes=…, max_rows=…, max_cols=…, notebook=…) - changed:
constructor SeriesFormatter(series, buf=…, header=…, length=…, na_rep=…, name=…, float_format=…, dtype=…) → constructor SeriesFormatter(series, buf=…, length=…, header=…, na_rep=…, name=…, float_format=…, dtype=…, max_rows=…) - changed:
method DataFrameFormatter.to_html(classes=…) → method DataFrameFormatter.to_html(classes=…, notebook=…)
- changed:
method DataFrame.diff(periods=…) → method DataFrame.diff(periods=…, axis=…) - changed:
method DataFrame.to_csv(path_or_buf=…, sep=…, na_rep=…, float_format=…, columns=…, header=…, index=…, index_label=…, mode=…, encoding=…, quoting=…, quotechar=…, line_terminator=…, chunksize=…, tupleize_cols=…, date_format=…, doublequote=…, escapechar=…, **kwds) → method DataFrame.to_csv(path_or_buf=…, sep=…, na_rep=…, float_format=…, columns=…, header=…, index=…, index_label=…, mode=…, encoding=…, quoting=…, quotechar=…, line_terminator=…, chunksize=…, tupleize_cols=…, date_format=…, doublequote=…, escapechar=…, decimal=…, **kwds) - changed:
method DataFrame.to_html(buf=…, columns=…, col_space=…, colSpace=…, header=…, index=…, na_rep=…, formatters=…, float_format=…, sparsify=…, index_names=…, justify=…, bold_rows=…, classes=…, escape=…, max_rows=…, max_cols=…, show_dimensions=…) → method DataFrame.to_html(buf=…, columns=…, col_space=…, colSpace=…, header=…, index=…, na_rep=…, formatters=…, float_format=…, sparsify=…, index_names=…, justify=…, bold_rows=…, classes=…, escape=…, max_rows=…, max_cols=…, show_dimensions=…, notebook=…) - added:
method DataFrame.assign(**kwargs) - added:
method DataFrame.fillna(value=…, method=…, axis=…, inplace=…, limit=…, downcast=…, **kwargs) - added:
method DataFrame.shift(periods=…, freq=…, axis=…, **kwargs)
- changed:
method NDFrame.astype(dtype, copy=…, raise_on_error=…) → method NDFrame.astype(dtype, copy=…, raise_on_error=…, **kwargs) - changed:
method NDFrame.clip(lower=…, upper=…, out=…) → method NDFrame.clip(lower=…, upper=…, out=…, axis=…) - changed:
method NDFrame.clip_lower(threshold) → method NDFrame.clip_lower(threshold, axis=…) - changed:
method NDFrame.clip_upper(threshold) → method NDFrame.clip_upper(threshold, axis=…) - changed:
method NDFrame.drop(labels, axis=…, level=…, inplace=…, **kwargs) → method NDFrame.drop(labels, axis=…, level=…, inplace=…, errors=…) - changed:
method NDFrame.mask(cond) → method NDFrame.mask(cond, other=…, inplace=…, axis=…, level=…, try_cast=…, raise_on_error=…) - changed:
method NDFrame.pct_change(periods=…, fill_method=…, limit=…, freq=…, **kwds) → method NDFrame.pct_change(periods=…, fill_method=…, limit=…, freq=…, **kwargs) - changed:
method NDFrame.shift(periods=…, freq=…, axis=…, **kwds) → method NDFrame.shift(periods=…, freq=…, axis=…, **kwargs) - changed:
method NDFrame.slice_shift(periods=…, axis=…, **kwds) → method NDFrame.slice_shift(periods=…, axis=…) - changed:
method NDFrame.tshift(periods=…, freq=…, axis=…, **kwds) → method NDFrame.tshift(periods=…, freq=…, axis=…, **kwargs) - added:
method NDFrame.pipe(func, *args, **kwargs) - added:
method NDFrame.sample(n=…, frac=…, replace=…, weights=…, random_state=…, axis=…)
- removed:
property Grouping.groups - changed:
function get_group_index(label_list, shape) → function get_group_index(labels, shape, sort, xnull) - changed:
method GroupBy.cumcount(**kwargs) → method GroupBy.cumcount(ascending=…) - added:
function decons_obs_group_ids(comp_ids, obs_ids, shape, labels, xnull) - added:
method Grouping.groups() - added:
property BaseGrouper.recons_labels
- changed:
method Index.drop(labels) → method Index.drop(labels, errors=…) - changed:
method Index.get_indexer_non_unique(target, **kwargs) → method Index.get_indexer_non_unique(target) - changed:
method Index.get_loc(key) → method Index.get_loc(key, method=…) - changed:
method Index.get_slice_bound(label, side) → method Index.get_slice_bound(label, side, kind) - changed:
method Index.is_type_compatible(typ) → method Index.is_type_compatible(kind) - changed:
method Index.slice_indexer(start=…, end=…, step=…) → method Index.slice_indexer(start=…, end=…, step=…, kind=…) - changed:
method Index.slice_locs(start=…, end=…, step=…) → method Index.slice_locs(start=…, end=…, step=…, kind=…) - added:
method Index.is_categorical() - added:
property Index.has_duplicates
- added:
function check_bool_indexer(ax, key) - added:
function convert_from_missing_indexer_tuple(indexer, axes) - added:
function convert_missing_indexer(indexer) - added:
function convert_to_index_sliceable(obj, key) - added:
function is_index_slice(obj) - added:
function is_label_like(key) - added:
function is_list_like_indexer(key) - added:
function is_nested_tuple(tup, labels) - added:
function length_of_indexer(indexer, target=…) - added:
function maybe_convert_indices(indices, n) - added:
function maybe_convert_ix(*args) - added:
function maybe_droplevels(index, key) - added:
function need_slice(obj)
- changed:
method Block.astype(dtype, copy=…, raise_on_error=…, values=…) → method Block.astype(dtype, copy=…, raise_on_error=…, values=…, **kwargs) - changed:
method Block.diff(n) → method Block.diff(n, axis=…) - changed:
method Block.to_native_types(slicer=…, na_rep=…, **kwargs) → method Block.to_native_types(slicer=…, na_rep=…, quoting=…, **kwargs) - changed:
method CategoricalBlock.to_native_types(slicer=…, na_rep=…, **kwargs) → method CategoricalBlock.to_native_types(slicer=…, na_rep=…, quoting=…, **kwargs) - changed:
method DatetimeBlock.to_native_types(slicer=…, na_rep=…, date_format=…, **kwargs) → method DatetimeBlock.to_native_types(slicer=…, na_rep=…, date_format=…, quoting=…, **kwargs) - changed:
method FloatBlock.to_native_types(slicer=…, na_rep=…, float_format=…, **kwargs) → method FloatBlock.to_native_types(slicer=…, na_rep=…, float_format=…, decimal=…, quoting=…, **kwargs) - changed:
method TimeDeltaBlock.to_native_types(slicer=…, na_rep=…, **kwargs) → method TimeDeltaBlock.to_native_types(slicer=…, na_rep=…, quoting=…, **kwargs)
- changed:
method Panel.dropna(axis=…, how=…, inplace=…, **kwargs) → method Panel.dropna(axis=…, how=…, inplace=…) - added:
method Panel.fillna(value=…, method=…, axis=…, inplace=…, limit=…, downcast=…, **kwargs)
- removed:
function convert_dummies(data, cat_variables, prefix_sep=…) - changed:
function get_dummies(data, prefix=…, prefix_sep=…, dummy_na=…, columns=…) → function get_dummies(data, prefix=…, prefix_sep=…, dummy_na=…, columns=…, sparse=…)
- removed:
method Series.cat() - removed:
method Series.dt() - removed:
method Series.str() - changed:
method Series.autocorr() → method Series.autocorr(lag=…) - changed:
method Series.to_csv(path, index=…, sep=…, na_rep=…, float_format=…, header=…, index_label=…, mode=…, nanRep=…, encoding=…, date_format=…) → method Series.to_csv(path, index=…, sep=…, na_rep=…, float_format=…, header=…, index_label=…, mode=…, nanRep=…, encoding=…, date_format=…, decimal=…) - changed:
method Series.to_string(buf=…, na_rep=…, float_format=…, length=…, dtype=…, name=…) → method Series.to_string(buf=…, na_rep=…, float_format=…, header=…, length=…, dtype=…, name=…, max_rows=…) - added:
field Series.cat - added:
field Series.dt - added:
method Series.fillna(value=…, method=…, axis=…, inplace=…, limit=…, downcast=…, **kwargs) - added:
method Series.shift(periods=…, freq=…, axis=…, **kwargs)
- removed:
field StringMethods.extract - removed:
function str_center(arr, width) - removed:
function str_len(arr) - removed:
function str_lower(arr) - removed:
function str_lstrip(arr, to_strip=…) - removed:
function str_rstrip(arr, to_strip=…) - removed:
function str_title(arr) - removed:
function str_upper(arr) - changed:
function str_pad(arr, width, side=…) → function str_pad(arr, width, side=…, fillchar=…) - changed:
function str_split(arr, pat=…, n=…, return_type=…) → function str_split(arr, pat=…, n=…) - changed:
function str_strip(arr, to_strip=…) → function str_strip(arr, to_strip=…, side=…) - changed:
method StringMethods.center(width) → method StringMethods.center(width, fillchar=…) - changed:
method StringMethods.pad(width, side=…) → method StringMethods.pad(width, side=…, fillchar=…) - changed:
method StringMethods.slice_replace(i=…, j=…) → method StringMethods.slice_replace(start=…, stop=…, repl=…) - changed:
method StringMethods.split(pat=…, n=…, return_type=…) → method StringMethods.split(pat=…, n=…, expand=…) - added:
field StringMethods.capitalize - added:
field StringMethods.isalnum - added:
field StringMethods.isalpha - added:
field StringMethods.isdecimal - added:
field StringMethods.isdigit - added:
field StringMethods.islower - added:
field StringMethods.isnumeric - added:
field StringMethods.isspace - added:
field StringMethods.istitle - added:
field StringMethods.isupper - added:
field StringMethods.swapcase - added:
function str_find(arr, sub, start=…, end=…, side=…) - added:
function str_index(arr, sub, start=…, end=…, side=…) - added:
function str_rsplit(arr, pat=…, n=…) - added:
function str_translate(arr, table, deletechars=…) - added:
method StringMethods.extract(pat, flags=…) - added:
method StringMethods.find(sub, start=…, end=…) - added:
method StringMethods.index(sub, start=…, end=…) - added:
method StringMethods.ljust(width, fillchar=…) - added:
method StringMethods.normalize(form) - added:
method StringMethods.partition(pat=…, expand=…) - added:
method StringMethods.rfind(sub, start=…, end=…) - added:
method StringMethods.rindex(sub, start=…, end=…) - added:
method StringMethods.rjust(width, fillchar=…) - added:
method StringMethods.rpartition(pat=…, expand=…) - added:
method StringMethods.rsplit(pat=…, n=…, expand=…) - added:
method StringMethods.translate(table, deletechars=…) - added:
method StringMethods.zfill(width)
- changed:
function get_data_yahoo(symbols=…, start=…, end=…, retry_count=…, pause=…, adjust_price=…, ret_index=…, chunksize=…) → function get_data_yahoo(symbols=…, start=…, end=…, retry_count=…, pause=…, adjust_price=…, ret_index=…, chunksize=…, interval=…)
- changed:
class GbqConnector → class GbqConnector(object)
- changed:
method AppendableTable.write_data_chunk(indexes, mask, values) → method AppendableTable.write_data_chunk(rows, indexes, mask, values) - added:
method DataIndexableCol.validate_names() - added:
method IndexCol.validate(handler, append, **kwargs) - added:
method IndexCol.validate_names()
- changed:
function get_schema(frame, name, flavor=…, keys=…, con=…) → function get_schema(frame, name, flavor=…, keys=…, con=…, dtype=…)
- changed:
constructor StataReader(path_or_buf, encoding=…) → constructor StataReader(path_or_buf, convert_dates=…, convert_categoricals=…, index=…, convert_missing=…, preserve_dtypes=…, columns=…, order_categoricals=…, encoding=…, chunksize=…) - changed:
function read_stata(filepath_or_buffer, convert_dates=…, convert_categoricals=…, encoding=…, index=…, convert_missing=…, preserve_dtypes=…, columns=…, order_categoricals=…) → function read_stata(filepath_or_buffer, convert_dates=…, convert_categoricals=…, encoding=…, index=…, convert_missing=…, preserve_dtypes=…, columns=…, order_categoricals=…, chunksize=…, iterator=…) - changed:
method StataReader.data(convert_dates=…, convert_categoricals=…, index=…, convert_missing=…, preserve_dtypes=…, columns=…, order_categoricals=…) → method StataReader.data(**kwargs) - added:
method StataReader.get_chunk(size=…) - added:
method StataReader.read(nrows=…, convert_dates=…, convert_categoricals=…, index=…, convert_missing=…, preserve_dtypes=…, columns=…, order_categoricals=…)
- removed:
function dict_to_manager(sdict, columns, index) - added:
function df_to_manager(sdf, columns, index)
- changed:
constructor SparsePanel(frames, items=…, major_axis=…, minor_axis=…, default_fill_value=…, default_kind=…, copy=…) → constructor SparsePanel(frames=…, items=…, major_axis=…, minor_axis=…, default_fill_value=…, default_kind=…, copy=…)
- changed:
constructor SparseSeries(data, index=…, sparse_index=…, kind=…, fill_value=…, name=…, dtype=…, copy=…, fastpath=…) → constructor SparseSeries(data=…, index=…, sparse_index=…, kind=…, fill_value=…, name=…, dtype=…, copy=…, fastpath=…) - added:
method SparseSeries.to_coo(row_levels=…, column_levels=…, sort_labels=…) - added:
static method SparseSeries.from_coo(A, dense_index=…)
- removed:
function value_range(df)
- added:
method DatetimeIndexOpsMixin.summary(name=…) - added:
property DatetimeIndexOpsMixin.freqstr
- added:
class CombinedDatetimelikeProperties(DatetimeProperties, TimedeltaProperties)
- removed:
method DatetimeIndex.summary(name=…) - removed:
property DatetimeIndex.freqstr - changed:
method DatetimeIndex.get_loc(key) → method DatetimeIndex.get_loc(key, method=…) - changed:
method DatetimeIndex.slice_indexer(start=…, end=…, step=…) → method DatetimeIndex.slice_indexer(start=…, end=…, step=…, kind=…) - added:
field DatetimeIndex.days_in_month - added:
field DatetimeIndex.daysinmonth
- added:
class BusinessHour(BusinessMixin, SingleConstructorOffset) - added:
constructor BusinessHour(n=…, normalize=…, **kwds) - added:
method BusinessHour.apply(other) - added:
method BusinessHour.onOffset(dt) - added:
method BusinessHour.rollback(dt) - added:
method BusinessHour.rollforward(dt)
- removed:
class Period(PandasObject) - removed:
constructor Period(value=…, freq=…, ordinal=…, year=…, month=…, quarter=…, day=…, hour=…, minute=…, second=…) - removed:
field Period.day - removed:
field Period.dayofweek - removed:
field Period.dayofyear - removed:
field Period.hour - removed:
field Period.minute - removed:
field Period.month - removed:
field Period.quarter - removed:
field Period.qyear - removed:
field Period.second - removed:
field Period.week - removed:
field Period.weekday - removed:
field Period.weekofyear - removed:
field Period.year - removed:
method Period.asfreq(freq, how=…) - removed:
method Period.strftime(fmt) - removed:
method Period.to_timestamp(freq=…, how=…, tz=…) - removed:
property Period.end_time - removed:
property Period.start_time - removed:
static method Period.now(freq=…) - changed:
method PeriodIndex.get_loc(key) → method PeriodIndex.get_loc(key, method=…) - added:
field PeriodIndex.days_in_month - added:
field PeriodIndex.daysinmonth - added:
method PeriodIndex.get_indexer(target, method=…, limit=…) - added:
method PeriodIndex.repeat(n)
- removed:
method TimedeltaIndex.summary(name=…) - removed:
property TimedeltaIndex.freqstr - removed:
property TimedeltaIndex.hours - removed:
property TimedeltaIndex.milliseconds - removed:
property TimedeltaIndex.minutes - changed:
method TimedeltaIndex.get_loc(key) → method TimedeltaIndex.get_loc(key, method=…)
- added:
class TablePlotter(object) - added:
constructor TablePlotter(cell_width=…, cell_height=…, font_size=…) - added:
method TablePlotter.plot(left, right, labels=…, vertical=…) - added:
variable col - added:
variable df1 - added:
variable df2 - added:
variable df3 - added:
variable idx - added:
variable p