Convert strings in the array to be capitalized. Returns ------- capitalized : same type as values Examples -------- >>> da = xr.DataArray( ... ["temperature", "PRESSURE", "PreCipiTation", "daily rainfall"], dims="x" ... )
(self)
| 669 | ) |
| 670 | |
| 671 | def capitalize(self) -> T_DataArray: |
| 672 | """ |
| 673 | Convert strings in the array to be capitalized. |
| 674 | |
| 675 | Returns |
| 676 | ------- |
| 677 | capitalized : same type as values |
| 678 | |
| 679 | Examples |
| 680 | -------- |
| 681 | >>> da = xr.DataArray( |
| 682 | ... ["temperature", "PRESSURE", "PreCipiTation", "daily rainfall"], dims="x" |
| 683 | ... ) |
| 684 | >>> da |
| 685 | <xarray.DataArray (x: 4)> Size: 224B |
| 686 | array(['temperature', 'PRESSURE', 'PreCipiTation', 'daily rainfall'], |
| 687 | dtype='<U14') |
| 688 | Dimensions without coordinates: x |
| 689 | >>> capitalized = da.str.capitalize() |
| 690 | >>> capitalized |
| 691 | <xarray.DataArray (x: 4)> Size: 224B |
| 692 | array(['Temperature', 'Pressure', 'Precipitation', 'Daily rainfall'], |
| 693 | dtype='<U14') |
| 694 | Dimensions without coordinates: x |
| 695 | """ |
| 696 | return self._apply(func=lambda x: x.capitalize()) |
| 697 | |
| 698 | def lower(self) -> T_DataArray: |
| 699 | """ |