Missing source link
State: closed

- [ ] closes #58351 


The source link located at the upper right-hand side of [DataFrame.index](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.index.html) and [DataFrame.columns](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.columns.html) is still missing. This may be because they do not have any code. 

[DataFrame.index](https://github.com/pandas-dev/pandas/blob/v2.2.2/pandas/core/frame.py#L12500C5-L12545C6) and [DataFrame.columns](https://github.com/pandas-dev/pandas/blob/v2.2.2/pandas/core/frame.py#L12546C5-L12564C1) are `properties.AxisProperty` 

I still merged the two Axes sections in the `.rst` file after discussing with @WillAyd 

The same thing exists for [Series.index](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.index.html)


Labels:
name: Docs

Comments:
/preview

/preview
Website preview of this PR available at: https://pandas.pydata.org/preview/pandas-dev/pandas/59549/
From the preview link I don't think this did anything:

https://pandas.pydata.org/preview/pandas-dev/pandas/59549/docs/reference/api/pandas.DataFrame.index.html

May also just be because these items are class attributes and not properties.

I'm not entirely sure how the docs generate the `source` link - @mroeschke do you know what tool does that and/or how it works?
They are generated via Sphinx through this extension I presume, but I've never played around with it https://www.sphinx-doc.org/en/master/usage/extensions/linkcode.html#confval-linkcode_resolve
> From the preview link I don't think this did anything:
> 
> https://pandas.pydata.org/preview/pandas-dev/pandas/59549/docs/reference/api/pandas.DataFrame.index.html
> 
> May also just be because these items are class attributes and not properties.
> 
> I'm not entirely sure how the docs generate the `source` link - @mroeschke do you know what tool does that and/or how it works?

This only added a "See also" section for `pandas.DataFrame.columns`.
@WillAyd @mroeschke Ideally, do we want the source link to point to [this](https://github.com/pandas-dev/pandas/blob/v2.2.2/pandas/core/frame.py#L12546C1-L12563C6) or as Will said as `DataFrame.columns` has no code, there is no need to have a source link? 
There ideally should be a source link to your reference, but there might be some extra Sphinx code needed to find that reference
It seems that Sphinx does not support `.pyi` files (see [here](https://github.com/sphinx-doc/sphinx/pull/4824) and [here](https://github.com/sphinx-doc/sphinx/issues/7630) and also [here](https://github.com/lakehq/sail/pull/123))

`pandas.DataFrame.columns` is a `pandas._libs.properties.AxisProperty` located [here](https://github.com/pandas-dev/pandas/blob/main/pandas/_libs/properties.pyi#L18C1-L27C19)

The same thing exists for `pandas.Interval` for which the [source link](https://pandas.pydata.org/docs/reference/api/pandas.Interval.html) is missing as well. It is defined [here](https://github.com/pandas-dev/pandas/blob/main/pandas/_libs/interval.pyi)

Should we close this issue then? 
Nonetheless, I slightly updated the `pandas.DataFrame.columns` doc (added a Return and See also section)
Thanks @fbourgey