Skip to content

Commit

Permalink
FIX: revert docs and fix for py3 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Aug 1, 2013
1 parent 9563141 commit ff52cbb
Show file tree
Hide file tree
Showing 36 changed files with 581 additions and 430 deletions.
2 changes: 1 addition & 1 deletion ci/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

echo "inside $0"

if [ x"$LOCALE_OVERRIDE" != x"" ]; then
if [ -n "$LOCALE_OVERRIDE" ]; then
export LC_ALL="$LOCALE_OVERRIDE";
echo "Setting LC_ALL to $LOCALE_OVERRIDE"
(cd /; python -c 'import pandas; print("pandas detected console encoding: %s" % pandas.get_option("display.encoding"))')
Expand Down
1 change: 0 additions & 1 deletion doc/plots/stats/moment_plots.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from pandas.compat import range
import numpy as np

import matplotlib.pyplot as plt
Expand Down
5 changes: 3 additions & 2 deletions doc/source/10min.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
randint = np.random.randint
np.set_printoptions(precision=4, suppress=True)
options.display.mpl_style='default'
from pandas.compat import lrange, lzip
#### portions of this were borrowed from the
#### Pandas cheatsheet
Expand Down Expand Up @@ -64,7 +65,7 @@ Creating a ``DataFrame`` by passing a dict of objects that can be converted to s
df2 = pd.DataFrame({ 'A' : 1.,
'B' : pd.Timestamp('20130102'),
'C' : pd.Series(1,index=range(4),dtype='float32'),
'C' : pd.Series(1,index=lrange(4),dtype='float32'),
'D' : np.array([3] * 4,dtype='int32'),
'E' : 'foo' })
df2
Expand Down Expand Up @@ -510,7 +511,7 @@ Stack

.. ipython:: python
tuples = zip(*[['bar', 'bar', 'baz', 'baz',
tuples = lzip(*[['bar', 'bar', 'baz', 'baz',
'foo', 'foo', 'qux', 'qux'],
['one', 'two', 'one', 'two',
'one', 'two', 'one', 'two']])
Expand Down
9 changes: 5 additions & 4 deletions doc/source/basics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from pandas import *
randn = np.random.randn
np.set_printoptions(precision=4, suppress=True)
from pandas.compat import lrange
==============================
Essential Basic Functionality
Expand Down Expand Up @@ -1090,16 +1091,16 @@ By default integer types are ``int64`` and float types are ``float64``,

.. ipython:: python
DataFrame([1,2],columns=['a']).dtypes
DataFrame({'a' : [1,2] }).dtypes
DataFrame({'a' : 1 }, index=range(2)).dtypes
DataFrame([1, 2], columns=['a']).dtypes
DataFrame({'a': [1, 2]}).dtypes
DataFrame({'a': 1 }, index=lrange(2)).dtypes
Numpy, however will choose *platform-dependent* types when creating arrays.
The following **WILL** result in ``int32`` on 32-bit platform.

.. ipython:: python
frame = DataFrame(np.array([1,2]))
frame = DataFrame(np.array([1, 2]))
upcasting
Expand Down
9 changes: 4 additions & 5 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import sys
import os
from pandas.compat import u

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down Expand Up @@ -64,8 +63,8 @@
master_doc = 'index'

# General information about the project.
project = u('pandas')
copyright = u('2008-2012, the pandas development team')
project = u'pandas'
copyright = u'2008-2012, the pandas development team'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down Expand Up @@ -212,8 +211,8 @@
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'pandas.tex',
u('pandas: powerful Python data analysis toolkit'),
u('Wes McKinney\n\& PyData Development Team'), 'manual'),
u'pandas: powerful Python data analysis toolkit',
u'Wes McKinney\n\& PyData Development Team', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down
14 changes: 6 additions & 8 deletions doc/source/cookbook.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ Indexing using both row labels and conditionals, see
<http://stackoverflow.com/questions/14725068/pandas-using-row-labels-in-boolean-indexing>`__

Use loc for label-oriented slicing and iloc positional slicing, see
`here
<https://github.com/pydata/pandas/issues/2904>`__
`here <https://github.com/pydata/pandas/issues/2904>`__

Extend a panel frame by transposing, adding a new dimension, and transposing back to the original dimensions, see
`here
Expand Down Expand Up @@ -280,7 +279,7 @@ The :ref:`Plotting <visualization>` docs.
<http://stackoverflow.com/questions/11067368/annotate-time-series-plot-in-matplotlib>`__

`Annotate a time-series plot #2
<http://stackoverflow.com/questions/17891493/annotating-points-from-a-pandas-dataframe-in-matplotlib-plot`__
<http://stackoverflow.com/questions/17891493/annotating-points-from-a-pandas-dataframe-in-matplotlib-plot>`__

Data In/Out
-----------
Expand All @@ -295,8 +294,7 @@ CSV

The :ref:`CSV <io.read_csv_table>` docs

`read_csv in action
<http://wesmckinney.com/blog/?p=635>`__
`read_csv in action <http://wesmckinney.com/blog/?p=635>`__

`appending to a csv
<http://stackoverflow.com/questions/17134942/pandas-dataframe-output-end-of-csv>`__
Expand All @@ -317,7 +315,7 @@ using that handle to read.
<http://stackoverflow.com/questions/15555005/get-inferred-dataframe-types-iteratively-using-chunksize>`__

`Dealing with bad lines
<https://github.com/pydata/pandas/issues/2886>`__
<http://github.com/pydata/pandas/issues/2886>`__

`Dealing with bad lines II
<http://nipunbatra.wordpress.com/2013/06/06/reading-unclean-data-csv-using-pandas/>`__
Expand Down Expand Up @@ -359,7 +357,7 @@ The :ref:`HDFStores <io.hdf5>` docs
<http://stackoverflow.com/questions/13926089/selecting-columns-from-pandas-hdfstore-table>`__

`Managing heteregenous data using a linked multiple table hierarchy
<https://github.com/pydata/pandas/issues/3032>`__
<http://github.com/pydata/pandas/issues/3032>`__

`Merging on-disk tables with millions of rows
<http://stackoverflow.com/questions/14614512/merging-two-tables-with-millions-of-rows-in-python/14617925#14617925>`__
Expand Down Expand Up @@ -420,7 +418,7 @@ Miscellaneous
The :ref:`Timedeltas <timeseries.timedeltas>` docs.

`Operating with timedeltas
<https://github.com/pydata/pandas/pull/2899>`__
<http://github.com/pydata/pandas/pull/2899>`__

`Create timedeltas with date differences
<http://stackoverflow.com/questions/15683588/iterating-through-a-pandas-dataframe>`__
Expand Down
8 changes: 4 additions & 4 deletions doc/source/enhancingperf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ Cython (Writing C extensions for pandas)

For many use cases writing pandas in pure python and numpy is sufficient. In some
computationally heavy applications however, it can be possible to achieve sizeable
speed-ups by offloading work to `cython <http://cython.org/>`_.
speed-ups by offloading work to `cython <http://cython.org/>`__.

This tutorial assumes you have refactored as much as possible in python, for example
trying to remove for loops and making use of numpy vectorization, it's always worth
optimising in python first.

This tutorial walks through a "typical" process of cythonizing a slow computation.
We use an `example from the cython documentation <http://docs.cython.org/src/quickstart/cythonize.html>`_
We use an `example from the cython documentation <http://docs.cython.org/src/quickstart/cythonize.html>`__
but in the context of pandas. Our final cythonized solution is around 100 times
faster than the pure python.

Expand Down Expand Up @@ -73,7 +73,7 @@ We achieve our result by by using ``apply`` (row-wise):
But clearly this isn't fast enough for us. Let's take a look and see where the
time is spent during this operation (limited to the most time consuming
four calls) using the `prun ipython magic function <http://ipython.org/ipython-doc/stable/api/generated/IPython.core.magics.execution.html#IPython.core.magics.execution.ExecutionMagics.prun>`_:
four calls) using the `prun ipython magic function <http://ipython.org/ipython-doc/stable/api/generated/IPython.core.magics.execution.html#IPython.core.magics.execution.ExecutionMagics.prun>`__:

.. ipython:: python
Expand Down Expand Up @@ -270,4 +270,4 @@ Further topics

- Loading C modules into cython.

Read more in the `cython docs <http://docs.cython.org/>`_.
Read more in the `cython docs <http://docs.cython.org/>`__.
7 changes: 4 additions & 3 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')
options.display.mpl_style='default'
from pandas.compat import lrange
.. _ref-repr-control:
Expand Down Expand Up @@ -65,7 +66,7 @@ operations implemented, most of them are very fast as well.
It's very possible however that certain functionality that would make your
life easier is missing. In that case you have several options:

1) Open an issue on `Github <https://github.com/pydata/pandas/issues/>`_ , explain your need and the sort of functionality you would like to see implemented.
1) Open an issue on `Github <https://github.com/pydata/pandas/issues/>`__ , explain your need and the sort of functionality you would like to see implemented.
2) Fork the repo, Implement the functionality yourself and open a PR
on Github.
3) Write a method that performs the operation you are interested in and
Expand All @@ -85,7 +86,7 @@ life easier is missing. In that case you have several options:
return [x for x in self.columns if 'foo' in x]
pd.DataFrame.just_foo_cols = just_foo_cols # monkey-patch the DataFrame class
df = pd.DataFrame([range(4)],columns= ["A","foo","foozball","bar"])
df = pd.DataFrame([lrange(4)],columns= ["A","foo","foozball","bar"])
df.just_foo_cols()
del pd.DataFrame.just_foo_cols # you can also remove the new method
Expand Down Expand Up @@ -258,7 +259,7 @@ using something similar to the following:

.. ipython:: python
x = np.array(range(10), '>i4') # big endian
x = np.array(lrange(10), '>i4') # big endian
newx = x.byteswap().newbyteorder() # force native byteorder
s = Series(newx)
Expand Down
7 changes: 4 additions & 3 deletions doc/source/gotchas.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from pandas import *
randn = np.random.randn
np.set_printoptions(precision=4, suppress=True)
from pandas.compat import lrange
*******************
Caveats and Gotchas
Expand Down Expand Up @@ -437,8 +438,8 @@ parse HTML tables in the top-level pandas io function ``read_html``.
# install the latest version of beautifulsoup4
pip install 'bzr+lp:beautifulsoup'
Note that you need `bzr <http://bazaar.canonical.com/en>`_ and `git
<http://git-scm.com>`_ installed to perform the last two operations.
Note that you need `bzr <http://bazaar.canonical.com/en>`__ and `git
<http://git-scm.com>`__ installed to perform the last two operations.

.. |svm| replace:: **strictly valid markup**
.. _svm: http://validator.w3.org/docs/help.html#validation_basics
Expand Down Expand Up @@ -466,7 +467,7 @@ using something similar to the following:

.. ipython:: python
x = np.array(range(10), '>i4') # big endian
x = np.array(lrange(10), '>i4') # big endian
newx = x.byteswap().newbyteorder() # force native byteorder
s = Series(newx)
Expand Down
6 changes: 4 additions & 2 deletions doc/source/groupby.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import matplotlib.pyplot as plt
plt.close('all')
options.display.mpl_style='default'
from pandas.compat import lzip
*****************************
Group By: split-apply-combine
Expand Down Expand Up @@ -198,9 +199,10 @@ natural to group by one of the levels of the hierarchy.
.. ipython:: python
:suppress:
arrays = [['bar', 'bar', 'baz', 'baz', 'foo', 'foo', 'qux', 'qux'],
['one', 'two', 'one', 'two', 'one', 'two', 'one', 'two']]
tuples = zip(*arrays)
tuples = lzip(*arrays)
tuples
index = MultiIndex.from_tuples(tuples, names=['first', 'second'])
s = Series(randn(8), index=index)
Expand Down Expand Up @@ -234,7 +236,7 @@ Also as of v0.6, grouping with multiple levels is supported.
arrays = [['bar', 'bar', 'baz', 'baz', 'foo', 'foo', 'qux', 'qux'],
['doo', 'doo', 'bee', 'bee', 'bop', 'bop', 'bop', 'bop'],
['one', 'two', 'one', 'two', 'one', 'two', 'one', 'two']]
tuples = zip(*arrays)
tuples = lzip(*arrays)
index = MultiIndex.from_tuples(tuples, names=['first', 'second', 'third'])
s = Series(randn(8), index=index)
Expand Down
13 changes: 7 additions & 6 deletions doc/source/indexing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
randn = np.random.randn
randint = np.random.randint
np.set_printoptions(precision=4, suppress=True)
from pandas.compat import lrange, lzip
***************************
Indexing and Selecting Data
Expand Down Expand Up @@ -293,7 +294,7 @@ The ``.iloc`` attribute is the primary access method. The following are valid in

.. ipython:: python
s1 = Series(np.random.randn(5),index=range(0,10,2))
s1 = Series(np.random.randn(5),index=lrange(0,10,2))
s1
s1.iloc[:3]
s1.iloc[3]
Expand All @@ -310,8 +311,8 @@ With a DataFrame
.. ipython:: python
df1 = DataFrame(np.random.randn(6,4),
index=range(0,12,2),
columns=range(0,8,2))
index=lrange(0,12,2),
columns=lrange(0,8,2))
df1
Select via integer slicing
Expand Down Expand Up @@ -786,7 +787,7 @@ numpy array. For instance,
.. ipython:: python
dflookup = DataFrame(np.random.rand(20,4), columns = ['A','B','C','D'])
dflookup.lookup(xrange(0,10,2), ['B','C','A','B','D'])
dflookup.lookup(lrange(0,10,2), ['B','C','A','B','D'])
Setting values in mixed-type DataFrame
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -896,7 +897,7 @@ display:

.. ipython:: python
index = Index(range(5), name='rows')
index = Index(lrange(5), name='rows')
columns = Index(['A', 'B', 'C'], name='cols')
df = DataFrame(np.random.randn(5, 3), index=index, columns=columns)
df
Expand Down Expand Up @@ -971,7 +972,7 @@ can think of ``MultiIndex`` an array of tuples where each tuple is unique. A
arrays = [['bar', 'bar', 'baz', 'baz', 'foo', 'foo', 'qux', 'qux'],
['one', 'two', 'one', 'two', 'one', 'two', 'one', 'two']]
tuples = zip(*arrays)
tuples = lzip(*arrays)
tuples
index = MultiIndex.from_tuples(tuples, names=['first', 'second'])
s = Series(randn(8), index=index)
Expand Down
10 changes: 5 additions & 5 deletions doc/source/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ ___________

Windows, all, stable, :ref:`all-platforms`, ``pip install pandas``
Mac, all, stable, :ref:`all-platforms`, ``pip install pandas``
Linux, Debian, stable, `official Debian repository <http://packages.debian.org/search?keywords=pandas&searchon=names&suite=all&section=all>`_ , ``sudo apt-get install python-pandas``
Linux, Debian & Ubuntu, unstable (latest packages), `NeuroDebian <http://neuro.debian.net/index.html#how-to-use-this-repository>`_ , ``sudo apt-get install python-pandas``
Linux, Ubuntu, stable, `official Ubuntu repository <http://packages.ubuntu.com/search?keywords=pandas&searchon=names&suite=all&section=all>`_ , ``sudo apt-get install python-pandas``
Linux, Ubuntu, unstable (daily builds), `PythonXY PPA <https://code.launchpad.net/~pythonxy/+archive/pythonxy-devel>`_; activate by: ``sudo add-apt-repository ppa:pythonxy/pythonxy-devel && sudo apt-get update``, ``sudo apt-get install python-pandas``
Linux, OpenSuse & Fedora, stable, `OpenSuse Repository <http://software.opensuse.org/package/python-pandas?search_term=pandas>`_ , ``zypper in python-pandas``
Linux, Debian, stable, `official Debian repository <http://packages.debian.org/search?keywords=pandas&searchon=names&suite=all&section=all>`__ , ``sudo apt-get install python-pandas``
Linux, Debian & Ubuntu, unstable (latest packages), `NeuroDebian <http://neuro.debian.net/index.html#how-to-use-this-repository>`__ , ``sudo apt-get install python-pandas``
Linux, Ubuntu, stable, `official Ubuntu repository <http://packages.ubuntu.com/search?keywords=pandas&searchon=names&suite=all&section=all>`__ , ``sudo apt-get install python-pandas``
Linux, Ubuntu, unstable (daily builds), `PythonXY PPA <https://code.launchpad.net/~pythonxy/+archive/pythonxy-devel>`__; activate by: ``sudo add-apt-repository ppa:pythonxy/pythonxy-devel && sudo apt-get update``, ``sudo apt-get install python-pandas``
Linux, OpenSuse & Fedora, stable, `OpenSuse Repository <http://software.opensuse.org/package/python-pandas?search_term=pandas>`__ , ``zypper in python-pandas``



Expand Down
Loading

0 comments on commit ff52cbb

Please sign in to comment.