Skip to content

BUG: years-only in date_range uses current date (GH6961) #8672

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 1 commit into from
Oct 29, 2014
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/whatsnew/v0.15.1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,5 @@ Bug Fixes


- Fixed a bug where plotting a column ``y`` and specifying a label would mutate the index name of the original DataFrame (:issue:`8494`)

- Bug in ``date_range`` where partially-specified dates would incorporate current date (:issue:`6961`)
6 changes: 6 additions & 0 deletions pandas/tseries/tests/test_daterange.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,12 @@ def test_range_closed(self):
self.assertTrue(expected_left.equals(left))
self.assertTrue(expected_right.equals(right))

def test_years_only(self):
# GH 6961
dr = date_range('2014', '2015', freq='M')
self.assertEqual(dr[0], datetime(2014, 1, 31))
self.assertEqual(dr[-1], datetime(2014, 12, 31))


class TestCustomDateRange(tm.TestCase):

Expand Down