Skip to content

CLN: change print to print() in docs #4972

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 24, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions doc/source/basics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ Thus, for example:
.. ipython::

In [0]: for col in df:
...: print col
...: print(col)
...:

iteritems
Expand All @@ -878,8 +878,8 @@ For example:
.. ipython::

In [0]: for item, frame in wp.iteritems():
...: print item
...: print frame
...: print(item)
...: print(frame)
...:


Expand All @@ -895,19 +895,19 @@ containing the data in each row:
.. ipython::

In [0]: for row_index, row in df2.iterrows():
...: print '%s\n%s' % (row_index, row)
...: print('%s\n%s' % (row_index, row))
...:

For instance, a contrived way to transpose the dataframe would be:

.. ipython:: python

df2 = DataFrame({'x': [1, 2, 3], 'y': [4, 5, 6]})
print df2
print df2.T
print(df2)
print(df2.T)

df2_t = DataFrame(dict((idx,values) for idx, values in df2.iterrows()))
print df2_t
print(df2_t)

.. note::

Expand All @@ -918,8 +918,8 @@ For instance, a contrived way to transpose the dataframe would be:

df_iter = DataFrame([[1, 1.0]], columns=['x', 'y'])
row = next(df_iter.iterrows())[1]
print row['x'].dtype
print df_iter['x'].dtype
print(row['x'].dtype)
print(df_iter['x'].dtype)

itertuples
~~~~~~~~~~
Expand All @@ -932,7 +932,8 @@ For instance,

.. ipython:: python

for r in df2.itertuples(): print r
for r in df2.itertuples():
print(r)

.. _basics.string_methods:

Expand Down
4 changes: 2 additions & 2 deletions doc/source/dsintro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ R package):
.. ipython:: python

baseball = read_csv('data/baseball.csv')
print baseball
print(baseball)

.. ipython:: python
:suppress:
Expand All @@ -599,7 +599,7 @@ DataFrame in tabular form, though it won't always fit the console width:

.. ipython:: python

print baseball.iloc[-20:, :12].to_string()
print(baseball.iloc[-20:, :12].to_string())

New since 0.10.0, wide DataFrames will now be printed across multiple rows by
default:
Expand Down
2 changes: 1 addition & 1 deletion doc/source/gotchas.rst
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ of the new set of columns rather than the original ones:

.. ipython:: python

print open('tmp.csv').read()
print(open('tmp.csv').read())

date_spec = {'nominal': [1, 2], 'actual': [1, 3]}
df = read_csv('tmp.csv', header=None,
Expand Down
8 changes: 4 additions & 4 deletions doc/source/groupby.rst
Original file line number Diff line number Diff line change
Expand Up @@ -282,17 +282,17 @@ natural and functions similarly to ``itertools.groupby``:
In [4]: grouped = df.groupby('A')

In [5]: for name, group in grouped:
...: print name
...: print group
...: print(name)
...: print(group)
...:

In the case of grouping by multiple keys, the group name will be a tuple:

.. ipython::

In [5]: for name, group in df.groupby(['A', 'B']):
...: print name
...: print group
...: print(name)
...: print(group)
...:

It's standard Python-fu but remember you can unpack the tuple in the for loop
Expand Down
18 changes: 9 additions & 9 deletions doc/source/indexing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1149,7 +1149,7 @@ and stop are **inclusive** in the label-based case:
.. ipython:: python

date1, date2 = dates[[2, 4]]
print date1, date2
print(date1, date2)
df.ix[date1:date2]
df['A'].ix[date1:date2]

Expand Down Expand Up @@ -1211,10 +1211,10 @@ scalar values, though setting arbitrary vectors is not yet supported:

df2 = df[:4]
df2['foo'] = 'bar'
print df2
print(df2)
df2.ix[2] = np.nan
print df2
print df2.dtypes
print(df2)
print(df2.dtypes)

.. _indexing.view_versus_copy:

Expand Down Expand Up @@ -1639,13 +1639,13 @@ instance:
midx = MultiIndex(levels=[['zero', 'one'], ['x','y']],
labels=[[1,1,0,0],[1,0,1,0]])
df = DataFrame(randn(4,2), index=midx)
print df
print(df)
df2 = df.mean(level=0)
print df2
print df2.reindex(df.index, level=0)
print(df2)
print(df2.reindex(df.index, level=0))
df_aligned, df2_aligned = df.align(df2, level=0)
print df_aligned
print df2_aligned
print(df_aligned)
print(df2_aligned)


The need for sortedness with :class:`~pandas.MultiIndex`
Expand Down
Loading