@@ -432,6 +432,15 @@ def __arrow_array__(self, type=None):
432
432
"""
433
433
The year of the period.
434
434
435
+ See Also
436
+ --------
437
+ PeriodIndex.day_of_year : The ordinal day of the year.
438
+ PeriodIndex.dayofyear : The ordinal day of the year.
439
+ PeriodIndex.is_leap_year : Logical indicating if the date belongs to a
440
+ leap year.
441
+ PeriodIndex.weekofyear : The week ordinal of the year.
442
+ PeriodIndex.year : The year of the period.
443
+
435
444
Examples
436
445
--------
437
446
>>> idx = pd.PeriodIndex(["2023", "2024", "2025"], freq="Y")
@@ -444,6 +453,11 @@ def __arrow_array__(self, type=None):
444
453
"""
445
454
The month as January=1, December=12.
446
455
456
+ See Also
457
+ --------
458
+ PeriodIndex.days_in_month : The number of days in the month.
459
+ PeriodIndex.daysinmonth : The number of days in the month.
460
+
447
461
Examples
448
462
--------
449
463
>>> idx = pd.PeriodIndex(["2023-01", "2023-02", "2023-03"], freq="M")
@@ -456,6 +470,16 @@ def __arrow_array__(self, type=None):
456
470
"""
457
471
The days of the period.
458
472
473
+ See Also
474
+ --------
475
+ PeriodIndex.day_of_week : The day of the week with Monday=0, Sunday=6.
476
+ PeriodIndex.day_of_year : The ordinal day of the year.
477
+ PeriodIndex.dayofweek : The day of the week with Monday=0, Sunday=6.
478
+ PeriodIndex.dayofyear : The ordinal day of the year.
479
+ PeriodIndex.days_in_month : The number of days in the month.
480
+ PeriodIndex.daysinmonth : The number of days in the month.
481
+ PeriodIndex.weekday : The day of the week with Monday=0, Sunday=6.
482
+
459
483
Examples
460
484
--------
461
485
>>> idx = pd.PeriodIndex(['2020-01-31', '2020-02-28'], freq='D')
@@ -468,6 +492,12 @@ def __arrow_array__(self, type=None):
468
492
"""
469
493
The hour of the period.
470
494
495
+ See Also
496
+ --------
497
+ PeriodIndex.minute : The minute of the period.
498
+ PeriodIndex.second : The second of the period.
499
+ PeriodIndex.to_timestamp : Cast to DatetimeArray/Index.
500
+
471
501
Examples
472
502
--------
473
503
>>> idx = pd.PeriodIndex(["2023-01-01 10:00", "2023-01-01 11:00"], freq='h')
@@ -480,6 +510,12 @@ def __arrow_array__(self, type=None):
480
510
"""
481
511
The minute of the period.
482
512
513
+ See Also
514
+ --------
515
+ PeriodIndex.hour : The hour of the period.
516
+ PeriodIndex.second : The second of the period.
517
+ PeriodIndex.to_timestamp : Cast to DatetimeArray/Index.
518
+
483
519
Examples
484
520
--------
485
521
>>> idx = pd.PeriodIndex(["2023-01-01 10:30:00",
@@ -493,6 +529,12 @@ def __arrow_array__(self, type=None):
493
529
"""
494
530
The second of the period.
495
531
532
+ See Also
533
+ --------
534
+ PeriodIndex.hour : The hour of the period.
535
+ PeriodIndex.minute : The minute of the period.
536
+ PeriodIndex.to_timestamp : Cast to DatetimeArray/Index.
537
+
496
538
Examples
497
539
--------
498
540
>>> idx = pd.PeriodIndex(["2023-01-01 10:00:30",
@@ -506,6 +548,14 @@ def __arrow_array__(self, type=None):
506
548
"""
507
549
The week ordinal of the year.
508
550
551
+ See Also
552
+ --------
553
+ PeriodIndex.day_of_week : The day of the week with Monday=0, Sunday=6.
554
+ PeriodIndex.dayofweek : The day of the week with Monday=0, Sunday=6.
555
+ PeriodIndex.week : The week ordinal of the year.
556
+ PeriodIndex.weekday : The day of the week with Monday=0, Sunday=6.
557
+ PeriodIndex.year : The year of the period.
558
+
509
559
Examples
510
560
--------
511
561
>>> idx = pd.PeriodIndex(["2023-01", "2023-02", "2023-03"], freq="M")
@@ -519,6 +569,17 @@ def __arrow_array__(self, type=None):
519
569
"""
520
570
The day of the week with Monday=0, Sunday=6.
521
571
572
+ See Also
573
+ --------
574
+ PeriodIndex.day : The days of the period.
575
+ PeriodIndex.day_of_week : The day of the week with Monday=0, Sunday=6.
576
+ PeriodIndex.day_of_year : The ordinal day of the year.
577
+ PeriodIndex.dayofweek : The day of the week with Monday=0, Sunday=6.
578
+ PeriodIndex.dayofyear : The ordinal day of the year.
579
+ PeriodIndex.week : The week ordinal of the year.
580
+ PeriodIndex.weekday : The day of the week with Monday=0, Sunday=6.
581
+ PeriodIndex.weekofyear : The week ordinal of the year.
582
+
522
583
Examples
523
584
--------
524
585
>>> idx = pd.PeriodIndex(["2023-01-01", "2023-01-02", "2023-01-03"], freq="D")
@@ -533,6 +594,17 @@ def __arrow_array__(self, type=None):
533
594
"""
534
595
The ordinal day of the year.
535
596
597
+ See Also
598
+ --------
599
+ PeriodIndex.day : The days of the period.
600
+ PeriodIndex.day_of_week : The day of the week with Monday=0, Sunday=6.
601
+ PeriodIndex.day_of_year : The ordinal day of the year.
602
+ PeriodIndex.dayofweek : The day of the week with Monday=0, Sunday=6.
603
+ PeriodIndex.dayofyear : The ordinal day of the year.
604
+ PeriodIndex.weekday : The day of the week with Monday=0, Sunday=6.
605
+ PeriodIndex.weekofyear : The week ordinal of the year.
606
+ PeriodIndex.year : The year of the period.
607
+
536
608
Examples
537
609
--------
538
610
>>> idx = pd.PeriodIndex(["2023-01-10", "2023-02-01", "2023-03-01"], freq="D")
@@ -551,19 +623,74 @@ def __arrow_array__(self, type=None):
551
623
"""
552
624
The quarter of the date.
553
625
626
+ See Also
627
+ --------
628
+ PeriodIndex.qyear : Fiscal year the Period lies in according to its
629
+ starting-quarter.
630
+
554
631
Examples
555
632
--------
556
633
>>> idx = pd.PeriodIndex(["2023-01", "2023-02", "2023-03"], freq="M")
557
634
>>> idx.quarter
558
635
Index([1, 1, 1], dtype='int64')
559
636
""" ,
560
637
)
561
- qyear = _field_accessor ("qyear" )
638
+ qyear = _field_accessor (
639
+ "qyear" ,
640
+ """
641
+ Fiscal year the Period lies in according to its starting-quarter.
642
+
643
+ The `year` and the `qyear` of the period will be the same if the fiscal
644
+ and calendar years are the same. When they are not, the fiscal year
645
+ can be different from the calendar year of the period.
646
+
647
+ Returns
648
+ -------
649
+ int
650
+ The fiscal year of the period.
651
+
652
+ See Also
653
+ --------
654
+ PeriodIndex.quarter : The quarter of the date.
655
+ PeriodIndex.year : The year of the period.
656
+
657
+ Examples
658
+ --------
659
+ If the natural and fiscal year are the same, `qyear` and `year` will
660
+ be the same.
661
+
662
+ >>> per = pd.Period('2018Q1', freq='Q')
663
+ >>> per.qyear
664
+ 2018
665
+ >>> per.year
666
+ 2018
667
+
668
+ If the fiscal year starts in April (`Q-MAR`), the first quarter of
669
+ 2018 will start in April 2017. `year` will then be 2017, but `qyear`
670
+ will be the fiscal year, 2018.
671
+
672
+ >>> per = pd.Period('2018Q1', freq='Q-MAR')
673
+ >>> per.start_time
674
+ Timestamp('2017-04-01 00:00:00')
675
+ >>> per.qyear
676
+ 2018
677
+ >>> per.year
678
+ 2017
679
+ """ ,
680
+ )
681
+
562
682
days_in_month = _field_accessor (
563
683
"days_in_month" ,
564
684
"""
565
685
The number of days in the month.
566
686
687
+ See Also
688
+ --------
689
+ PeriodIndex.day : The days of the period.
690
+ PeriodIndex.days_in_month : The number of days in the month.
691
+ PeriodIndex.daysinmonth : The number of days in the month.
692
+ PeriodIndex.month : The month as January=1, December=12.
693
+
567
694
Examples
568
695
--------
569
696
For Series:
@@ -595,6 +722,12 @@ def is_leap_year(self) -> npt.NDArray[np.bool_]:
595
722
"""
596
723
Logical indicating if the date belongs to a leap year.
597
724
725
+ See Also
726
+ --------
727
+ PeriodIndex.qyear : Fiscal year the Period lies in according to its
728
+ starting-quarter.
729
+ PeriodIndex.year : The year of the period.
730
+
598
731
Examples
599
732
--------
600
733
>>> idx = pd.PeriodIndex(["2023", "2024", "2025"], freq="Y")
@@ -618,6 +751,19 @@ def to_timestamp(self, freq=None, how: str = "start") -> DatetimeArray:
618
751
Returns
619
752
-------
620
753
DatetimeArray/Index
754
+ Timestamp representation of given Period-like object.
755
+
756
+ See Also
757
+ --------
758
+ PeriodIndex.day : The days of the period.
759
+ PeriodIndex.from_fields : Construct a PeriodIndex from fields
760
+ (year, month, day, etc.).
761
+ PeriodIndex.from_ordinals : Construct a PeriodIndex from ordinals.
762
+ PeriodIndex.hour : The hour of the period.
763
+ PeriodIndex.minute : The minute of the period.
764
+ PeriodIndex.month : The month as January=1, December=12.
765
+ PeriodIndex.second : The second of the period.
766
+ PeriodIndex.year : The year of the period.
621
767
622
768
Examples
623
769
--------
0 commit comments