Skip to content

Commit 9f15bea

Browse files
committed
Merge pull request pandas-dev#8672 from rosnfeld/issue_6961
BUG: years-only in date_range uses current date (GH6961)
2 parents a0550dd + bd1747b commit 9f15bea

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

doc/source/whatsnew/v0.15.1.txt

Lines changed: 2 additions & 0 deletions
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

Lines changed: 6 additions & 0 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy