Skip to content

Commit 786ad53

Browse files
committed
Fix docs
1 parent e976cd8 commit 786ad53

File tree

5 files changed

+50
-37
lines changed

5 files changed

+50
-37
lines changed

docs/changelog.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ from the examples given in that link.
2525

2626
### 🆕 Features
2727

28-
- - Added unit conversion APIs: [pandas_openscm.unit_conversion.convert_unit] and [pandas_openscm.unit_conversion.convert_unit_like] and the corresponding accessors [pandas_openscm.accessors.DataFramePandasOpenSCMAccessor.convert_unit] and [pandas_openscm.accessors.DataFramePandasOpenSCMAccessor.convert_unit_like]
29-
- Added the helper: [pandas_openscm.index_manipulation.ensure_is_multiindex] and the corresponding accessors [pandas_openscm.accessors.DataFramePandasOpenSCMAccessor.ensure_index_is_multiindex] and [pandas_openscm.accessors.DataFramePandasOpenSCMAccessor.eiim]
28+
- - Added unit conversion APIs: [pandas_openscm.unit_conversion.convert_unit] and [pandas_openscm.unit_conversion.convert_unit_like] and the corresponding accessors [pandas_openscm.accessors.PandasDataFrameOpenSCMAccessor.convert_unit] and [pandas_openscm.accessors.PandasDataFrameOpenSCMAccessor.convert_unit_like]
29+
- Added the helper: [pandas_openscm.index_manipulation.ensure_is_multiindex] and the corresponding accessors [pandas_openscm.accessors.PandasDataFrameOpenSCMAccessor.ensure_index_is_multiindex] and [pandas_openscm.accessors.PandasDataFrameOpenSCMAccessor.eiim]
3030

3131
([#23](https://github.com/openscm/pandas-openscm/pull/23))
3232

@@ -46,7 +46,7 @@ from the examples given in that link.
4646

4747
### 🆕 Features
4848

49-
- Added [pandas_openscm.index_manipulation.set_levels][] and the corresponding accessor [pandas_openscm.accessors.DataFramePandasOpenSCMAccessor.set_index_levels][] ([#18](https://github.com/openscm/pandas-openscm/pull/18))
49+
- Added [pandas_openscm.index_manipulation.set_levels][] and the corresponding accessor [pandas_openscm.accessors.PandasDataFrameOpenSCMAccessor.set_index_levels][] ([#18](https://github.com/openscm/pandas-openscm/pull/18))
5050

5151

5252
## Pandas-OpenSCM v0.5.0 (2025-05-10)
@@ -84,7 +84,7 @@ from the examples given in that link.
8484
### 🆕 Features
8585

8686
- Add compare_close function to compare two dataframes. ([#16](https://github.com/openscm/pandas-openscm/pull/16))
87-
- Added [pandas_openscm.index_manipulation.update_levels_from_other][] and the corresponding accessor [pandas_openscm.accessors.DataFramePandasOpenSCMAccessor.update_index_levels_from_other][] ([#17](https://github.com/openscm/pandas-openscm/pull/17))
87+
- Added [pandas_openscm.index_manipulation.update_levels_from_other][] and the corresponding accessor [pandas_openscm.accessors.PandasDataFrameOpenSCMAccessor.update_index_levels_from_other][] ([#17](https://github.com/openscm/pandas-openscm/pull/17))
8888

8989

9090
## Pandas-OpenSCM v0.4.1 (2025-04-12)
@@ -93,21 +93,21 @@ from the examples given in that link.
9393

9494
- Fixed up [pandas_openscm.index_manipulation.update_levels][].
9595
It now drops unused levels by default first, to avoid applying the updates to values that aren't being used.
96-
The same fixes are propagated to [pandas_openscm.accessors.DataFramePandasOpenSCMAccessor.update_index_levels][] and [pandas_openscm.index_manipulation.update_index_levels_func][]. ([#14](https://github.com/openscm/pandas-openscm/pull/14))
96+
The same fixes are propagated to [pandas_openscm.accessors.PandasDataFrameOpenSCMAccessor.update_index_levels][] and [pandas_openscm.index_manipulation.update_index_levels_func][]. ([#14](https://github.com/openscm/pandas-openscm/pull/14))
9797

9898

9999
## Pandas-OpenSCM v0.4.0 (2025-04-11)
100100

101101
### 🆕 Features
102102

103-
- Added [pandas_openscm.index_manipulation.update_levels][] and the corresponding accessor [pandas_openscm.accessors.DataFramePandasOpenSCMAccessor.update_index_levels][] ([#13](https://github.com/openscm/pandas-openscm/pull/13))
103+
- Added [pandas_openscm.index_manipulation.update_levels][] and the corresponding accessor [pandas_openscm.accessors.PandasDataFrameOpenSCMAccessor.update_index_levels][] ([#13](https://github.com/openscm/pandas-openscm/pull/13))
104104

105105

106106
## Pandas-OpenSCM v0.3.3 (2025-03-30)
107107

108108
### 🆕 Features
109109

110-
- - Added a method for converting to long data, see [pandas_openscm.accessors.DataFramePandasOpenSCMAccessor.to_long_data][pandas_openscm.accessors.DataFramePandasOpenSCMAccessor.to_long_data] ([#12](https://github.com/openscm/pandas-openscm/pull/12))
110+
- - Added a method for converting to long data, see [pandas_openscm.accessors.PandasDataFrameOpenSCMAccessor.to_long_data][pandas_openscm.accessors.PandasDataFrameOpenSCMAccessor.to_long_data] ([#12](https://github.com/openscm/pandas-openscm/pull/12))
111111

112112

113113
## Pandas-OpenSCM v0.3.2 (2025-03-27)

docs/pandas-accessors.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This is done with
1313
By default, the accessors are provided under the "openscm" namespace
1414
and this is how the accessors are documented below.
1515
However, the namespace can be customised when using
16-
[register_pandas_accessor][pandas_openscm.accessors.register_pandas_accessor],
16+
[register_pandas_accessors][pandas_openscm.accessors.register_pandas_accessors],
1717
should you wish to use a different namespace for the accessor.
1818

1919
For the avoidance of doubt, in order to register/activate the accessors,
@@ -22,21 +22,29 @@ you will need to run something like:
2222
```python
2323
from pandas_openscm.accessors import register_pandas_accessors
2424

25-
# The 'pd.DataFrame.openscm' namespace will not be available at this point.
25+
# The 'pd.DataFrame.openscm' and 'pd.Series.openscm' namespace
26+
# will not be available at this point.
2627

2728
# Register the accessors
2829
register_pandas_accessors()
2930

30-
# The 'pd.DataFrame.openscm' namespace
31+
# The 'pd.DataFrame.openscm' and 'pd.Series.openscm' namespace
3132
# (or whatever other custom namespace you chose to register)
3233
# will now be available.
3334
```
3435

3536
The full accessor API is documented below.
3637

37-
::: pandas_openscm.accessors.DataFramePandasOpenSCMAccessor
38+
::: pandas_openscm.accessors.dataframe.PandasDataFrameOpenSCMAccessor
3839
handler: python_accessors
3940
options:
4041
namespace: "pd.DataFrame.openscm"
4142
show_root_full_path: false
4243
show_root_heading: true
44+
45+
::: pandas_openscm.accessors.series.PandasSeriesOpenSCMAccessor
46+
handler: python_accessors
47+
options:
48+
namespace: "pd.Series.openscm"
49+
show_root_full_path: false
50+
show_root_heading: true

src/pandas_openscm/accessors/dataframe.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def convert_unit(
7070
"""
7171
Convert units
7272
73-
This uses [convert_unit_from_target_series][(p).unit_conversion.].
73+
This uses [convert_unit_from_target_series][pandas_openscm.unit_conversion.].
7474
If you want to understand the details of how the conversion works,
7575
see that function's docstring.
7676
@@ -91,23 +91,25 @@ def convert_unit(
9191
9292
If this is a [pd.Series][pandas.Series],
9393
then it will be passed to
94-
[convert_unit_from_target_series][(p).unit_conversion.]
94+
[convert_unit_from_target_series][pandas_openscm.unit_conversion.]
9595
after filling any rows in the [pd.DataFrame][pandas.DataFrame]
9696
that are not in `desired_units`
9797
with the existing unit (i.e. unspecified rows are not converted).
9898
9999
For further details, see the examples
100-
in [convert_unit][(p).unit_conversion.].
100+
in [convert_unit][pandas_openscm.unit_conversion.].
101101
102102
unit_level
103103
Level in the index which holds unit information
104104
105-
Passed to [convert_unit_from_target_series][(p).unit_conversion.].
105+
Passed to
106+
[convert_unit_from_target_series][pandas_openscm.unit_conversion.].
106107
107108
ur
108109
Unit registry to use for the conversion.
109110
110-
Passed to [convert_unit_from_target_series][(p).unit_conversion.].
111+
Passed to
112+
[convert_unit_from_target_series][pandas_openscm.unit_conversion.].
111113
112114
Returns
113115
-------
@@ -129,16 +131,16 @@ def convert_unit_like(
129131
Convert units to match another [pd.DataFrame][pandas.DataFrame]
130132
131133
For further details, see the examples
132-
in [convert_unit_like][(p).unit_conversion.].
134+
in [convert_unit_like][pandas_openscm.unit_conversion.].
133135
134136
This is essentially a helper for
135-
[convert_unit_from_target_series][(p).unit_conversion.].
137+
[convert_unit_from_target_series][pandas_openscm.unit_conversion.].
136138
It implements one set of logic for extracting desired units
137139
and tries to be clever, handling differences in index levels
138140
between the data and `target` sensibly wherever possible.
139141
140142
If you want behaviour other than what is implemented here,
141-
use [convert_unit_from_target_series][(p).unit_conversion.] directly.
143+
use [convert_unit_from_target_series][pandas_openscm.unit_conversion.] directly.
142144
143145
Parameters
144146
----------
@@ -156,7 +158,8 @@ def convert_unit_like(
156158
ur
157159
Unit registry to use for the conversion.
158160
159-
Passed to [convert_unit_from_target_series][(p).unit_conversion.].
161+
Passed to
162+
[convert_unit_from_target_series][pandas_openscm.unit_conversion.].
160163
161164
Returns
162165
-------
@@ -194,7 +197,7 @@ def eiim(self, copy: bool = True) -> pd.DataFrame:
194197
"""
195198
Ensure that the index is a [pd.MultiIndex][pandas.MultiIndex]
196199
197-
Alias for [ensure_index_is_multiindex][(p).index_manipulation.]
200+
Alias for [ensure_index_is_multiindex][pandas_openscm.index_manipulation.]
198201
199202
Parameters
200203
----------
@@ -276,7 +279,7 @@ def mi_loc(
276279
Locator to apply
277280
278281
If this is a multi-index, we use
279-
[multi_index_lookup][(p).indexing.] to ensure correct alignment.
282+
[multi_index_lookup][pandas_openscm.indexing.] to ensure correct alignment.
280283
281284
If this is an index that has a name,
282285
we use the name to ensure correct alignment.

src/pandas_openscm/accessors/series.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def convert_unit(
5050
"""
5151
Convert units
5252
53-
This uses [convert_unit_from_target_series][(p).unit_conversion.].
53+
This uses [convert_unit_from_target_series][pandas_openscm.unit_conversion.].
5454
If you want to understand the details of how the conversion works,
5555
see that function's docstring.
5656
@@ -71,23 +71,25 @@ def convert_unit(
7171
7272
If this is a [pd.Series][pandas.Series],
7373
then it will be passed to
74-
[convert_unit_from_target_series][(p).unit_conversion.]
74+
[convert_unit_from_target_series][pandas_openscm.unit_conversion.]
7575
after filling any rows in the [pd.Series][pandas.Series]
7676
that are not in `desired_units`
7777
with the existing unit (i.e. unspecified rows are not converted).
7878
7979
For further details, see the examples
80-
in [convert_unit][(p).unit_conversion.].
80+
in [convert_unit][pandas_openscm.unit_conversion.].
8181
8282
unit_level
8383
Level in the index which holds unit information
8484
85-
Passed to [convert_unit_from_target_series][(p).unit_conversion.].
85+
Passed to
86+
[convert_unit_from_target_series][pandas_openscm.unit_conversion.].
8687
8788
ur
8889
Unit registry to use for the conversion.
8990
90-
Passed to [convert_unit_from_target_series][(p).unit_conversion.].
91+
Passed to
92+
[convert_unit_from_target_series][pandas_openscm.unit_conversion.].
9193
9294
Returns
9395
-------
@@ -120,16 +122,16 @@ def convert_unit_like(
120122
Convert units to match another supported pandas object
121123
122124
For further details, see the examples
123-
in [convert_unit_like][(p).unit_conversion.].
125+
in [convert_unit_like][pandas_openscm.unit_conversion.].
124126
125127
This is essentially a helper for
126-
[convert_unit_from_target_series][(p).unit_conversion.].
128+
[convert_unit_from_target_series][pandas_openscm.unit_conversion.].
127129
It implements one set of logic for extracting desired units
128130
and tries to be clever, handling differences in index levels
129131
between the data and `target` sensibly wherever possible.
130132
131133
If you want behaviour other than what is implemented here,
132-
use [convert_unit_from_target_series][(p).unit_conversion.] directly.
134+
use [convert_unit_from_target_series][pandas_openscm.unit_conversion.] directly.
133135
134136
Parameters
135137
----------
@@ -147,7 +149,8 @@ def convert_unit_like(
147149
ur
148150
Unit registry to use for the conversion.
149151
150-
Passed to [convert_unit_from_target_series][(p).unit_conversion.].
152+
Passed to
153+
[convert_unit_from_target_series][pandas_openscm.unit_conversion.].
151154
152155
Returns
153156
-------
@@ -196,7 +199,7 @@ def convert_unit_like(
196199
# """
197200
# Ensure that the index is a [pd.MultiIndex][pandas.MultiIndex]
198201
#
199-
# Alias for [ensure_index_is_multiindex][(p).index_manipulation.]
202+
# Alias for [ensure_index_is_multiindex][pandas_openscm.index_manipulation.]
200203
#
201204
# Parameters
202205
# ----------
@@ -278,7 +281,7 @@ def convert_unit_like(
278281
# Locator to apply
279282
#
280283
# If this is a multi-index, we use
281-
# [multi_index_lookup][(p).indexing.] to ensure correct alignment.
284+
# [multi_index_lookup][pandas_openscm.indexing.] to ensure correct alignment. # noqa: E501
282285
#
283286
# If this is an index that has a name,
284287
# we use the name to ensure correct alignment.

src/pandas_openscm/index_manipulation.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -920,20 +920,19 @@ def set_index_levels_func(
920920
921921
Parameters
922922
----------
923-
df
923+
pobj
924924
[pd.DataFrame][pandas.DataFrame] to update
925925
926926
levels_to_set
927927
Mapping of level names to values to set
928928
929929
copy
930-
Should `df` be copied before returning?
931-
930+
Should `pobj` be copied before returning?
932931
933932
Returns
934933
-------
935934
:
936-
`df` with updates applied to its index
935+
`pobj` with updates applied to its index
937936
"""
938937
if not isinstance(pobj.index, pd.MultiIndex):
939938
msg = (

0 commit comments

Comments
 (0)