Skip to content

Commit ff52cbb

Browse files
committed
FIX: revert docs and fix for py3 compat
1 parent 9563141 commit ff52cbb

36 files changed

+581
-430
lines changed

ci/script.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
echo "inside $0"
44

5-
if [ x"$LOCALE_OVERRIDE" != x"" ]; then
5+
if [ -n "$LOCALE_OVERRIDE" ]; then
66
export LC_ALL="$LOCALE_OVERRIDE";
77
echo "Setting LC_ALL to $LOCALE_OVERRIDE"
88
(cd /; python -c 'import pandas; print("pandas detected console encoding: %s" % pandas.get_option("display.encoding"))')

doc/plots/stats/moment_plots.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from pandas.compat import range
21
import numpy as np
32

43
import matplotlib.pyplot as plt

doc/source/10min.rst

+3-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
randint = np.random.randint
1616
np.set_printoptions(precision=4, suppress=True)
1717
options.display.mpl_style='default'
18+
from pandas.compat import lrange, lzip
1819
1920
#### portions of this were borrowed from the
2021
#### Pandas cheatsheet
@@ -64,7 +65,7 @@ Creating a ``DataFrame`` by passing a dict of objects that can be converted to s
6465
6566
df2 = pd.DataFrame({ 'A' : 1.,
6667
'B' : pd.Timestamp('20130102'),
67-
'C' : pd.Series(1,index=range(4),dtype='float32'),
68+
'C' : pd.Series(1,index=lrange(4),dtype='float32'),
6869
'D' : np.array([3] * 4,dtype='int32'),
6970
'E' : 'foo' })
7071
df2
@@ -510,7 +511,7 @@ Stack
510511

511512
.. ipython:: python
512513
513-
tuples = zip(*[['bar', 'bar', 'baz', 'baz',
514+
tuples = lzip(*[['bar', 'bar', 'baz', 'baz',
514515
'foo', 'foo', 'qux', 'qux'],
515516
['one', 'two', 'one', 'two',
516517
'one', 'two', 'one', 'two']])

doc/source/basics.rst

+5-4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from pandas import *
99
randn = np.random.randn
1010
np.set_printoptions(precision=4, suppress=True)
11+
from pandas.compat import lrange
1112
1213
==============================
1314
Essential Basic Functionality
@@ -1090,16 +1091,16 @@ By default integer types are ``int64`` and float types are ``float64``,
10901091

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

11001101
.. ipython:: python
11011102
1102-
frame = DataFrame(np.array([1,2]))
1103+
frame = DataFrame(np.array([1, 2]))
11031104
11041105
11051106
upcasting

doc/source/conf.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
import sys
1414
import os
15-
from pandas.compat import u
1615

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

6665
# General information about the project.
67-
project = u('pandas')
68-
copyright = u('2008-2012, the pandas development team')
66+
project = u'pandas'
67+
copyright = u'2008-2012, the pandas development team'
6968

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

219218
# The name of an image file (relative to this directory) to place at the top of

doc/source/cookbook.rst

+6-8
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ Indexing using both row labels and conditionals, see
5656
<http://stackoverflow.com/questions/14725068/pandas-using-row-labels-in-boolean-indexing>`__
5757

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

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

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

285284
Data In/Out
286285
-----------
@@ -295,8 +294,7 @@ CSV
295294

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

298-
`read_csv in action
299-
<http://wesmckinney.com/blog/?p=635>`__
297+
`read_csv in action <http://wesmckinney.com/blog/?p=635>`__
300298

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

319317
`Dealing with bad lines
320-
<https://github.com/pydata/pandas/issues/2886>`__
318+
<http://github.com/pydata/pandas/issues/2886>`__
321319

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

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

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

422420
`Operating with timedeltas
423-
<https://github.com/pydata/pandas/pull/2899>`__
421+
<http://github.com/pydata/pandas/pull/2899>`__
424422

425423
`Create timedeltas with date differences
426424
<http://stackoverflow.com/questions/15683588/iterating-through-a-pandas-dataframe>`__

doc/source/enhancingperf.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ Cython (Writing C extensions for pandas)
2828

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

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

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

@@ -73,7 +73,7 @@ We achieve our result by by using ``apply`` (row-wise):
7373
7474
But clearly this isn't fast enough for us. Let's take a look and see where the
7575
time is spent during this operation (limited to the most time consuming
76-
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>`_:
76+
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>`__:
7777

7878
.. ipython:: python
7979
@@ -270,4 +270,4 @@ Further topics
270270

271271
- Loading C modules into cython.
272272

273-
Read more in the `cython docs <http://docs.cython.org/>`_.
273+
Read more in the `cython docs <http://docs.cython.org/>`__.

doc/source/faq.rst

+4-3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Frequently Asked Questions (FAQ)
2121
import matplotlib.pyplot as plt
2222
plt.close('all')
2323
options.display.mpl_style='default'
24+
from pandas.compat import lrange
2425
2526
2627
.. _ref-repr-control:
@@ -65,7 +66,7 @@ operations implemented, most of them are very fast as well.
6566
It's very possible however that certain functionality that would make your
6667
life easier is missing. In that case you have several options:
6768

68-
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.
69+
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.
6970
2) Fork the repo, Implement the functionality yourself and open a PR
7071
on Github.
7172
3) Write a method that performs the operation you are interested in and
@@ -85,7 +86,7 @@ life easier is missing. In that case you have several options:
8586
return [x for x in self.columns if 'foo' in x]
8687
8788
pd.DataFrame.just_foo_cols = just_foo_cols # monkey-patch the DataFrame class
88-
df = pd.DataFrame([range(4)],columns= ["A","foo","foozball","bar"])
89+
df = pd.DataFrame([lrange(4)],columns= ["A","foo","foozball","bar"])
8990
df.just_foo_cols()
9091
del pd.DataFrame.just_foo_cols # you can also remove the new method
9192
@@ -258,7 +259,7 @@ using something similar to the following:
258259

259260
.. ipython:: python
260261
261-
x = np.array(range(10), '>i4') # big endian
262+
x = np.array(lrange(10), '>i4') # big endian
262263
newx = x.byteswap().newbyteorder() # force native byteorder
263264
s = Series(newx)
264265

doc/source/gotchas.rst

+4-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from pandas import *
1010
randn = np.random.randn
1111
np.set_printoptions(precision=4, suppress=True)
12+
from pandas.compat import lrange
1213
1314
*******************
1415
Caveats and Gotchas
@@ -437,8 +438,8 @@ parse HTML tables in the top-level pandas io function ``read_html``.
437438
# install the latest version of beautifulsoup4
438439
pip install 'bzr+lp:beautifulsoup'
439440
440-
Note that you need `bzr <http://bazaar.canonical.com/en>`_ and `git
441-
<http://git-scm.com>`_ installed to perform the last two operations.
441+
Note that you need `bzr <http://bazaar.canonical.com/en>`__ and `git
442+
<http://git-scm.com>`__ installed to perform the last two operations.
442443

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

467468
.. ipython:: python
468469
469-
x = np.array(range(10), '>i4') # big endian
470+
x = np.array(lrange(10), '>i4') # big endian
470471
newx = x.byteswap().newbyteorder() # force native byteorder
471472
s = Series(newx)
472473

doc/source/groupby.rst

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import matplotlib.pyplot as plt
1313
plt.close('all')
1414
options.display.mpl_style='default'
15+
from pandas.compat import lzip
1516
1617
*****************************
1718
Group By: split-apply-combine
@@ -198,9 +199,10 @@ natural to group by one of the levels of the hierarchy.
198199
.. ipython:: python
199200
:suppress:
200201
202+
201203
arrays = [['bar', 'bar', 'baz', 'baz', 'foo', 'foo', 'qux', 'qux'],
202204
['one', 'two', 'one', 'two', 'one', 'two', 'one', 'two']]
203-
tuples = zip(*arrays)
205+
tuples = lzip(*arrays)
204206
tuples
205207
index = MultiIndex.from_tuples(tuples, names=['first', 'second'])
206208
s = Series(randn(8), index=index)
@@ -234,7 +236,7 @@ Also as of v0.6, grouping with multiple levels is supported.
234236
arrays = [['bar', 'bar', 'baz', 'baz', 'foo', 'foo', 'qux', 'qux'],
235237
['doo', 'doo', 'bee', 'bee', 'bop', 'bop', 'bop', 'bop'],
236238
['one', 'two', 'one', 'two', 'one', 'two', 'one', 'two']]
237-
tuples = zip(*arrays)
239+
tuples = lzip(*arrays)
238240
index = MultiIndex.from_tuples(tuples, names=['first', 'second', 'third'])
239241
s = Series(randn(8), index=index)
240242

doc/source/indexing.rst

+7-6
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
randn = np.random.randn
1414
randint = np.random.randint
1515
np.set_printoptions(precision=4, suppress=True)
16+
from pandas.compat import lrange, lzip
1617
1718
***************************
1819
Indexing and Selecting Data
@@ -293,7 +294,7 @@ The ``.iloc`` attribute is the primary access method. The following are valid in
293294

294295
.. ipython:: python
295296
296-
s1 = Series(np.random.randn(5),index=range(0,10,2))
297+
s1 = Series(np.random.randn(5),index=lrange(0,10,2))
297298
s1
298299
s1.iloc[:3]
299300
s1.iloc[3]
@@ -310,8 +311,8 @@ With a DataFrame
310311
.. ipython:: python
311312
312313
df1 = DataFrame(np.random.randn(6,4),
313-
index=range(0,12,2),
314-
columns=range(0,8,2))
314+
index=lrange(0,12,2),
315+
columns=lrange(0,8,2))
315316
df1
316317
317318
Select via integer slicing
@@ -786,7 +787,7 @@ numpy array. For instance,
786787
.. ipython:: python
787788
788789
dflookup = DataFrame(np.random.rand(20,4), columns = ['A','B','C','D'])
789-
dflookup.lookup(xrange(0,10,2), ['B','C','A','B','D'])
790+
dflookup.lookup(lrange(0,10,2), ['B','C','A','B','D'])
790791
791792
Setting values in mixed-type DataFrame
792793
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -896,7 +897,7 @@ display:
896897

897898
.. ipython:: python
898899
899-
index = Index(range(5), name='rows')
900+
index = Index(lrange(5), name='rows')
900901
columns = Index(['A', 'B', 'C'], name='cols')
901902
df = DataFrame(np.random.randn(5, 3), index=index, columns=columns)
902903
df
@@ -971,7 +972,7 @@ can think of ``MultiIndex`` an array of tuples where each tuple is unique. A
971972
972973
arrays = [['bar', 'bar', 'baz', 'baz', 'foo', 'foo', 'qux', 'qux'],
973974
['one', 'two', 'one', 'two', 'one', 'two', 'one', 'two']]
974-
tuples = zip(*arrays)
975+
tuples = lzip(*arrays)
975976
tuples
976977
index = MultiIndex.from_tuples(tuples, names=['first', 'second'])
977978
s = Series(randn(8), index=index)

doc/source/install.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ ___________
4747

4848
Windows, all, stable, :ref:`all-platforms`, ``pip install pandas``
4949
Mac, all, stable, :ref:`all-platforms`, ``pip install pandas``
50-
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``
51-
Linux, Debian & Ubuntu, unstable (latest packages), `NeuroDebian <http://neuro.debian.net/index.html#how-to-use-this-repository>`_ , ``sudo apt-get install python-pandas``
52-
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``
53-
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``
54-
Linux, OpenSuse & Fedora, stable, `OpenSuse Repository <http://software.opensuse.org/package/python-pandas?search_term=pandas>`_ , ``zypper in python-pandas``
50+
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``
51+
Linux, Debian & Ubuntu, unstable (latest packages), `NeuroDebian <http://neuro.debian.net/index.html#how-to-use-this-repository>`__ , ``sudo apt-get install python-pandas``
52+
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``
53+
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``
54+
Linux, OpenSuse & Fedora, stable, `OpenSuse Repository <http://software.opensuse.org/package/python-pandas?search_term=pandas>`__ , ``zypper in python-pandas``
5555

5656

5757

0 commit comments

Comments
 (0)