Skip to content

Commit bd1747b

Browse files
committed
BUG: years-only in date_range uses current date (GH6961)
1 parent a0550dd commit bd1747b

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

doc/source/whatsnew/v0.15.1.txt

+2
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,5 @@ Bug Fixes
171171

172172

173173
- Fixed a bug where plotting a column ``y`` and specifying a label would mutate the index name of the original DataFrame (:issue:`8494`)
174+
175+
- Bug in ``date_range`` where partially-specified dates would incorporate current date (:issue:`6961`)

pandas/tseries/tests/test_daterange.py

+6
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,12 @@ def test_range_closed(self):
470470
self.assertTrue(expected_left.equals(left))
471471
self.assertTrue(expected_right.equals(right))
472472

473+
def test_years_only(self):
474+
# GH 6961
475+
dr = date_range('2014', '2015', freq='M')
476+
self.assertEqual(dr[0], datetime(2014, 1, 31))
477+
self.assertEqual(dr[-1], datetime(2014, 12, 31))
478+
473479

474480
class TestCustomDateRange(tm.TestCase):
475481

0 commit comments

Comments
 (0)