Skip to content

Commit

Permalink
Merge commit 'v0.9.1rc1-27-ge374f0f' into debian
Browse files Browse the repository at this point in the history
* commit 'v0.9.1rc1-27-ge374f0f': (52 commits)
  BUG: axes.color_cycle from mpl rcParams should not be joined as single string
  BUG: icol duplicate columns with integer sequence failure. close pandas-dev#2228
  TST: unit test for pandas-dev#2214
  BUG: coerce ndarray dtype to object when comparing series
  ENH: make vbench_suite/run_suite executable
  ENH: Use __file__ to determine REPO_PATH in vb_suite/suite.py
  BUG: 1 ** NA issue in computing new fill value in SparseSeries. close pandas-dev#2220
  BUG: make inplace semantics of DataFrame.where consistent. pandas-dev#2230
  BUG: fix internal error in constructing DataFrame.values with duplicate column names. close pandas-dev#2236
  added back mask method that does condition inversion added condition testing to where that raised ValueError on an invalid condition (e.g. not an ndarray like object) added tests for same
  in core/frame.py
  TST: getting column from and applying op to a df should commute
  TST: add dual ( x op y <-> y op x ) tests for arith operators
  BUG: Incorrect error message due to zero based levels. close pandas-dev#2226
  fixed file modes for core/frame.py, test/test_frame.py
  relaxed __setitem__ restriction on boolean indexing a frame on an equal sized frame
  in core/frame.py
  ENH: warn user when invoking to_dict() on df with non-unique columns
  BUG: modify df.iteritems to support duplicate column labels pandas-dev#2219
  TST: df.iteritems() should yield Series even with non-unique column labels
  ...
  • Loading branch information
yarikoptic committed Nov 14, 2012
2 parents 6654568 + e374f0f commit 5753e12
Show file tree
Hide file tree
Showing 32 changed files with 608 additions and 128 deletions.
12 changes: 11 additions & 1 deletion RELEASE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pandas 0.9.1
- New `top` and `bottom` options for handling NAs in rank (#1508, #2159)
- Add `where` and `mask` functions to DataFrame (#2109, #2151)
- Add `at_time` and `between_time` functions to DataFrame (#2149)
- Add flexible `pow` and `rpow` methods to DataFrame (#2190)

**API Changes**

Expand All @@ -55,6 +56,8 @@ pandas 0.9.1
- Make .drop(...) work with non-unique indexes (#2101)
- Improve performance of Series/DataFrame.diff (re: #2087)
- Support unary ~ (__invert__) in DataFrame (#2110)
- Turn off pandas-style tick locators and formatters (#2205)
- DataFrame[DataFrame] uses DataFrame.where to compute masked frame (#2230)

**Bug fixes**

Expand Down Expand Up @@ -92,7 +95,14 @@ pandas 0.9.1
- Fix Series and DataFrame.diff for integer dtypes (#2087, #2174)
- Fix bug when taking intersection of DatetimeIndex with empty index (#2129)
- Pass through timezone information when calling DataFrame.align (#2127)
- Properly sort when joining on datetime64 values (#2196)
- Fix indexing bug in which False/True were being coerced to 0/1 (#2199)
- Many unicode formatting fixes (#2201)
- Fix improper MultiIndex conversion issue when assigning
e.g. DataFrame.index (#2200)
- Fix conversion of mixed-type DataFrame to ndarray with dup columns (#2236)
- Fix duplicate columns issue (#2218, #2219)
- Fix SparseSeries.__pow__ issue with NA input (#2220)
pandas 0.9.0
============
Expand Down
37 changes: 36 additions & 1 deletion doc/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,33 @@ def upload_stable_pdf():
':/usr/share/nginx/pandas/pandas-docs/stable/'):
raise SystemExit('PDF upload to stable failed')

def upload_prev(ver, doc_root='./'):
'push a copy of older release to appropriate version directory'
local_dir = doc_root + 'build/html'
remote_dir = '/usr/share/nginx/pandas/pandas-docs/version/%s/' % ver
cmd = 'cd %s; rsync -avz . pandas@pandas.pydata.org:%s -essh'
cmd = cmd % (local_dir, remote_dir)
print cmd
if os.system(cmd):
raise SystemExit('Upload to %s from %s failed' % (remote_dir, local_dir))

local_dir = doc_root + 'build/latex'
pdf_cmd = 'cd %s; scp pandas.pdf pandas@pandas.pydata.org:%s'
pdf_cmd = pdf_cmd % (local_dir, remote_dir)
if os.system(pdf_cmd):
raise SystemExit('Upload PDF to %s from %s failed' % (ver, doc_root))

def build_prev(ver):
if os.system('git checkout v%s' % ver) != 1:
os.chdir('..')
os.system('python setup.py clean')
os.system('python setup.py build_ext --inplace')
os.chdir('doc')
os.system('python make.py clean')
os.system('python make.py html')
os.system('python make.py latex')
os.system('git checkout master')

def clean():
if os.path.exists('build'):
shutil.rmtree('build')
Expand Down Expand Up @@ -201,7 +228,15 @@ def _get_config():
# current_dir = os.getcwd()
# os.chdir(os.path.dirname(os.path.join(current_dir, __file__)))

if len(sys.argv)>1:
if len(sys.argv) > 2:
ftype = sys.argv[1]
ver = sys.argv[2]

if ftype == 'build_previous':
build_prev(ver)
if ftype == 'upload_previous':
upload_prev(ver)
elif len(sys.argv) > 1:
for arg in sys.argv[1:]:
func = funcd.get(arg)
if func is None:
Expand Down
1 change: 1 addition & 0 deletions doc/source/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Frequently Asked Questions (FAQ)
import matplotlib.pyplot as plt
plt.close('all')
.. _ref-scikits-migration:

Migrating from scikits.timeseries to pandas >= 0.8.0
----------------------------------------------------
Expand Down
10 changes: 10 additions & 0 deletions doc/source/related.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,13 @@ customizable by the user (so 5-minutely data is easier to do with pandas for
example).

We are aiming to merge these libraries together in the near future.

Progress:

- It has a collection of moving window statistics implemented in
`Bottleneck <http://pandas.pydata.org/developers.html#development-roadmap>`__
- `Outstanding issues <https://github.com/pydata/pandas/issues?labels=timeseries&milestone=&page=1&state=open>`__

Summarising, Pandas offers superior functionality due to its combination with the :py:class:`pandas.DataFrame`.

An introduction for former users of :mod:`scikits.timeseries` is provided in the :ref:`migration guide <ref-scikits-migration>`.
5 changes: 4 additions & 1 deletion doc/source/v0.9.1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ New features
parse_cols='A:D')


- Added option to disable pandas-style tick locators and formatters
using `series.plot(x_compat=True)` or `pandas.plot_params['x_compat'] =
True` (GH2205_)
- Existing TimeSeries methods `at_time` and `between_time` were added to
DataFrame (GH2149_)
- DataFrame.dot can now accept ndarrays (GH2042_)
Expand Down Expand Up @@ -122,6 +125,7 @@ on GitHub for a complete list.
.. _GH2124: https://github.com/pydata/pandas/issues/2124
.. _GH2110: https://github.com/pydata/pandas/issues/2110
.. _GH2184: https://github.com/pydata/pandas/issues/2184
.. _GH2205: https://github.com/pydata/pandas/issues/2205

.. _GH2181: https://github.com/pydata/pandas/issues/2181
.. _GH2180: https://github.com/pydata/pandas/issues/2180
Expand Down Expand Up @@ -197,4 +201,3 @@ on GitHub for a complete list.
.. _GH1959: https://github.com/pydata/pandas/issues/1959
.. _GH1890: https://github.com/pydata/pandas/issues/1890
.. _GH1555: https://github.com/pydata/pandas/issues/1555

48 changes: 46 additions & 2 deletions doc/source/visualization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ To plot data on a secondary y-axis, use the ``secondary_y`` keyword:
Selective Plotting on Secondary Y-axis
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To plot some columns in a DataFrame, give the column names to the `secondary_y`
To plot some columns in a DataFrame, give the column names to the ``secondary_y``
keyword:

.. ipython:: python
Expand All @@ -135,7 +135,7 @@ keyword:
Note that the columns plotted on the secondary y-axis is automatically marked
with "(right)" in the legend. To turn off the automatic marking, use the
`mark_right=False` keyword:
``mark_right=False`` keyword:

.. ipython:: python
Expand All @@ -145,6 +145,50 @@ with "(right)" in the legend. To turn off the automatic marking, use the
df.plot(secondary_y=['A', 'B'], mark_right=False)
Suppressing tick resolution adjustment
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Pandas includes automatically tick resolution adjustment for regular frequency
time-series data. For limited cases where pandas cannot infer the frequency
information (e.g., in an externally created ``twinx``), you can choose to
suppress this behavior for alignment purposes.

Here is the default behavior, notice how the x-axis tick labelling is performed:

.. ipython:: python
plt.figure()
@savefig ser_plot_suppress.png width=4.5in
df.A.plot()
Using the ``x_compat`` parameter, you can suppress this bevahior:

.. ipython:: python
plt.figure()
@savefig ser_plot_suppress_parm.png width=4.5in
df.A.plot(x_compat=True)
If you have more than one plot that needs to be suppressed, the ``use`` method
in ``pandas.plot_params`` can be used in a `with statement`:

.. ipython:: python
import pandas as pd
plt.figure()
@savefig ser_plot_suppress_context.png width=4.5in
with pd.plot_params.use('x_compat', True):
df.A.plot(color='r')
df.B.plot(color='g')
df.C.plot(color='b')
Targeting different subplots
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
2 changes: 1 addition & 1 deletion pandas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@
from pandas.tools.describe import value_range
from pandas.tools.merge import merge, concat, ordered_merge
from pandas.tools.pivot import pivot_table, crosstab
from pandas.tools.plotting import scatter_matrix
from pandas.tools.plotting import scatter_matrix, plot_params
from pandas.tools.tile import cut, qcut
10 changes: 10 additions & 0 deletions pandas/core/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,13 @@ def is_integer_dtype(arr_or_dtype):
(issubclass(tipo, np.datetime64) or
issubclass(tipo, np.timedelta64)))

def _is_int_or_datetime_dtype(arr_or_dtype):
# also timedelta64
if isinstance(arr_or_dtype, np.dtype):
tipo = arr_or_dtype.type
else:
tipo = arr_or_dtype.dtype.type
return issubclass(tipo, np.integer)

def is_datetime64_dtype(arr_or_dtype):
if isinstance(arr_or_dtype, np.dtype):
Expand Down Expand Up @@ -1140,6 +1147,9 @@ def pprint_thing(thing, _nest_lvl=0):
from pandas.core.format import print_config
if thing is None:
result = ''
elif (py3compat.PY3 and hasattr(thing,'__next__')) or \
hasattr(thing,'next'):
return unicode(thing)
elif (isinstance(thing, dict) and
_nest_lvl < print_config.pprint_nest_depth):
result = _pprint_dict(thing, _nest_lvl)
Expand Down
14 changes: 4 additions & 10 deletions pandas/core/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,8 @@ def to_string(self, force_unicode=False):
if len(frame.columns) == 0 or len(frame.index) == 0:
info_line = (u'Empty %s\nColumns: %s\nIndex: %s'
% (type(self.frame).__name__,
frame.columns, frame.index))
com.pprint_thing(frame.columns),
com.pprint_thing(frame.index)))
text = info_line
else:
strcols = self._to_str_columns(force_unicode)
Expand Down Expand Up @@ -405,13 +406,6 @@ def _get_column_name_list(self):
names.append('' if columns.name is None else columns.name)
return names


def _str(x):
if not isinstance(x, basestring):
return str(x)
return x


class HTMLFormatter(object):

indent_delta = 2
Expand All @@ -436,7 +430,7 @@ def _maybe_bold_row(x):
self._maybe_bold_row = _maybe_bold_row

def write(self, s, indent=0):
self.elements.append(' ' * indent + _str(s))
self.elements.append(' ' * indent + com.pprint_thing(s))

def write_th(self, s, indent=0, tags=None):
return self._write_cell(s, kind='th', indent=indent, tags=tags)
Expand All @@ -449,7 +443,7 @@ def _write_cell(self, s, kind='td', indent=0, tags=None):
start_tag = '<%s %s>' % (kind, tags)
else:
start_tag = '<%s>' % kind
self.write('%s%s</%s>' % (start_tag, _str(s), kind), indent)
self.write('%s%s</%s>' % (start_tag, com.pprint_thing(s), kind), indent)

def write_tr(self, line, indent=0, indent_delta=4, header=False,
align=None, tags=None):
Expand Down
Loading

0 comments on commit 5753e12

Please sign in to comment.