Skip to content

Commit d6bbc55

Browse files
authored
Merge pull request #706 from bashtage/uniform-docs
DOC: Use a uniform docstring structure
2 parents 4694147 + e0247ba commit d6bbc55

15 files changed

+100
-63
lines changed

pandas_datareader/_utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ def _sanitize_dates(start, end):
2222
2323
Parameters
2424
----------
25-
start: str, int, date, datetime, timestamp
25+
start : str, int, date, datetime, Timestamp
2626
Desired start date
27-
end: str, int, date, datetime, timestamp
27+
end : str, int, date, datetime, Timestamp
2828
Desired end date
2929
"""
3030
if is_number(start):

pandas_datareader/av/time_series.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ class AVTimeSeriesReader(AlphaVantage):
1313
----------
1414
symbols : string
1515
Single stock symbol (ticker)
16-
start : string, int, date, datetime, timestamp
16+
start : string, int, date, datetime, Timestamp
1717
Starting date. Parses many different kind of date
1818
representations (e.g., 'JAN-01-2010', '1/1/10', 'Jan, 1, 1980'). Defaults to
1919
20 years before current date.
20-
end : string, int, date, datetime, timestamp
20+
end : string, int, date, datetime, Timestamp
2121
Ending date
2222
retry_count : int, default 3
2323
Number of times to retry query request.

pandas_datareader/base.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ class _BaseReader(object):
2828
----------
2929
symbols : {str, List[str]}
3030
String symbol of like of symbols
31-
start : string, int, date, datetime, timestamp
31+
start : string, int, date, datetime, Timestamp
3232
Starting date. Parses many different kind of date
3333
representations (e.g., 'JAN-01-2010', '1/1/10', 'Jan, 1, 1980')
34-
end : string, int, date, datetime, timestamp
34+
end : string, int, date, datetime, Timestamp
3535
Ending date
3636
retry_count : int, default 3
3737
Number of times to retry query request.
@@ -186,8 +186,14 @@ def _output_error(self, out):
186186
"""If necessary, a service can implement an interpreter for any non-200
187187
HTTP responses.
188188
189-
:param out: raw output from an HTTP request
190-
:return: boolean
189+
Parameters
190+
----------
191+
out: bytes
192+
The raw output from an HTTP request
193+
194+
Returns
195+
-------
196+
boolean
191197
"""
192198
return False
193199

pandas_datareader/data.py

+37-23
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,9 @@ def get_markets_iex(*args, **kwargs):
155155
156156
Reference: https://www.iextrading.com/developer/docs/#markets
157157
158-
:return: DataFrame
158+
Returns
159+
-------
160+
DataFrame
159161
"""
160162
from pandas_datareader.iex.market import MarketReader
161163

@@ -167,10 +169,12 @@ def get_dailysummary_iex(*args, **kwargs):
167169
Returns a summary of daily market volume statistics. Without parameters,
168170
this will return the most recent trading session by default.
169171
170-
:param start:
171-
A datetime object - the beginning of the date range.
172-
:param end:
173-
A datetime object - the end of the date range.
172+
Parameters
173+
----------
174+
start : string, int, date, datetime, Timestamp
175+
The beginning of the date range.
176+
end : string, int, date, datetime, Timestamp
177+
The end of the date range.
174178
175179
Reference: https://www.iextrading.com/developer/docs/#historical-daily
176180
@@ -188,12 +192,14 @@ def get_summary_iex(*args, **kwargs):
188192
In the absence of parameters, this will return month-to-date statistics.
189193
For ranges spanning multiple months, this will return one row per month.
190194
191-
:param start:
195+
start : string, int, date, datetime, Timestamp
192196
A datetime object - the beginning of the date range.
193-
:param end:
197+
end : string, int, date, datetime, Timestamp
194198
A datetime object - the end of the date range.
195199
196-
:return: DataFrame
200+
Returns
201+
-------
202+
DataFrame
197203
"""
198204
from pandas_datareader.iex.stats import MonthlySummaryReader
199205

@@ -223,7 +229,9 @@ def get_recent_iex(*args, **kwargs):
223229
224230
Reference: https://www.iextrading.com/developer/docs/#recent
225231
226-
:return: DataFrame
232+
Returns
233+
-------
234+
DataFrame
227235
"""
228236
from pandas_datareader.iex.stats import RecentReader
229237

@@ -249,19 +257,25 @@ def get_iex_book(*args, **kwargs):
249257
Returns an array of dictionaries with depth of book data from IEX for up to
250258
10 securities at a time. Returns a dictionary of the bid and ask books.
251259
252-
:param symbols:
260+
Parameters
261+
----------
262+
symbols : str, List[str]
253263
A string or list of strings of valid tickers
254-
:param service:
255-
'book': Live depth of book data
256-
'op-halt-status': Checks to see if the exchange has instituted a halt
257-
'security-event': Denotes individual security related event
258-
'ssr-status': Short Sale Price Test restrictions, per reg 201 of SHO
259-
'system-event': Relays current feed status (i.e. market open)
260-
'trades': Retrieves recent executions, trade size/price and flags
261-
'trade-breaks': Lists execution breaks for the current trading session
262-
'trading-status': Returns status and cause codes for securities
263-
264-
:return: Object
264+
service : str
265+
One of:
266+
267+
- 'book': Live depth of book data
268+
- 'op-halt-status': Checks to see if the exchange has instituted a halt
269+
- 'security-event': Denotes individual security related event
270+
- 'ssr-status': Short Sale Price Test restrictions, per reg 201 of SHO
271+
- 'system-event': Relays current feed status (i.e. market open)
272+
- 'trades': Retrieves recent executions, trade size/price and flags
273+
- 'trade-breaks': Lists execution breaks for the current trading session
274+
- 'trading-status': Returns status and cause codes for securities
275+
276+
Returns
277+
-------
278+
DataFrame
265279
"""
266280
return IEXDeep(*args, **kwargs).read()
267281

@@ -290,9 +304,9 @@ def DataReader(
290304
accept a list of names.
291305
data_source: {str, None}
292306
the data source ("iex", "fred", "ff")
293-
start : {datetime, None}
307+
start : string, int, date, datetime, Timestamp
294308
left boundary for range (defaults to 1/1/2010)
295-
end : {datetime, None}
309+
end : string, int, date, datetime, Timestamp
296310
right boundary for range (defaults to today)
297311
retry_count : {int, 3}
298312
Number of times to retry query request.

pandas_datareader/iex/__init__.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ def _output_error(self, out):
6464
"""If IEX returns a non-200 status code, we need to notify the user of
6565
the error returned.
6666
67-
:param out: Raw HTTP Output
67+
Parameters
68+
----------
69+
out: bytes
70+
The raw output from an HTTP request
6871
"""
6972
try:
7073
content = json.loads(out.text)
@@ -80,8 +83,14 @@ def _read_lines(self, out):
8083
"""IEX's output does not need anything complex, so we're overriding to
8184
use Pandas' default interpreter
8285
83-
:param out: Raw HTTP Output
84-
:return: DataFrame
86+
Parameters
87+
----------
88+
out: bytes
89+
The raw output from an HTTP request
90+
91+
Returns
92+
-------
93+
DataFrame
8594
"""
8695

8796
# IEX will return a blank line for invalid tickers:

pandas_datareader/iex/daily.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ class IEXDailyReader(_DailyBaseReader):
2727
symbols : string, array-like object (list, tuple, Series), or DataFrame
2828
Single stock symbol (ticker), array-like object of symbols or
2929
DataFrame with index containing stock symbols.
30-
start : string, int, date, datetime, timestamp
30+
start : string, int, date, datetime, Timestamp
3131
Starting date. Parses many different kind of date
3232
representations (e.g., 'JAN-01-2010', '1/1/10', 'Jan, 1, 1980'). Defaults to
3333
15 years before current date
34-
end : string, int, date, datetime, timestamp
34+
end : string, int, date, datetime, Timestamp
3535
Ending date
3636
retry_count : int, default 3
3737
Number of times to retry query request.

pandas_datareader/iex/deep.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,14 @@ def _read_lines(self, out):
5959
"""
6060
IEX depth of book data varies and shouldn't always be returned in a DF
6161
62-
:param out: Raw HTTP Output
63-
:return: DataFrame
62+
Parameters
63+
----------
64+
out: bytes
65+
The raw output from an HTTP request
66+
67+
Returns
68+
-------
69+
DataFrame
6470
"""
6571

6672
# Runs appropriate output functions per the service being accessed.

pandas_datareader/moex.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ class MoexReader(_DailyBaseReader):
1515
symbols : str, an array-like object (list, tuple, Series), or a DataFrame
1616
A single stock symbol (secid), an array-like object of symbols or
1717
a DataFrame with an index containing stock symbols.
18-
start : string, int, date, datetime, timestamp
18+
start : string, int, date, datetime, Timestamp
1919
Starting date. Parses many different kind of date
2020
representations (e.g., 'JAN-01-2010', '1/1/10', 'Jan, 1, 1980'). Defaults to
2121
20 years before current date.
22-
end : string, int, date, datetime, timestamp
22+
end : string, int, date, datetime, Timestamp
2323
Ending date
2424
retry_count : int, default 3
2525
The number of times to retry query request.

pandas_datareader/quandl.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ class QuandlReader(_DailyBaseReader):
2323
Beware of ambiguous symbols (different securities per country)!
2424
Note: Cannot use more than a single string because of the inflexible
2525
way the URL is composed of url and _get_params in the superclass
26-
start : string, int, date, datetime, timestamp
26+
start : string, int, date, datetime, Timestamp
2727
Starting date. Parses many different kind of date
2828
representations (e.g., 'JAN-01-2010', '1/1/10', 'Jan, 1, 1980'). Defaults to
2929
20 years before current date.
30-
end : string, int, date, datetime, timestamp
30+
end : string, int, date, datetime, Timestamp
3131
Ending date
3232
retry_count : int, default 3
3333
Number of times to retry query request.

pandas_datareader/stooq.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ class StooqDailyReader(_DailyBaseReader):
1212
symbols : string, array-like object (list, tuple, Series), or DataFrame
1313
Single stock symbol (ticker), array-like object of symbols or
1414
DataFrame with index containing stock symbols.
15-
start : string, int, date, datetime, timestamp
15+
start : string, int, date, datetime, Timestamp
1616
Starting date. Parses many different kind of date
1717
representations (e.g., 'JAN-01-2010', '1/1/10', 'Jan, 1, 1980'). Defaults to
1818
20 years before current date.
19-
end : string, int, date, datetime, timestamp
19+
end : string, int, date, datetime, Timestamp
2020
Ending date
2121
retry_count : int, default 3
2222
Number of times to retry query request.

pandas_datareader/tiingo.py

+10-9
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ class TiingoIEXHistoricalReader(_BaseReader):
3434
----------
3535
symbols : {str, List[str]}
3636
String symbol of like of symbols
37-
start : string, int, date, datetime, timestamp
37+
start : string, int, date, datetime, Timestamp
3838
Starting date. Parses many different kind of date
3939
representations (e.g., 'JAN-01-2010', '1/1/10', 'Jan, 1, 1980'). Defaults to
4040
20 years before current date.
41-
end : string, int, date, datetime, timestamp
41+
end : string, int, date, datetime, Timestamp
4242
Ending date
4343
retry_count : int, default 3
4444
Number of times to retry query request.
@@ -140,10 +140,11 @@ class TiingoDailyReader(_BaseReader):
140140
----------
141141
symbols : {str, List[str]}
142142
String symbol of like of symbols
143-
start : str, (defaults to '1/1/2010')
143+
start : string, int, date, datetime, Timestamp
144144
Starting date, timestamp. Parses many different kind of date
145-
representations (e.g., 'JAN-01-2010', '1/1/10', 'Jan, 1, 1980')
146-
end : str, (defaults to today)
145+
representations (e.g., 'JAN-01-2010', '1/1/10', 'Jan, 1, 1980').
146+
Default is '1/1/2010'.
147+
end : string, int, date, datetime, Timestamp
147148
Ending date, timestamp. Same format as starting date.
148149
retry_count : int, default 3
149150
Number of times to retry query request.
@@ -241,9 +242,9 @@ class TiingoMetaDataReader(TiingoDailyReader):
241242
----------
242243
symbols : {str, List[str]}
243244
String symbol of like of symbols
244-
start : str, (defaults to '1/1/2010')
245+
start : string, int, date, datetime, Timestamp
245246
Not used.
246-
end : str, (defaults to today)
247+
end : string, int, date, datetime, Timestamp
247248
Not used.
248249
retry_count : int, default 3
249250
Number of times to retry query request.
@@ -299,9 +300,9 @@ class TiingoQuoteReader(TiingoDailyReader):
299300
----------
300301
symbols : {str, List[str]}
301302
String symbol of like of symbols
302-
start : str, (defaults to '1/1/2010')
303+
start : string, int, date, datetime, Timestamp
303304
Not used.
304-
end : str, (defaults to today)
305+
end : string, int, date, datetime, Timestamp
305306
Not used.
306307
retry_count : int, default 3
307308
Number of times to retry query request.

pandas_datareader/tsp.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ class TSPReader(_BaseReader):
1212
symbols : str, array-like object (list, tuple, Series), or DataFrame
1313
Single stock symbol (ticker), array-like object of symbols or
1414
DataFrame with index containing stock symbols.
15-
start : string, int, date, datetime, timestamp
15+
start : string, int, date, datetime, Timestamp
1616
Starting date. Parses many different kind of date
1717
representations (e.g., 'JAN-01-2010', '1/1/10', 'Jan, 1, 1980'). Defaults to
1818
20 years before current date.
19-
end : string, int, date, datetime, timestamp
19+
end : string, int, date, datetime, Timestamp
2020
Ending date
2121
retry_count : int, default 3
2222
Number of times to retry query request.

pandas_datareader/wb.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -537,9 +537,9 @@ class WorldBankReader(_BaseReader):
537537
can be mixed.
538538
The two ISO lists of countries, provided by wikipedia, are hardcoded
539539
into pandas as of 11/10/2014.
540-
start: Timestamp or int
540+
start : string, int, date, datetime, Timestamp
541541
First year of the data series. Month and day are ignored.
542-
end: Timestamp or int
542+
end : string, int, date, datetime, Timestamp
543543
Last year of the data series (inclusive). Month and day are ignored.
544544
errors: str {'ignore', 'warn', 'raise'}, default 'warn'
545545
Country codes are validated against a hardcoded list. This controls

pandas_datareader/yahoo/daily.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ class YahooDailyReader(_DailyBaseReader):
2222
symbols : string, array-like object (list, tuple, Series), or DataFrame
2323
Single stock symbol (ticker), array-like object of symbols or
2424
DataFrame with index containing stock symbols.
25-
start : string, int, date, datetime, timestamp
25+
start : string, int, date, datetime, Timestamp
2626
Starting date. Parses many different kind of date
2727
representations (e.g., 'JAN-01-2010', '1/1/10', 'Jan, 1, 1980'). Defaults to
2828
5 years before current date.
29-
end : string, int, date, datetime, timestamp
29+
end : string, int, date, datetime, Timestamp
3030
Ending date
3131
retry_count : int, default 3
3232
Number of times to retry query request.

pandas_datareader/yahoo/fx.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ class YahooFXReader(YahooDailyReader):
1818
symbols : string, array-like object (list, tuple, Series), or DataFrame
1919
Single stock symbol (ticker), array-like object of symbols or
2020
DataFrame with index containing stock symbols.
21-
start : string, (defaults to '1/1/2010')
21+
start : string, int, date, datetime, Timestamp
2222
Starting date, timestamp. Parses many different kind of date
23-
representations (e.g., 'JAN-01-2010', '1/1/10', 'Jan, 1, 1980')
24-
end : string, (defaults to today)
25-
Ending date, timestamp. Same format as starting date.
23+
representations (e.g., 'JAN-01-2010', '1/1/10', 'Jan, 1, 1980').
24+
Defaults to '1/1/2010'.
25+
end : string, int, date, datetime, Timestamp
26+
Ending date, timestamp. Same format as starting date. Defaults to today.
2627
retry_count : int, default 3
2728
Number of times to retry query request.
2829
pause : int, default 0.1

0 commit comments

Comments
 (0)