spark-instrumented-optimizer/python/docs/source/reference
Xinrong Meng cb14a32005 [SPARK-36469][PYTHON] Implement Index.map
### What changes were proposed in this pull request?
Implement `Index.map`.

The PR is based on https://github.com/databricks/koalas/pull/2136. Thanks awdavidson for the prototype.

`map` of CategoricalIndex and DatetimeIndex will be implemented in separate PRs.

### Why are the changes needed?
Mapping values using input correspondence (a dict, Series, or function) is supported in pandas as [Index.map](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Index.map.html).
We shall also support hat.

### Does this PR introduce _any_ user-facing change?
Yes. `Index.map` is available now.

```py
>>> psidx = ps.Index([1, 2, 3])

>>> psidx.map({1: "one", 2: "two", 3: "three"})
Index(['one', 'two', 'three'], dtype='object')

>>> psidx.map(lambda id: "{id} + 1".format(id=id))
Index(['1 + 1', '2 + 1', '3 + 1'], dtype='object')

>>> pser = pd.Series(["one", "two", "three"], index=[1, 2, 3])
>>> psidx.map(pser)
Index(['one', 'two', 'three'], dtype='object')
```

### How was this patch tested?
Unit tests.

Closes #33694 from xinrong-databricks/index_map.

Authored-by: Xinrong Meng <xinrong.meng@databricks.com>
Signed-off-by: Takuya UESHIN <ueshin@databricks.com>
(cherry picked from commit 4dcd746025)
Signed-off-by: Takuya UESHIN <ueshin@databricks.com>
2021-08-16 11:06:23 -07:00
..
pyspark.pandas [SPARK-36469][PYTHON] Implement Index.map 2021-08-16 11:06:23 -07:00
index.rst [SPARK-35636][PYTHON][DOCS][FOLLOW-UP] Restructure reference API files according to the layout 2021-06-08 19:01:56 +09:00
pyspark.ml.rst [SPARK-34415][ML] Randomization in hyperparameter optimization 2021-02-27 08:34:39 -06:00
pyspark.mllib.rst [SPARK-34041][PYTHON][DOCS] Miscellaneous cleanup for new PySpark documentation 2021-01-08 09:28:31 +09:00
pyspark.resource.rst [SPARK-32179][SPARK-32188][PYTHON][DOCS] Replace and redesign the documentation base 2020-07-27 17:49:21 +09:00
pyspark.rst [SPARK-35303][PYTHON] Enable pinned thread mode by default 2021-06-18 12:02:29 +09:00
pyspark.sql.rst [SPARK-36178][PYTHON] List pyspark.sql.catalog APIs in documentation 2021-07-19 19:49:22 +09:00
pyspark.ss.rst [SPARK-32179][SPARK-32188][PYTHON][DOCS] Replace and redesign the documentation base 2020-07-27 17:49:21 +09:00
pyspark.streaming.rst [SPARK-32179][SPARK-32188][PYTHON][DOCS] Replace and redesign the documentation base 2020-07-27 17:49:21 +09:00