Skip to content

Commit 8ee0a89

Browse files
committed
ENH/CLN: refactor of common code from frame/panel to generic.py
axis creation routines now commonized under _setup_axes ENH: more methods added PERF: was missing multi-take opportunity in reindex was incorrectly passing to com._count_not_none doing an extra copy in certain cases BUG: reindex with called with no args will by default return a copy (fixed bug) ENH: moved filter and added axis arg moved where,mask,align TST: make reindex benchmarks longer CLN: fixed up names for creation in panelnd.py DOC: minor release notes changes ENH: initial commite - attempt to reengineer series to inherit from NDFrame rather than ndarray ENH: fixed SparseDataFrame constructor with scalar values reindex still broken removed refs to SparseSeries in internals (not all SparseArray) TST: more fixed TST: more fixes TST: more tests TST: fixed up indexing TST: more sparse fixes BUG: reindex with single block manager now correctly fills with a method BUG: fixed pickle I think BUG: fixed set in internals for sparse fixed boolean indexing iin series I thnk BUG: fixed printing and inclusion of sparse series in DataFrame (now keeps its type), converted to dense for printing CLN: took out SeriesIndex, now uses regular indexing properties BUG: fixed copy (was using series method, bad) block filling for datetimes now ok (was filling with NaT, not iNaT) NaN in boolean ops now correctly handled (was not working for Datetimes) BUG: fixed set_item in SparseFrame if only a scalar is passed (needed index) BUG: sparse join fixed, did I break something in merge? BUG: consolidated block slicing under _slice BUG: added Series to santize_array all numeric methods now call get_values() rather than values ENH: partial SparsePanel support ENH: reverted SparsePanel changes, save for later fixed up xs in SparseFrame BUG: SparsePanel was using an inherited as_matrix(), bad TST: fixed shift default in class creation wrapper is to not pass existing fillers added sanitize column for generalitiy fixed count (in series) CLN: modify core/expressions to use get_values() remove methods from SparseFrame (and use inherited): combine_first,icol,as_matrix,get_dtype_counts bug fix in core/internals/get_dtype_counts CLN: use _values_from_object instead of direct call to get_values() BUG: fixed set_value semantics, as it could possibily change the index BUG: fixed tseries/period indexing fixed some bugs showing up in 32-bit (in nanops) BUG: fix incorrect exception raised in indexing (on 32-bit) BUG: fixed get_merge_keys (add Series to ndarray testing) BUG: fixed pivot table maybe???x core/internals/_ref_locs will now set indexer if ref_items==items TST: apply_reduce in tests/test_frame still failing BUG: fixed getitem_boolean_object finally I think (was issue in set_value in Series) BUG: fixed putmasking mess in Series, now in core/internals BUG: more fixes BUG: fixed core/internals/replace as choking on input BUG: refixed groupby BUG: fix test_where in series BUG: fixed reindex on a sparse block (was not taking correctly) BUG: fixed sparse filling!!!!! BUG: fixed pivot, need to define __hash__ to raise TypeError in NDFrame BUG: downcast argument not in SparseBlock or sparse/frame.py for fillna BUG: fix apply_reduce? BUG: fixes in reduce.pyx to deal with reconstrucing a Series argument to the function if needed BUG: reducer now produces a Series with its index (to the called function) ols converts to_dense to avoid some issues ENH: fixed core/frame/apply to accept reduce argument (default True), to allow turning off the reduction attempt (to preserver the column character) if say self.values would change it BUG: finally fixed reducer? BUG: reduce on frame bug (showing in py3) BUG: ols not working with sparse TST: stats.tests.test_ols/test_wls is not testing for the correct version of statsmodels (fails on 32-bit) PTF TST: make sure to skip the test_wls if our version isn't enough PERF: some perf enhancements BUG: fix sparse/array/make_sparse to take objects and extract the arrays PERF: series construction now much faster PERF: improvements in core/internals MERGE: updated to master and merged in MERGE: more merging fixes PERF: fixed null tests to be MUCH faster PERF: improvements in series construction via from_array PERF: merge improvements by using _has_sparse in bms PERF: some improvements PERF: more internals optimizations CLN: Index now subclassed off of PandasObject BUG: fixed inheritence for core/index.py (Index), solves unicode issues BUG: some merge errors in sparse VB: modernize the sparse vb suite BUG: fixed merging by single item (was broker for sparse for some reason) names not propogating in Series constructor on _slice BUG: add name back to series constructor ENH: pickle compatibility for Series/SparseSeries prior to 0.12! ENH: added pickle_compat to common/load BUG: in core/series on fastpath and index is actually changed (e.g. its actually a datelike index, but is of type object), need to set the axis in the BlockManager BUG: _getitem__bool only is active for Index/Int64Index (issues with DatetimeIndex/PeriodIndex) so default to having it call (slower) __getitem__ COMPAT: py3 compat fixes TST: recover pickles in a particular order or names MERGE: fixup merging with 0.11.0 final BUG: set _subtyp in sparse (use main type of object) BUG: fixed mergig on need to reindex sparse BUG: fixed consolidation issue prior to merge BUG: construction of a series with another series odd bug BUG: fix series constructor when passed a dtype (and no copy) BUG: fixed sparse slicing via blocks (don't use a sparse block when slicing) BUG: fixed remaining sparse issue (SpareDataFrame was converting SparseArray incorrectly) BUG: dtypes in groupby nth fixed (converting on aggregation item_by_item) BUG: partial fix on groupby? BUG: restored groupby back to master (SeriesGrouper) BUG: more fixes on groupby BUG: fixed all groupbys! BUG: get_median in core/nanops.py complaining PERF: made constructions of SparseFrame have less redundant steps PERF: minor series perf improvement TST: trying to fix how_lambda in tseries/resample PTF PERF: addtl groupby multi_python perf improvements PERF: speeds up for Series.__getitem__ PERF: some perf on groupby..... added _block, _values in SingleBlockManager PERF: more reducer improvements BUG: fixed SeriesBinGrouper hopefully BUG: tseries/index.py was missing __str__ = __repr__
1 parent e52ff84 commit 8ee0a89

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+5179
-3988
lines changed

pandas/compat/pickle_compat.py

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
""" support pre 0.12 series pickle compatibility """
2+
3+
import sys
4+
import pickle
5+
import numpy as np
6+
import pandas
7+
from pandas.util import py3compat
8+
from pandas.core.series import Series
9+
from pandas.sparse.series import SparseSeries
10+
11+
def load_reduce(self):
12+
stack = self.stack
13+
args = stack.pop()
14+
func = stack[-1]
15+
if type(args[0]) is type:
16+
n = args[0].__name__
17+
if n == 'DeprecatedSeries':
18+
stack[-1] = object.__new__(Series)
19+
return
20+
elif n == 'DeprecatedSparseSeries':
21+
stack[-1] = object.__new__(SparseSeries)
22+
return
23+
24+
try:
25+
value = func(*args)
26+
except:
27+
print(sys.exc_info())
28+
print(func, args)
29+
raise
30+
31+
stack[-1] = value
32+
33+
if py3compat.PY3:
34+
class Unpickler(pickle._Unpickler):
35+
pass
36+
else:
37+
class Unpickler(pickle.Unpickler):
38+
pass
39+
40+
Unpickler.dispatch[pickle.REDUCE[0]] = load_reduce
41+
42+
def load(file):
43+
# try to load a compatibility pickle
44+
# fake the old class hierarchy
45+
# if it works, then return the new type objects
46+
47+
try:
48+
pandas.core.series.Series = DeprecatedSeries
49+
pandas.sparse.series.SparseSeries = DeprecatedSparseSeries
50+
with open(file,'rb') as fh:
51+
return Unpickler(fh).load()
52+
except:
53+
raise
54+
finally:
55+
pandas.core.series.Series = Series
56+
pandas.sparse.series.SparseSeries = SparseSeries
57+
58+
class DeprecatedSeries(Series, np.ndarray):
59+
pass
60+
61+
class DeprecatedSparseSeries(DeprecatedSeries):
62+
pass

pandas/core/algorithms.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def value_counts(values, sort=True, ascending=False, normalize=False):
186186
values = com._ensure_object(values)
187187
keys, counts = htable.value_count_object(values, mask)
188188

189-
result = Series(counts, index=keys)
189+
result = Series(counts, index=com._values_from_object(keys))
190190

191191
if sort:
192192
result.sort()

pandas/core/base.py

+24-2
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,38 @@
33
"""
44
from pandas import compat
55
import numpy as np
6+
from pandas.core import common as com
67

78
class StringMixin(object):
89
"""implements string methods so long as object defines a `__unicode__` method.
910
Handles Python2/3 compatibility transparently."""
1011
# side note - this could be made into a metaclass if more than one object nees
12+
def __str__(self):
13+
14+
class PandasObject(object):
15+
""" The base class for pandas objects """
16+
17+
#----------------------------------------------------------------------
18+
# Reconstruction
19+
20+
def save(self, path):
21+
com.save(self, path)
22+
23+
@classmethod
24+
def load(cls, path):
25+
return com.load(path)
26+
27+
#----------------------------------------------------------------------
28+
# Formatting
29+
30+
def __unicode__(self):
31+
raise NotImplementedError
32+
1133
def __str__(self):
1234
"""
13-
Return a string representation for a particular object.
35+
Return a string representation for a particular Object
1436
15-
Invoked by str(obj) in both py2/py3.
37+
Invoked by str(df) in both py2/py3.
1638
Yields Bytestring in Py2, Unicode String in py3.
1739
"""
1840

0 commit comments

Comments
 (0)