Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/pandas/_config/dates.py: 100%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

8 statements  

1""" 

2config for datetime formatting 

3""" 

4 

5from __future__ import annotations 

6 

7from pandas._config import config as cf 

8 

9pc_date_dayfirst_doc = """ 

10: boolean 

11 When True, parses ambiguous dates with the day first, eg 20/01/2005. 

12 This affects parsing only, not how dates are displayed, and applies to 

13 the Period constructor and partial-string indexing on a DatetimeIndex. 

14 Timestamp, to_datetime and read_csv take their own dayfirst keyword and 

15 are unaffected. 

16""" 

17 

18pc_date_yearfirst_doc = """ 

19: boolean 

20 When True, parses ambiguous dates with the year first, eg 2005/01/20. 

21 This affects parsing only, not how dates are displayed, and applies to 

22 the Period constructor and partial-string indexing on a DatetimeIndex. 

23 Timestamp, to_datetime and read_csv take their own yearfirst keyword and 

24 are unaffected. 

25""" 

26 

27with cf.config_prefix("display"): 

28 # Needed upstream of `_libs` because these are used in tslibs.parsing 

29 cf.register_option( 

30 "date_dayfirst", False, pc_date_dayfirst_doc, validator=cf.is_bool 

31 ) 

32 cf.register_option( 

33 "date_yearfirst", False, pc_date_yearfirst_doc, validator=cf.is_bool 

34 )