DOC: Add an interactive shell powered by JupyterLite to the website
State: closed

This allows for easily trying `pandas` in a web browser without installing anything.

Since the default kernel is based on Pyodide, it also includes a couple of other libraries by default such as `matplotlib`.

![image](https://user-images.githubusercontent.com/591645/174594931-abb9393c-1db1-49ab-ab6a-e777a5059200.png)

Other popular libraries have also adopted JupyterLite to power their documentation with an interactive shell:

- `numpy`: https://numpy.org/
- `sympy`: https://www.sympy.org/en/shell.html

---

- [x] closes #46682 
- [x] ~[Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature~
- [x] ~All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).~
- [x] ~Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.~
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.

### TODO

- [x] Embed the JupyterLite REPL application
- [x] Create a separate repo for the JupyterLite deployment with a csv file and other custom settings
- [x] Add example code that can be copied and pasted
- [ ] Move the demo repo to the `pandas-dev` organization

Labels:
name: Docs
name: Web
description: pandas website

Comments:
Example of reading the `iris.csv` file:

![image](https://user-images.githubusercontent.com/591645/174616727-eaf1d068-74a2-4eb3-8543-640de50726a8.png)

> [ ]  Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.

It's not a new feature to `pandas` itself, but could be interesting to get it into the changelog somewhere for visibility?
Marking as ready for review since the basic functionality should now be working. Happy to iterate more in this PR or follow-up PRs based on feedback.

As mentioned in the top comment, the [repo](https://github.com/jtpio/pandas-repl) used for the JupyterLite deployment should be moved to the `pandas-dev` organization on GitHub.

cc a couple of folks involved in the original issue: https://github.com/pandas-dev/pandas/issues/46682

@datapythonista @bennaaym @psychemedia @hamedgibago

Thanks!
Added some example code above the REPL that folks can copy paste:

![image](https://user-images.githubusercontent.com/591645/174632489-5eeaf0af-c34e-4d8c-844f-c2f2aa914fdb.png)

Would it be useful to also cover other pandas read/write methods, to test file type reading, if nothing else and also surface filetypes etc. that may not be handled correctly?

There is a full list available here: https://pandas.pydata.org/pandas-docs/stable/user_guide/io.html
@psychemedia have you tried to see if they work?

I think the main reason for having `pd.read_csv()` work in the REPL was to be able to load a dataset with a familiar API, and then manipulate it with pandas.
I do have a [test notebook](https://gist.github.com/psychemedia/6fd3655782daf031299cfec03043d6bc) (cribbed from *pandas* docs), but I can't even get `read_csv()` to work with https://jupyterlite.readthedocs.io/en/latest/_static/lab/index.html yet on `data/iris.csv` atm (I was assuming that demo was the latest one? I tried reloading in browser dev tools which generally seems to clear cache etc. but that made no difference.) Will try to have a look in a day or two: currently buried in meeting a teaching marking deadline.
Thanks @psychemedia for sharing the example notebook, this is useful. It looks like there is an issue saving the json file:

![image](https://user-images.githubusercontent.com/591645/174676780-8a23da8a-d9e3-4007-ab27-98d2bbb23230.png)

Mind opening an issue on the JupyterLite repo? Looks like this is an issue that should be fixed there, and is not strictly blocking for this PR since it can be addressed separately.

**EDIT**: tracked in https://github.com/jupyterlite/jupyterlite/issues/682
Many thanks @datapythonista for the review and feedback!

The comments should have been addressed now.
For those who would like to try it out, you can download the built website here: https://github.com/pandas-dev/pandas/actions/runs/2541517660

![image](https://user-images.githubusercontent.com/591645/175013569-c256c93b-70f0-4dfe-80e1-6a43d2a76423.png)


And then start a local server with `python -m http.server`:

![image](https://user-images.githubusercontent.com/591645/175013493-aeee15f0-bad4-495c-ac70-14b01b6fe833.png)

> not sure if I'd delete the iris csv, since now it's not used,

Good catch. Happy to push a commit to remove it, so we keep things as simple as possible for now.
> Happy to push a commit to remove it,

Done in https://github.com/pandas-dev/pandas/pull/47428/commits/7d75312b2368945fce7cabce2ecd1703d4790ec7
Very cool! Thanks @jtpio