Skip to content

Commit 369c780

Browse files
committed
Set 'Date' column as index
1 parent 0182dae commit 369c780

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

pandas_datareader/naver.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class NaverDailyReader(_DailyBaseReader):
1515
:param interval: Not implemented
1616
:param adjust_dividends: Not implemented
1717
"""
18+
1819
def __init__(
1920
self,
2021
symbols=None,
@@ -80,9 +81,10 @@ def _read_one_data(self, url, params):
8081
parsed, columns=["Date", "Open", "High", "Low", "Close", "Volume"]
8182
)
8283
prices["Date"] = to_datetime(prices["Date"])
84+
prices = prices.set_index("Date")
8385

8486
# NOTE: See _get_params() for explanations.
85-
return prices[(prices["Date"] >= self.start) & (prices["Date"] <= self.end)]
87+
return prices[(prices.index >= self.start) & (prices.index <= self.end)]
8688

8789
def _parse_xml_response(self, xml_content):
8890
"""Parses XML response from the server.

pandas_datareader/tests/test_naver.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ def test_naver_daily_reader(self, symbol, start, end):
1818
end = datetime(*end)
1919
reader = DataReader(symbol, "naver", start, end)
2020

21-
assert reader.shape[1] == 6
22-
assert reader["Date"].min() >= start
23-
assert reader["Date"].max() <= end
21+
assert reader.shape[1] == 5
22+
assert reader.index.min() >= start
23+
assert reader.index.max() <= end
2424

2525
def test_bulk_fetch(self):
2626
with pytest.raises(NotImplementedError):

0 commit comments

Comments
 (0)