Skip to content

Commit 700ff34

Browse files
authored
Merge branch 'main' into add-FutureWarning-for-pandas.io.sql.execute
2 parents 3c3f908 + 5115f09 commit 700ff34

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1745
-1022
lines changed

asv_bench/benchmarks/indexing.py

+13
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,19 @@ def time_assign_list_of_columns_concat(self):
476476
concat([self.df, df], axis=1)
477477

478478

479+
class Setitem:
480+
def setup(self):
481+
N = 500_000
482+
cols = 500
483+
self.df = DataFrame(np.random.rand(N, cols))
484+
485+
def time_setitem(self):
486+
self.df[100] = 100
487+
488+
def time_setitem_list(self):
489+
self.df[[100, 200, 300]] = 100
490+
491+
479492
class ChainIndexing:
480493

481494
params = [None, "warn"]

doc/source/development/contributing.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. _contributing:
1+
3.. _contributing:
22

33
{{ header }}
44

doc/source/development/contributing_codebase.rst

+1
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,7 @@ preferred if the inputs or logic are simple, with Hypothesis tests reserved
783783
for cases with complex logic or where there are too many combinations of
784784
options or subtle interactions to test (or think of!) all of them.
785785

786+
.. _contributing.running_tests:
786787

787788
Running the test suite
788789
----------------------

doc/source/development/contributing_documentation.rst

+1
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ for some tips and tricks to get the doctests passing.
127127
When doing a PR with a docstring update, it is good to post the
128128
output of the validation script in a comment on github.
129129

130+
.. _contributing.howto-build-docs:
130131

131132
How to build the pandas documentation
132133
---------------------------------------

doc/source/development/contributing_environment.rst

+16-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@ changes, you can skip to :ref:`contributing to the documentation <contributing_d
1212
creating the development environment you won't be able to build the documentation
1313
locally before pushing your changes. It's recommended to also install the :ref:`pre-commit hooks <contributing.pre-commit>`.
1414

15-
.. contents:: Table of contents:
16-
:local:
15+
.. toctree::
16+
:maxdepth: 2
17+
:hidden:
18+
19+
contributing_gitpod.rst
1720

1821
Step 1: install a C compiler
1922
----------------------------
@@ -188,6 +191,17 @@ Enable Docker support and use the Services tool window to build and manage image
188191
run and interact with containers.
189192
See https://www.jetbrains.com/help/pycharm/docker.html for details.
190193

194+
Option 4: using Gitpod
195+
~~~~~~~~~~~~~~~~~~~~~~
196+
197+
Gitpod is an open-source platform that automatically creates the correct development
198+
environment right in your browser, reducing the need to install local development
199+
environments and deal with incompatible dependencies.
200+
201+
If you are a Windows user, unfamiliar with using the command line or building pandas
202+
for the first time, it is often faster to build with Gitpod. Here are the in-depth instructions
203+
for :ref:`building pandas with GitPod <contributing-gitpod>`.
204+
191205
Step 3: build and install pandas
192206
--------------------------------
193207

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,273 @@
1+
.. _contributing-gitpod:
2+
3+
Using Gitpod for pandas development
4+
===================================
5+
6+
This section of the documentation will guide you through:
7+
8+
* using Gitpod for your pandas development environment
9+
* creating a personal fork of the pandas repository on GitHub
10+
* a quick tour of pandas and VSCode
11+
* working on the pandas documentation in Gitpod
12+
13+
Gitpod
14+
------
15+
16+
`Gitpod`_ is an open-source platform for automated and ready-to-code
17+
development environments. It enables developers to describe their dev
18+
environment as code and start instant and fresh development environments for
19+
each new task directly from your browser. This reduces the need to install local
20+
development environments and deal with incompatible dependencies.
21+
22+
23+
Gitpod GitHub integration
24+
-------------------------
25+
26+
To be able to use Gitpod, you will need to have the Gitpod app installed on your
27+
GitHub account, so if
28+
you do not have an account yet, you will need to create one first.
29+
30+
To get started just login at `Gitpod`_, and grant the appropriate permissions to GitHub.
31+
32+
We have built a python 3.8 environment and all development dependencies will
33+
install when the environment starts.
34+
35+
36+
Forking the pandas repository
37+
-----------------------------
38+
39+
The best way to work on pandas as a contributor is by making a fork of the
40+
repository first.
41+
42+
#. Browse to the `pandas repository on GitHub`_ and `create your own fork`_.
43+
44+
#. Browse to your fork. Your fork will have a URL like
45+
https://github.com/noatamir/pandas-dev, except with your GitHub username in place of
46+
``noatamir``.
47+
48+
Starting Gitpod
49+
---------------
50+
Once you have authenticated to Gitpod through GitHub, you can install the
51+
`Gitpod Chromium or Firefox browser extension <https://www.gitpod.io/docs/browser-extension>`_
52+
which will add a **Gitpod** button next to the **Code** button in the
53+
repository:
54+
55+
.. image:: ./gitpod-imgs/pandas-github.png
56+
:alt: pandas repository with Gitpod button screenshot
57+
58+
#. If you install the extension - you can click the **Gitpod** button to start
59+
a new workspace.
60+
61+
#. Alternatively, if you do not want to install the browser extension, you can
62+
visit https://gitpod.io/#https://github.com/USERNAME/pandas replacing
63+
``USERNAME`` with your GitHub username.
64+
65+
#. In both cases, this will open a new tab on your web browser and start
66+
building your development environment. Please note this can take a few
67+
minutes.
68+
69+
#. Once the build is complete, you will be directed to your workspace,
70+
including the VSCode editor and all the dependencies you need to work on
71+
pandas. The first time you start your workspace, you will notice that there
72+
might be some actions running. This will ensure that you have a development
73+
version of pandas installed.
74+
75+
#. When your workspace is ready, you can :ref:`test the build<contributing.running_tests>` by
76+
entering::
77+
78+
$ python -m pytest pandas
79+
80+
81+
Quick workspace tour
82+
--------------------
83+
Gitpod uses VSCode as the editor. If you have not used this editor before, you
84+
can check the Getting started `VSCode docs`_ to familiarize yourself with it.
85+
86+
Your workspace will look similar to the image below:
87+
88+
.. image:: ./gitpod-imgs/gitpod-workspace.png
89+
:alt: Gitpod workspace screenshot
90+
91+
We have marked some important sections in the editor:
92+
93+
#. Your current Python interpreter - by default, this is ``pandas-dev`` and
94+
should be displayed in the status bar and on your terminal. You do not need
95+
to activate the conda environment as this will always be activated for you.
96+
#. Your current branch is always displayed in the status bar. You can also use
97+
this button to change or create branches.
98+
#. GitHub Pull Requests extension - you can use this to work with Pull Requests
99+
from your workspace.
100+
#. Marketplace extensions - we have added some essential extensions to the pandas
101+
Gitpod. Still, you can also install other extensions or syntax highlighting
102+
themes for your user, and these will be preserved for you.
103+
#. Your workspace directory - by default, it is ``/workspace/pandas-dev``. **Do not
104+
change this** as this is the only directory preserved in Gitpod.
105+
106+
We have also pre-installed a few tools and VSCode extensions to help with the
107+
development experience:
108+
109+
* `VSCode rst extension <https://marketplace.visualstudio.com/items?itemName=lextudio.restructuredtext>`_
110+
* `Markdown All in One <https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one>`_
111+
* `VSCode Gitlens extension <https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens>`_
112+
* `VSCode Git Graph extension <https://marketplace.visualstudio.com/items?itemName=mhutchie.git-graph>`_
113+
114+
Development workflow with Gitpod
115+
--------------------------------
116+
The :ref:`contributing` section of this documentation contains
117+
information regarding the pandas development workflow. Make sure to check this
118+
before working on your contributions.
119+
120+
When using Gitpod, git is pre configured for you:
121+
122+
#. You do not need to configure your git username, and email as this should be
123+
done for you as you authenticated through GitHub. Unless you are using GitHub
124+
feature to keep email address private. You can check the git
125+
configuration with the command ``git config --list`` in your terminal. Use
126+
``git config --global user.email “[email protected]``
127+
to set your email address to the one you use to make commits with your github
128+
profile.
129+
#. As you started your workspace from your own pandas fork, you will by default
130+
have both ``upstream`` and ``origin`` added as remotes. You can verify this by
131+
typing ``git remote`` on your terminal or by clicking on the **branch name**
132+
on the status bar (see image below).
133+
134+
.. image:: ./gitpod-imgs/pandas-gitpod-branches.png
135+
:alt: Gitpod workspace branches plugin screenshot
136+
137+
Rendering the pandas documentation
138+
----------------------------------
139+
You can find the detailed documentation on how rendering the documentation with
140+
Sphinx works in the :ref:`contributing.howto-build-docs` section. To build the full
141+
docs you need to run the following command in the docs directory::
142+
143+
$ cd docs
144+
$ python make.py html
145+
146+
Alternatively you can build a single page with::
147+
148+
python make.py html python make.py --single development/contributing_gitpod.rst
149+
150+
You have two main options to render the documentation in Gitpod.
151+
152+
Option 1: using Liveserve
153+
~~~~~~~~~~~~~~~~~~~~~~~~~
154+
155+
#. View the documentation in ``pandas/doc/build/html``.
156+
#. To see the rendered version of a page, you can right-click on the ``.html``
157+
file and click on **Open with Live Serve**. Alternatively, you can open the
158+
file in the editor and click on the **Go live** button on the status bar.
159+
160+
.. image:: ./gitpod-imgs/vscode-statusbar.png
161+
:alt: Gitpod workspace VSCode start live serve screenshot
162+
163+
#. A simple browser will open to the right-hand side of the editor. We recommend
164+
closing it and click on the **Open in browser** button in the pop-up.
165+
#. To stop the server click on the **Port: 5500** button on the status bar.
166+
167+
Option 2: using the rst extension
168+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
169+
170+
A quick and easy way to see live changes in a ``.rst`` file as you work on it
171+
uses the rst extension with docutils.
172+
173+
.. note:: This will generate a simple live preview of the document without the
174+
``html`` theme, and some backlinks might not be added correctly. But it is an
175+
easy and lightweight way to get instant feedback on your work, without
176+
building the html files.
177+
178+
#. Open any of the source documentation files located in ``doc/source`` in the
179+
editor.
180+
#. Open VSCode Command Palette with :kbd:`Cmd-Shift-P` in Mac or
181+
:kbd:`Ctrl-Shift-P` in Linux and Windows. Start typing "restructured"
182+
and choose either "Open preview" or "Open preview to the Side".
183+
184+
.. image:: ./gitpod-imgs/vscode-rst.png
185+
:alt: Gitpod workspace VSCode open rst screenshot
186+
187+
#. As you work on the document, you will see a live rendering of it on the editor.
188+
189+
.. image:: ./gitpod-imgs/rst-rendering.png
190+
:alt: Gitpod workspace VSCode rst rendering screenshot
191+
192+
If you want to see the final output with the ``html`` theme you will need to
193+
rebuild the docs with ``make html`` and use Live Serve as described in option 1.
194+
195+
FAQ's and troubleshooting
196+
-------------------------
197+
198+
How long is my Gitpod workspace kept for?
199+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
200+
201+
Your stopped workspace will be kept for 14 days and deleted afterwards if you do
202+
not use them.
203+
204+
Can I come back to a previous workspace?
205+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
206+
207+
Yes, let's say you stepped away for a while and you want to carry on working on
208+
your pandas contributions. You need to visit https://gitpod.io/workspaces and
209+
click on the workspace you want to spin up again. All your changes will be there
210+
as you last left them.
211+
212+
Can I install additional VSCode extensions?
213+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
214+
215+
Absolutely! Any extensions you installed will be installed in your own workspace
216+
and preserved.
217+
218+
I registered on Gitpod but I still cannot see a ``Gitpod`` button in my repositories.
219+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
220+
221+
Head to https://gitpod.io/integrations and make sure you are logged in.
222+
Hover over GitHub and click on the three buttons that appear on the right.
223+
Click on edit permissions and make sure you have ``user:email``,
224+
``read:user``, and ``public_repo`` checked. Click on **Update Permissions**
225+
and confirm the changes in the GitHub application page.
226+
227+
.. image:: ./gitpod-imgs/gitpod-edit-permissions-gh.png
228+
:alt: Gitpod integrations - edit GH permissions screenshot
229+
230+
How long does my workspace stay active if I'm not using it?
231+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
232+
233+
If you keep your workspace open in a browser tab but don't interact with it,
234+
it will shut down after 30 minutes. If you close the browser tab, it will
235+
shut down after 3 minutes.
236+
237+
My terminal is blank - there is no cursor and it's completely unresponsive
238+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
239+
240+
Unfortunately this is a known-issue on Gitpod's side. You can sort this
241+
issue in two ways:
242+
243+
#. Create a new Gitpod workspace altogether.
244+
#. Head to your `Gitpod dashboard <https://gitpod.io/workspaces>`_ and locate
245+
the running workspace. Hover on it and click on the **three dots menu**
246+
and then click on **Stop**. When the workspace is completely stopped you
247+
can click on its name to restart it again.
248+
249+
.. image:: ./gitpod-imgs/gitpod-dashboard-stop.png
250+
:alt: Gitpod dashboard and workspace menu screenshot
251+
252+
I authenticated through GitHub but I still cannot commit to the repository through Gitpod.
253+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
254+
255+
Head to https://gitpod.io/integrations and make sure you are logged in.
256+
Hover over GitHub and click on the three buttons that appear on the right.
257+
Click on edit permissions and make sure you have ``public_repo`` checked.
258+
Click on **Update Permissions** and confirm the changes in the
259+
GitHub application page.
260+
261+
.. image:: ./gitpod-imgs/gitpod-edit-permissions-repo.png
262+
:alt: Gitpod integrations - edit GH repository permissions screenshot
263+
264+
Acknowledgments
265+
---------------
266+
267+
This page is lightly adapted from the `NumPy`_ project .
268+
269+
.. _Gitpod: https://www.gitpod.io/
270+
.. _pandas repository on GitHub: https://github.com/pandas-dev/pandas
271+
.. _create your own fork: https://help.github.com/en/articles/fork-a-repo
272+
.. _VSCode docs: https://code.visualstudio.com/docs/getstarted/tips-and-tricks
273+
.. _NumPy: https://www.numpy.org/
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

doc/source/reference/indexing.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -253,14 +253,14 @@ MultiIndex
253253
----------
254254
.. autosummary::
255255
:toctree: api/
256-
:template: autosummary/class_without_autosummary.rst
257256

258-
MultiIndex
257+
IndexSlice
259258

260259
.. autosummary::
261260
:toctree: api/
261+
:template: autosummary/class_without_autosummary.rst
262262

263-
IndexSlice
263+
MultiIndex
264264

265265
MultiIndex constructors
266266
~~~~~~~~~~~~~~~~~~~~~~~

doc/source/user_guide/groupby.rst

+1
Original file line numberDiff line numberDiff line change
@@ -1083,6 +1083,7 @@ The dimension of the returned result can also change:
10831083
def f(group):
10841084
return pd.DataFrame({'original': group,
10851085
'demeaned': group - group.mean()})
1086+
10861087
grouped.apply(f)
10871088
10881089
``apply`` on a Series can operate on a returned value from the applied function,

0 commit comments

Comments
 (0)