Skip to content

Commit e357ea1

Browse files
DOC: some general doc/sphinx fixes (pandas-dev#13740)
* DOC: fix stata versionadded * DOC: fix sphinx warnings/errors * DOC: replace old whatsnew io.data example with plain code-block * fix lint issues
1 parent fc16f1f commit e357ea1

File tree

8 files changed

+68
-38
lines changed

8 files changed

+68
-38
lines changed

doc/source/computation.rst

+7-9
Original file line numberDiff line numberDiff line change
@@ -428,15 +428,13 @@ Using a non-regular, but still monotonic index, rolling with an integer window d
428428

429429
.. ipython:: python
430430
431-
432-
dft = DataFrame({'B': [0, 1, 2, np.nan, 4]},
433-
index = pd.Index([pd.Timestamp('20130101 09:00:00'),
434-
pd.Timestamp('20130101 09:00:02'),
435-
pd.Timestamp('20130101 09:00:03'),
436-
pd.Timestamp('20130101 09:00:05'),
437-
pd.Timestamp('20130101 09:00:06')],
438-
name='foo'))
439-
431+
dft = pd.DataFrame({'B': [0, 1, 2, np.nan, 4]},
432+
index = pd.Index([pd.Timestamp('20130101 09:00:00'),
433+
pd.Timestamp('20130101 09:00:02'),
434+
pd.Timestamp('20130101 09:00:03'),
435+
pd.Timestamp('20130101 09:00:05'),
436+
pd.Timestamp('20130101 09:00:06')],
437+
name='foo'))
440438
dft
441439
dft.rolling(2).sum()
442440

doc/source/ecosystem.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Statistics and Machine Learning
2525
-------------------------------
2626

2727
`Statsmodels <http://www.statsmodels.org/>`__
28-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2929

3030
Statsmodels is the prominent python "statistics and econometrics library" and it has
3131
a long-standing special relationship with pandas. Statsmodels provides powerful statistics,
@@ -78,7 +78,7 @@ more advanced types of plots then those offered by pandas.
7878

7979
The `Vincent <https://github.com/wrobstory/vincent>`__ project leverages `Vega <https://github.com/trifacta/vega>`__
8080
(that in turn, leverages `d3 <http://d3js.org/>`__) to create
81-
plots. Although functional, as of Summer 2016 the Vincent project has not been updated
81+
plots. Although functional, as of Summer 2016 the Vincent project has not been updated
8282
in over two years and is `unlikely to receive further updates <https://github.com/wrobstory/vincent#2015-08-12-update>`__.
8383

8484
`IPython Vega <https://github.com/vega/ipyvega>`__
@@ -130,7 +130,7 @@ qgrid is "an interactive grid for sorting and filtering
130130
DataFrames in IPython Notebook" built with SlickGrid.
131131

132132
`Spyder <https://github.com/spyder-ide/spyder/>`__
133-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
133+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
134134

135135
Spyder is a cross-platform Qt-based open-source Python IDE with
136136
editing, testing, debugging, and introspection features.

doc/source/whatsnew/v0.15.1.txt

+39-7
Original file line numberDiff line numberDiff line change
@@ -144,14 +144,46 @@ API changes
144144

145145
Current behavior:
146146

147-
.. ipython:: python
148-
:okwarning:
147+
.. code-block:: ipython
149148

150-
from pandas.io.data import Options
151-
aapl = Options('aapl','yahoo')
152-
aapl.get_call_data().iloc[0:5,0:1]
153-
aapl.expiry_dates
154-
aapl.get_near_stock_price(expiry=aapl.expiry_dates[0:3]).iloc[0:5,0:1]
149+
In [17]: from pandas.io.data import Options
150+
151+
In [18]: aapl = Options('aapl','yahoo')
152+
153+
In [19]: aapl.get_call_data().iloc[0:5,0:1]
154+
Out[19]:
155+
Last
156+
Strike Expiry Type Symbol
157+
80 2014-11-14 call AAPL141114C00080000 29.05
158+
84 2014-11-14 call AAPL141114C00084000 24.80
159+
85 2014-11-14 call AAPL141114C00085000 24.05
160+
86 2014-11-14 call AAPL141114C00086000 22.76
161+
87 2014-11-14 call AAPL141114C00087000 21.74
162+
163+
In [20]: aapl.expiry_dates
164+
Out[20]:
165+
[datetime.date(2014, 11, 14),
166+
datetime.date(2014, 11, 22),
167+
datetime.date(2014, 11, 28),
168+
datetime.date(2014, 12, 5),
169+
datetime.date(2014, 12, 12),
170+
datetime.date(2014, 12, 20),
171+
datetime.date(2015, 1, 17),
172+
datetime.date(2015, 2, 20),
173+
datetime.date(2015, 4, 17),
174+
datetime.date(2015, 7, 17),
175+
datetime.date(2016, 1, 15),
176+
datetime.date(2017, 1, 20)]
177+
178+
In [21]: aapl.get_near_stock_price(expiry=aapl.expiry_dates[0:3]).iloc[0:5,0:1]
179+
Out[21]:
180+
Last
181+
Strike Expiry Type Symbol
182+
109 2014-11-22 call AAPL141122C00109000 1.48
183+
2014-11-28 call AAPL141128C00109000 1.79
184+
110 2014-11-14 call AAPL141114C00110000 0.55
185+
2014-11-22 call AAPL141122C00110000 1.02
186+
2014-11-28 call AAPL141128C00110000 1.32
155187

156188
See the Options documentation in :ref:`Remote Data <remote_data.yahoo_options>`
157189

doc/source/whatsnew/v0.17.0.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,7 @@ Deprecations
965965
- ``TimeSeries`` deprecated in favor of ``Series`` (note that this has been an alias since 0.13.0), (:issue:`10890`)
966966
- ``SparsePanel`` deprecated and will be removed in a future version (:issue:`11157`).
967967
- ``Series.is_time_series`` deprecated in favor of ``Series.index.is_all_dates`` (:issue:`11135`)
968-
- Legacy offsets (like ``'A@JAN'``) listed in :ref:`here <timeseries.legacyaliases>` are deprecated (note that this has been alias since 0.8.0), (:issue:`10878`)
968+
- Legacy offsets (like ``'A@JAN'``) are deprecated (note that this has been alias since 0.8.0) (:issue:`10878`)
969969
- ``WidePanel`` deprecated in favor of ``Panel``, ``LongPanel`` in favor of ``DataFrame`` (note these have been aliases since < 0.11.0), (:issue:`10892`)
970970
- ``DataFrame.convert_objects`` has been deprecated in favor of type-specific functions ``pd.to_datetime``, ``pd.to_timestamp`` and ``pd.to_numeric`` (new in 0.17.0) (:issue:`11133`).
971971

doc/source/whatsnew/v0.8.0.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ Other new features
134134
- Move to klib-based hash tables for indexing; better performance and less
135135
memory usage than Python's dict
136136
- Add first, last, min, max, and prod optimized GroupBy functions
137-
- New :ref:`ordered_merge <merging.ordered_merge>` function
137+
- New :ref:`ordered_merge <merging.merge_ordered>` function
138138
- Add flexible :ref:`comparison <basics.binop>` instance methods eq, ne, lt,
139139
gt, etc. to DataFrame, Series
140140
- Improve :ref:`scatter_matrix <visualization.scatter_matrix>` plotting
@@ -271,4 +271,3 @@ unique. In many cases it will no longer fail (some method like ``append`` still
271271
check for uniqueness unless disabled). However, all is not lost: you can
272272
inspect ``index.is_unique`` and raise an exception explicitly if it is
273273
``False`` or go to a different code branch.
274-

pandas/core/frame.py

+14-12
Original file line numberDiff line numberDiff line change
@@ -1476,28 +1476,28 @@ def to_stata(self, fname, convert_dates=None, write_index=True,
14761476
fname : str or buffer
14771477
String path of file-like object
14781478
convert_dates : dict
1479-
Dictionary mapping columns containing datetime types to stata internal
1480-
format to use when wirting the dates. Options are 'tc', 'td', 'tm',
1481-
'tw', 'th', 'tq', 'ty'. Column can be either an integer or a name.
1482-
Datetime columns that do not have a conversion type specified will be
1483-
converted to 'tc'. Raises NotImplementedError if a datetime column has
1484-
timezone information
1479+
Dictionary mapping columns containing datetime types to stata
1480+
internal format to use when wirting the dates. Options are 'tc',
1481+
'td', 'tm', 'tw', 'th', 'tq', 'ty'. Column can be either an integer
1482+
or a name. Datetime columns that do not have a conversion type
1483+
specified will be converted to 'tc'. Raises NotImplementedError if
1484+
a datetime column has timezone information
14851485
write_index : bool
14861486
Write the index to Stata dataset.
14871487
encoding : str
14881488
Default is latin-1. Unicode is not supported
14891489
byteorder : str
14901490
Can be ">", "<", "little", or "big". default is `sys.byteorder`
14911491
time_stamp : datetime
1492-
A datetime to use as file creation date. Default is the current time
1492+
A datetime to use as file creation date. Default is the current
1493+
time.
14931494
dataset_label : str
14941495
A label for the data set. Must be 80 characters or smaller.
1495-
1496-
.. versionadded:: 0.19.0
1497-
14981496
variable_labels : dict
1499-
Dictionary containing columns as keys and variable labels as values.
1500-
Each label must be 80 characters or smaller.
1497+
Dictionary containing columns as keys and variable labels as
1498+
values. Each label must be 80 characters or smaller.
1499+
1500+
.. versionadded:: 0.19.0
15011501
15021502
Raises
15031503
------
@@ -1510,6 +1510,8 @@ def to_stata(self, fname, convert_dates=None, write_index=True,
15101510
* Column listed in convert_dates is not in DataFrame
15111511
* Categorical label contains more than 32,000 characters
15121512
1513+
.. versionadded:: 0.19.0
1514+
15131515
Examples
15141516
--------
15151517
>>> writer = StataWriter('./data_file.dta', data)

pandas/io/stata.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1829,13 +1829,12 @@ class StataWriter(StataParser):
18291829
A datetime to use as file creation date. Default is the current time
18301830
dataset_label : str
18311831
A label for the data set. Must be 80 characters or smaller.
1832-
1833-
.. versionadded:: 0.19.0
1834-
18351832
variable_labels : dict
18361833
Dictionary containing columns as keys and variable labels as values.
18371834
Each label must be 80 characters or smaller.
18381835
1836+
.. versionadded:: 0.19.0
1837+
18391838
Returns
18401839
-------
18411840
writer : StataWriter instance

pandas/io/tests/test_stata.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1204,7 +1204,7 @@ def test_unsupported_datetype(self):
12041204
with tm.ensure_clean() as path:
12051205
original.to_stata(path, convert_dates={'dates': 'tC'})
12061206

1207-
dates = pd.date_range('1-1-1990',periods=3,tz='Asia/Hong_Kong')
1207+
dates = pd.date_range('1-1-1990', periods=3, tz='Asia/Hong_Kong')
12081208
original = pd.DataFrame({'nums': [1.0, 2.0, 3.0],
12091209
'strs': ['apple', 'banana', 'cherry'],
12101210
'dates': dates})

0 commit comments

Comments
 (0)