Skip to content

DOC: Fixing some more warnings #26810

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 4 commits into from
Jun 14, 2019
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
2 changes: 2 additions & 0 deletions doc/source/user_guide/advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,8 @@ faster than fancy indexing.
%timeit arr[indexer]
%timeit arr.take(indexer, axis=0)

.. ipython:: python

ser = pd.Series(arr[:, 0])
%timeit ser.iloc[indexer]
%timeit ser.take(indexer)
Expand Down
5 changes: 0 additions & 5 deletions doc/source/user_guide/cookbook.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1260,24 +1260,19 @@ The `method` argument within `DataFrame.corr` can accept a callable in addition
n = len(x)
a = np.zeros(shape=(n, n))
b = np.zeros(shape=(n, n))

for i in range(n):
for j in range(i + 1, n):
a[i, j] = abs(x[i] - x[j])
b[i, j] = abs(y[i] - y[j])

a += a.T
b += b.T

a_bar = np.vstack([np.nanmean(a, axis=0)] * n)
b_bar = np.vstack([np.nanmean(b, axis=0)] * n)

A = a - a_bar - a_bar.T + np.full(shape=(n, n), fill_value=a_bar.mean())
B = b - b_bar - b_bar.T + np.full(shape=(n, n), fill_value=b_bar.mean())
cov_ab = np.sqrt(np.nansum(A * B)) / n
std_a = np.sqrt(np.sqrt(np.nansum(A**2)) / n)
std_b = np.sqrt(np.sqrt(np.nansum(B**2)) / n)

return cov_ab / std_a / std_b

df = pd.DataFrame(np.random.normal(size=(100, 3)))
Expand Down
4 changes: 4 additions & 0 deletions doc/source/user_guide/io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4703,6 +4703,7 @@ See the documentation for `pyarrow <https://arrow.apache.org/docs/python/>`__ an
Write to a parquet file.

.. ipython:: python
:okwarning:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, this is fine.

Although, we should actually make sure to install the latest version of pyarrow (where this is fixed), but for some reason conda installs 0.11 instead of 0.13


df.to_parquet('example_pa.parquet', engine='pyarrow')
df.to_parquet('example_fp.parquet', engine='fastparquet')
Expand All @@ -4720,6 +4721,7 @@ Read from a parquet file.
Read only certain columns of a parquet file.

.. ipython:: python
:okwarning:

result = pd.read_parquet('example_fp.parquet',
engine='fastparquet', columns=['a', 'b'])
Expand All @@ -4742,6 +4744,7 @@ Serializing a ``DataFrame`` to parquet may include the implicit index as one or
more columns in the output file. Thus, this code:

.. ipython:: python
:okwarning:

df = pd.DataFrame({'a': [1, 2], 'b': [3, 4]})
df.to_parquet('test.parquet', engine='pyarrow')
Expand All @@ -4758,6 +4761,7 @@ If you want to omit a dataframe's indexes when writing, pass ``index=False`` to
:func:`~pandas.DataFrame.to_parquet`:

.. ipython:: python
:okwarning:

df.to_parquet('test.parquet', index=False)

Expand Down
17 changes: 13 additions & 4 deletions doc/source/user_guide/missing_data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -348,14 +348,21 @@ that, by default, performs linear interpolation at missing data points.
np.random.seed(123456)
idx = pd.date_range('1/1/2000', periods=100, freq='BM')
ts = pd.Series(np.random.randn(100), index=idx)
ts[1:20] = np.nan
ts[1:5] = np.nan
ts[20:30] = np.nan
ts[60:80] = np.nan
ts = ts.cumsum()

.. ipython:: python

ts
ts.count()
@savefig series_before_interpolate.png
ts.plot()

.. ipython:: python

ts.interpolate()
ts.interpolate().count()

@savefig series_interpolate.png
Expand Down Expand Up @@ -435,9 +442,9 @@ Compare several methods:

np.random.seed(2)

ser = pd.Series(np.arange(1, 10.1, .25)**2 + np.random.randn(37))
bad = np.array([4, 13, 14, 15, 16, 17, 18, 20, 29])
ser[bad] = np.nan
ser = pd.Series(np.arange(1, 10.1, .25) ** 2 + np.random.randn(37))
missing = np.array([4, 13, 14, 15, 16, 17, 18, 20, 29])
ser[missing] = np.nan
methods = ['linear', 'quadratic', 'cubic']

df = pd.DataFrame({m: ser.interpolate(method=m) for m in methods})
Expand All @@ -451,6 +458,7 @@ You can mix pandas' ``reindex`` and ``interpolate`` methods to interpolate
at the new values.

.. ipython:: python
:okexcept:

ser = pd.Series(np.sort(np.random.uniform(size=100)))

Expand All @@ -476,6 +484,7 @@ filled since the last valid observation:

ser = pd.Series([np.nan, np.nan, 5, np.nan, np.nan,
np.nan, 13, np.nan, np.nan])
ser

# fill all consecutive values in a forward direction
ser.interpolate()
Expand Down
4 changes: 0 additions & 4 deletions doc/source/whatsnew/v0.17.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ v0.17.0 (October 9, 2015)

{{ header }}

.. ipython:: python
:suppress:



This is a major release from 0.16.2 and includes a small number of API changes, several new features,
enhancements, and performance improvements along with a large number of bug fixes. We recommend that all
Expand Down
4 changes: 0 additions & 4 deletions doc/source/whatsnew/v0.17.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ v0.17.1 (November 21, 2015)

{{ header }}

.. ipython:: python
:suppress:



.. note::

Expand Down