Search is not available for this dataset
repo_id stringlengths 12 110 | file_path stringlengths 24 164 | content stringlengths 3 89.3M | __index_level_0__ int64 0 0 |
|---|---|---|---|
public_repos/pandas/doc/source | public_repos/pandas/doc/source/user_guide/enhancingperf.rst | .. _enhancingperf:
{{ header }}
*********************
Enhancing performance
*********************
In this part of the tutorial, we will investigate how to speed up certain
functions operating on pandas :class:`DataFrame` using Cython, Numba and :func:`pandas.eval`.
Generally, using Cython and Numba can offer a large... | 0 |
public_repos/pandas/doc/source | public_repos/pandas/doc/source/user_guide/10min.rst | .. _10min:
{{ header }}
********************
10 minutes to pandas
********************
This is a short introduction to pandas, geared mainly for new users.
You can see more complex recipes in the :ref:`Cookbook<cookbook>`.
Customarily, we import as follows:
.. ipython:: python
import numpy as np
import pand... | 0 |
public_repos/pandas/doc/source | public_repos/pandas/doc/source/user_guide/copy_on_write.rst | .. _copy_on_write:
{{ header }}
*******************
Copy-on-Write (CoW)
*******************
Copy-on-Write was first introduced in version 1.5.0. Starting from version 2.0 most of the
optimizations that become possible through CoW are implemented and supported. All possible
optimizations are supported starting from p... | 0 |
public_repos/pandas/doc/source | public_repos/pandas/doc/source/user_guide/timeseries.rst | .. _timeseries:
{{ header }}
********************************
Time series / date functionality
********************************
pandas contains extensive capabilities and features for working with time series data for all domains.
Using the NumPy ``datetime64`` and ``timedelta64`` dtypes, pandas has consolidated a l... | 0 |
public_repos/pandas/doc/source | public_repos/pandas/doc/source/user_guide/pyarrow.rst | .. _pyarrow:
{{ header }}
*********************
PyArrow Functionality
*********************
pandas can utilize `PyArrow <https://arrow.apache.org/docs/python/index.html>`__ to extend functionality and improve the performance
of various APIs. This includes:
* More extensive `data types <https://arrow.apache.org/docs... | 0 |
public_repos/pandas/doc/source | public_repos/pandas/doc/source/user_guide/indexing.rst | .. _indexing:
{{ header }}
***************************
Indexing and selecting data
***************************
The axis labeling information in pandas objects serves many purposes:
* Identifies data (i.e. provides *metadata*) using known indicators,
important for analysis, visualization, and interactive console d... | 0 |
public_repos/pandas/doc/source | public_repos/pandas/doc/source/user_guide/groupby.rst | .. _groupby:
{{ header }}
*****************************
Group by: split-apply-combine
*****************************
By "group by" we are referring to a process involving one or more of the following
steps:
* **Splitting** the data into groups based on some criteria.
* **Applying** a function to each group independe... | 0 |
public_repos/pandas/doc/source | public_repos/pandas/doc/source/user_guide/missing_data.rst | .. _missing_data:
{{ header }}
*************************
Working with missing data
*************************
Values considered "missing"
~~~~~~~~~~~~~~~~~~~~~~~~~~~
pandas uses different sentinel values to represent a missing (also referred to as NA)
depending on the data type.
``numpy.nan`` for NumPy data types. ... | 0 |
public_repos/pandas/doc/source | public_repos/pandas/doc/source/user_guide/boolean.rst | .. currentmodule:: pandas
.. ipython:: python
:suppress:
import pandas as pd
import numpy as np
.. _boolean:
**************************
Nullable Boolean data type
**************************
.. note::
BooleanArray is currently experimental. Its API or implementation may
change without warning.
.. _... | 0 |
public_repos/pandas/doc/source | public_repos/pandas/doc/source/user_guide/gotchas.rst | .. _gotchas:
{{ header }}
********************************
Frequently Asked Questions (FAQ)
********************************
.. _df-memory-usage:
DataFrame memory usage
----------------------
The memory usage of a :class:`DataFrame` (including the index) is shown when calling
the :meth:`~DataFrame.info`. A configur... | 0 |
public_repos/pandas/doc/source | public_repos/pandas/doc/source/user_guide/options.rst | .. _options:
{{ header }}
********************
Options and settings
********************
Overview
--------
pandas has an options API configure and customize global behavior related to
:class:`DataFrame` display, data behavior and more.
Options have a full "dotted-style", case-insensitive name (e.g. ``display.max_ro... | 0 |
public_repos/pandas/doc/source | public_repos/pandas/doc/source/user_guide/basics.rst | .. _basics:
{{ header }}
==============================
Essential basic functionality
==============================
Here we discuss a lot of the essential functionality common to the pandas data
structures. To begin, let's create some example objects like we did in
the :ref:`10 minutes to pandas <10min>` section:
... | 0 |
public_repos/pandas/doc/source | public_repos/pandas/doc/source/user_guide/window.rst | .. _window:
{{ header }}
********************
Windowing operations
********************
pandas contains a compact set of APIs for performing windowing operations - an operation that performs
an aggregation over a sliding partition of values. The API functions similarly to the ``groupby`` API
in that :class:`Series` ... | 0 |
public_repos/pandas/doc/source | public_repos/pandas/doc/source/user_guide/index.rst | {{ header }}
.. _user_guide:
==========
User Guide
==========
The User Guide covers all of pandas by topic area. Each of the subsections
introduces a topic (such as "working with missing data"), and discusses how
pandas approaches the problem, with many examples throughout.
Users brand-new to pandas should start wi... | 0 |
public_repos/pandas/doc/source | public_repos/pandas/doc/source/user_guide/merging.rst | .. _merging:
{{ header }}
.. ipython:: python
:suppress:
from matplotlib import pyplot as plt
import pandas.util._doctools as doctools
p = doctools.TablePlotter()
************************************
Merge, join, concatenate and compare
************************************
pandas provides various met... | 0 |
public_repos/pandas/doc/source | public_repos/pandas/doc/source/user_guide/text.rst | .. _text:
{{ header }}
======================
Working with text data
======================
.. _text.types:
Text data types
---------------
There are two ways to store text data in pandas:
1. ``object`` -dtype NumPy array.
2. :class:`StringDtype` extension type.
We recommend using :class:`StringDtype` to store t... | 0 |
public_repos/pandas/doc/source | public_repos/pandas/doc/source/user_guide/scale.rst | .. _scale:
*************************
Scaling to large datasets
*************************
pandas provides data structures for in-memory analytics, which makes using pandas
to analyze datasets that are larger than memory datasets somewhat tricky. Even datasets
that are a sizable fraction of memory become unwieldy, as s... | 0 |
public_repos/pandas/doc/source | public_repos/pandas/doc/source/user_guide/cookbook.rst | .. _cookbook:
{{ header }}
********
Cookbook
********
This is a repository for *short and sweet* examples and links for useful pandas recipes.
We encourage users to add to this documentation.
Adding interesting links and/or inline examples to this section is a great *First Pull Request*.
Simplified, condensed, new... | 0 |
public_repos/pandas/doc/source | public_repos/pandas/doc/source/user_guide/sparse.rst | .. _sparse:
{{ header }}
**********************
Sparse data structures
**********************
pandas provides data structures for efficiently storing sparse data.
These are not necessarily sparse in the typical "mostly 0". Rather, you can view these
objects as being "compressed" where any data matching a specific va... | 0 |
public_repos/pandas/doc/source | public_repos/pandas/doc/source/user_guide/visualization.rst | .. _visualization:
{{ header }}
*******************
Chart visualization
*******************
.. note::
The examples below assume that you're using `Jupyter <https://jupyter.org/>`_.
This section demonstrates visualization through charting. For information on
visualization of tabular data please see the section ... | 0 |
public_repos/pandas/doc/source | public_repos/pandas/doc/source/user_guide/integer_na.rst | .. currentmodule:: pandas
{{ header }}
.. _integer_na:
**************************
Nullable integer data type
**************************
.. note::
IntegerArray is currently experimental. Its API or implementation may
change without warning. Uses :attr:`pandas.NA` as the missing value.
In :ref:`missing_data`,... | 0 |
public_repos/pandas/doc/source | public_repos/pandas/doc/source/user_guide/duplicates.rst | .. _duplicates:
****************
Duplicate Labels
****************
:class:`Index` objects are not required to be unique; you can have duplicate row
or column labels. This may be a bit confusing at first. If you're familiar with
SQL, you know that row labels are similar to a primary key on a table, and you
would never... | 0 |
public_repos/pandas/doc/source | public_repos/pandas/doc/source/user_guide/io.rst | .. _io:
.. currentmodule:: pandas
===============================
IO tools (text, CSV, HDF5, ...)
===============================
The pandas I/O API is a set of top level ``reader`` functions accessed like
:func:`pandas.read_csv` that generally return a pandas object. The corresponding
``writer`` functions are obje... | 0 |
public_repos/pandas/doc/source | public_repos/pandas/doc/source/user_guide/dsintro.rst | .. _dsintro:
{{ header }}
************************
Intro to data structures
************************
We'll start with a quick, non-comprehensive overview of the fundamental data
structures in pandas to get you started. The fundamental behavior about data
types, indexing, axis labeling, and alignment apply across all... | 0 |
public_repos/pandas/doc/source | public_repos/pandas/doc/source/user_guide/style.ipynb | import matplotlib.pyplot
# We have this here to trigger matplotlib's font cache stuff.
# This cell is hidden from the outputimport pandas as pd
import numpy as np
import matplotlib as mpl
df = pd.DataFrame({
"strings": ["Adam", "Mike"],
"ints": [1, 3],
"floats": [1.123, 1000.23]
})
df.style \
.format(pre... | 0 |
public_repos/pandas/doc/source | public_repos/pandas/doc/source/user_guide/reshaping.rst | .. _reshaping:
{{ header }}
**************************
Reshaping and pivot tables
**************************
.. _reshaping.reshaping:
pandas provides methods for manipulating a :class:`Series` and :class:`DataFrame` to alter the
representation of the data for further data processing or data summarization.
* :func... | 0 |
public_repos/pandas/doc/source | public_repos/pandas/doc/source/user_guide/timedeltas.rst | .. _timedeltas:
{{ header }}
.. _timedeltas.timedeltas:
***********
Time deltas
***********
Timedeltas are differences in times, expressed in difference units, e.g. days, hours, minutes,
seconds. They can be both positive and negative.
``Timedelta`` is a subclass of ``datetime.timedelta``, and behaves in a similar... | 0 |
public_repos/pandas/doc/source | public_repos/pandas/doc/source/user_guide/categorical.rst | .. _categorical:
{{ header }}
****************
Categorical data
****************
This is an introduction to pandas categorical data type, including a short comparison
with R's ``factor``.
``Categoricals`` are a pandas data type corresponding to categorical variables in
statistics. A categorical variable takes on a ... | 0 |
public_repos/pandas/doc/source | public_repos/pandas/doc/source/user_guide/advanced.rst | .. _advanced:
{{ header }}
******************************
MultiIndex / advanced indexing
******************************
This section covers :ref:`indexing with a MultiIndex <advanced.hierarchical>`
and :ref:`other advanced indexing features <advanced.index_types>`.
See the :ref:`Indexing and Selecting Data <indexin... | 0 |
public_repos/pandas/doc/source/user_guide | public_repos/pandas/doc/source/user_guide/templates/myhtml.tpl | {% extends "html_table.tpl" %}
{% block table %}
<h1>{{ table_title|default("My Table") }}</h1>
{{ super() }}
{% endblock table %}
| 0 |
public_repos/pandas/doc/source/user_guide | public_repos/pandas/doc/source/user_guide/templates/html_style_structure.html | <!--
This is an HTML fragment that gets included into a notebook & rst document
Inspired by nbconvert
https://github.com/jupyter/nbconvert/blob/8ac591a0b8694147d0f34bf6392594c2811c1395/docs/source/template_structure.html
-->
<style type="text/css">
/* Overrides of notebook CSS for static HTML ... | 0 |
public_repos/pandas/doc/source/user_guide | public_repos/pandas/doc/source/user_guide/templates/html_table_structure.html | <!--
This is an HTML fragment that gets included into a notebook & rst document
Inspired by nbconvert
https://github.com/jupyter/nbconvert/blob/8ac591a0b8694147d0f34bf6392594c2811c1395/docs/source/template_structure.html
-->
<style type="text/css">
/* Overrides of notebook CSS for static HTML ... | 0 |
public_repos/pandas/doc/source | public_repos/pandas/doc/source/getting_started/tutorials.rst | .. _communitytutorials:
{{ header }}
*******************
Community tutorials
*******************
This is a guide to many pandas tutorials by the community, geared mainly for new users.
pandas cookbook by Julia Evans
------------------------------
The goal of this 2015 cookbook (by `Julia Evans <https://jvns.ca>`_)... | 0 |
public_repos/pandas/doc/source | public_repos/pandas/doc/source/getting_started/overview.rst | .. _overview:
{{ header }}
****************
Package overview
****************
pandas is a `Python <https://www.python.org>`__ package providing fast,
flexible, and expressive data structures designed to make working with
"relational" or "labeled" data both easy and intuitive. It aims to be the
fundamental high-level... | 0 |
public_repos/pandas/doc/source | public_repos/pandas/doc/source/getting_started/install.rst | .. _install:
{{ header }}
============
Installation
============
The easiest way to install pandas is to install it
as part of the `Anaconda <https://docs.continuum.io/free/anaconda/>`__ distribution, a
cross platform distribution for data analysis and scientific computing.
The `Conda <https://conda.io/en/latest/>`_... | 0 |
public_repos/pandas/doc/source | public_repos/pandas/doc/source/getting_started/index.rst | {{ header }}
.. _getting_started:
===============
Getting started
===============
Installation
------------
.. grid:: 1 2 2 2
:gutter: 4
.. grid-item-card:: Working with conda?
:class-card: install-card
:columns: 12 12 6 6
:padding: 3
pandas is part of the `Anaconda <https:... | 0 |
public_repos/pandas/doc/source/getting_started | public_repos/pandas/doc/source/getting_started/comparison/comparison_with_sas.rst | .. _compare_with_sas:
{{ header }}
Comparison with SAS
********************
For potential users coming from `SAS <https://en.wikipedia.org/wiki/SAS_(software)>`__
this page is meant to demonstrate how different SAS operations would be
performed in pandas.
.. include:: includes/introduction.rst
Data structures
---... | 0 |
public_repos/pandas/doc/source/getting_started | public_repos/pandas/doc/source/getting_started/comparison/comparison_with_spreadsheets.rst | .. _compare_with_spreadsheets:
{{ header }}
Comparison with spreadsheets
****************************
Since many potential pandas users have some familiarity with spreadsheet programs like
`Excel <https://support.microsoft.com/en-us/excel>`_, this page is meant to provide some examples
of how various spreadsheet ope... | 0 |
public_repos/pandas/doc/source/getting_started | public_repos/pandas/doc/source/getting_started/comparison/comparison_with_stata.rst | .. _compare_with_stata:
{{ header }}
Comparison with Stata
*********************
For potential users coming from `Stata <https://en.wikipedia.org/wiki/Stata>`__
this page is meant to demonstrate how different Stata operations would be
performed in pandas.
.. include:: includes/introduction.rst
Data structures
----... | 0 |
public_repos/pandas/doc/source/getting_started | public_repos/pandas/doc/source/getting_started/comparison/comparison_with_sql.rst | .. _compare_with_sql:
{{ header }}
Comparison with SQL
********************
Since many potential pandas users have some familiarity with
`SQL <https://en.wikipedia.org/wiki/SQL>`_, this page is meant to provide some examples of how
various SQL operations would be performed using pandas.
.. include:: includes/introdu... | 0 |
public_repos/pandas/doc/source/getting_started | public_repos/pandas/doc/source/getting_started/comparison/index.rst | {{ header }}
.. _comparison:
===========================
Comparison with other tools
===========================
.. toctree::
:maxdepth: 2
comparison_with_r
comparison_with_sql
comparison_with_spreadsheets
comparison_with_sas
comparison_with_stata
| 0 |
public_repos/pandas/doc/source/getting_started | public_repos/pandas/doc/source/getting_started/comparison/comparison_with_r.rst | .. _compare_with_r:
{{ header }}
Comparison with R / R libraries
*******************************
Since pandas aims to provide a lot of the data manipulation and analysis
functionality that people use `R <https://www.r-project.org/>`__ for, this page
was started to provide a more detailed look at the `R language
<htt... | 0 |
public_repos/pandas/doc/source/getting_started/comparison | public_repos/pandas/doc/source/getting_started/comparison/includes/find_substring.rst | You can find the position of a character in a column of strings with the :meth:`Series.str.find`
method. ``find`` searches for the first position of the substring. If the substring is found, the
method returns its position. If not found, it returns ``-1``. Keep in mind that Python indexes are
zero-based.
.. ipython:: ... | 0 |
public_repos/pandas/doc/source/getting_started/comparison | public_repos/pandas/doc/source/getting_started/comparison/includes/merge_setup.rst | The following tables will be used in the merge examples:
.. ipython:: python
df1 = pd.DataFrame({"key": ["A", "B", "C", "D"], "value": np.random.randn(4)})
df1
df2 = pd.DataFrame({"key": ["B", "D", "D", "E"], "value": np.random.randn(4)})
df2
| 0 |
public_repos/pandas/doc/source/getting_started/comparison | public_repos/pandas/doc/source/getting_started/comparison/includes/merge.rst | pandas DataFrames have a :meth:`~DataFrame.merge` method, which provides similar functionality. The
data does not have to be sorted ahead of time, and different join types are accomplished via the
``how`` keyword.
.. ipython:: python
inner_join = df1.merge(df2, on=["key"], how="inner")
inner_join
left_join ... | 0 |
public_repos/pandas/doc/source/getting_started/comparison | public_repos/pandas/doc/source/getting_started/comparison/includes/length.rst | You can find the length of a character string with :meth:`Series.str.len`.
In Python 3, all strings are Unicode strings. ``len`` includes trailing blanks.
Use ``len`` and ``rstrip`` to exclude trailing blanks.
.. ipython:: python
tips["time"].str.len()
tips["time"].str.rstrip().str.len()
| 0 |
public_repos/pandas/doc/source/getting_started/comparison | public_repos/pandas/doc/source/getting_started/comparison/includes/nth_word.rst | The simplest way to extract words in pandas is to split the strings by spaces, then reference the
word by index. Note there are more powerful approaches should you need them.
.. ipython:: python
firstlast = pd.DataFrame({"String": ["John Smith", "Jane Cook"]})
firstlast["First_Name"] = firstlast["String"].str.s... | 0 |
public_repos/pandas/doc/source/getting_started/comparison | public_repos/pandas/doc/source/getting_started/comparison/includes/transform.rst | pandas provides a :ref:`groupby.transform` mechanism that allows these type of operations to be
succinctly expressed in one operation.
.. ipython:: python
gb = tips.groupby("smoker")["total_bill"]
tips["adj_total_bill"] = tips["total_bill"] - gb.transform("mean")
tips
| 0 |
public_repos/pandas/doc/source/getting_started/comparison | public_repos/pandas/doc/source/getting_started/comparison/includes/limit.rst | By default, pandas will truncate output of large ``DataFrame``\s to show the first and last rows.
This can be overridden by :ref:`changing the pandas options <options>`, or using
:meth:`DataFrame.head` or :meth:`DataFrame.tail`.
.. ipython:: python
tips.head(5)
| 0 |
public_repos/pandas/doc/source/getting_started/comparison | public_repos/pandas/doc/source/getting_started/comparison/includes/groupby.rst | pandas provides a flexible ``groupby`` mechanism that allows similar aggregations. See the
:ref:`groupby documentation<groupby>` for more details and examples.
.. ipython:: python
tips_summed = tips.groupby(["sex", "smoker"])[["total_bill", "tip"]].sum()
tips_summed
| 0 |
public_repos/pandas/doc/source/getting_started/comparison | public_repos/pandas/doc/source/getting_started/comparison/includes/construct_dataframe.rst | A pandas ``DataFrame`` can be constructed in many different ways,
but for a small number of values, it is often convenient to specify it as
a Python dictionary, where the keys are the column names
and the values are the data.
.. ipython:: python
df = pd.DataFrame({"x": [1, 3, 5], "y": [2, 4, 6]})
df
| 0 |
public_repos/pandas/doc/source/getting_started/comparison | public_repos/pandas/doc/source/getting_started/comparison/includes/column_operations.rst | pandas provides vectorized operations by specifying the individual ``Series`` in the
``DataFrame``. New columns can be assigned in the same way. The :meth:`DataFrame.drop` method drops
a column from the ``DataFrame``.
.. ipython:: python
tips["total_bill"] = tips["total_bill"] - 2
tips["new_bill"] = tips["total... | 0 |
public_repos/pandas/doc/source/getting_started/comparison | public_repos/pandas/doc/source/getting_started/comparison/includes/extract_substring.rst | With pandas you can use ``[]`` notation to extract a substring
from a string by position locations. Keep in mind that Python
indexes are zero-based.
.. ipython:: python
tips["sex"].str[0:1]
| 0 |
public_repos/pandas/doc/source/getting_started/comparison | public_repos/pandas/doc/source/getting_started/comparison/includes/introduction.rst | If you're new to pandas, you might want to first read through :ref:`10 Minutes to pandas<10min>`
to familiarize yourself with the library.
As is customary, we import pandas and NumPy as follows:
.. ipython:: python
import pandas as pd
import numpy as np
| 0 |
public_repos/pandas/doc/source/getting_started/comparison | public_repos/pandas/doc/source/getting_started/comparison/includes/time_date.rst | .. ipython:: python
tips["date1"] = pd.Timestamp("2013-01-15")
tips["date2"] = pd.Timestamp("2015-02-15")
tips["date1_year"] = tips["date1"].dt.year
tips["date2_month"] = tips["date2"].dt.month
tips["date1_next"] = tips["date1"] + pd.offsets.MonthBegin()
tips["months_between"] = tips["date2"].dt.to_p... | 0 |
public_repos/pandas/doc/source/getting_started/comparison | public_repos/pandas/doc/source/getting_started/comparison/includes/if_then.rst | The same operation in pandas can be accomplished using
the ``where`` method from ``numpy``.
.. ipython:: python
tips["bucket"] = np.where(tips["total_bill"] < 10, "low", "high")
tips
.. ipython:: python
:suppress:
tips = tips.drop("bucket", axis=1)
| 0 |
public_repos/pandas/doc/source/getting_started/comparison | public_repos/pandas/doc/source/getting_started/comparison/includes/missing_intro.rst | pandas represents missing data with the special float value ``NaN`` (not a number). Many of the
semantics are the same; for example missing data propagates through numeric operations, and is
ignored by default for aggregations.
.. ipython:: python
outer_join
outer_join["value_x"] + outer_join["value_y"]
out... | 0 |
public_repos/pandas/doc/source/getting_started/comparison | public_repos/pandas/doc/source/getting_started/comparison/includes/sorting.rst | pandas has a :meth:`DataFrame.sort_values` method, which takes a list of columns to sort by.
.. ipython:: python
tips = tips.sort_values(["sex", "total_bill"])
tips
| 0 |
public_repos/pandas/doc/source/getting_started/comparison | public_repos/pandas/doc/source/getting_started/comparison/includes/filtering.rst | DataFrames can be filtered in multiple ways; the most intuitive of which is using
:ref:`boolean indexing <indexing.boolean>`.
.. ipython:: python
tips[tips["total_bill"] > 10]
The above statement is simply passing a ``Series`` of ``True``/``False`` objects to the DataFrame,
returning all rows with ``True``.
.. i... | 0 |
public_repos/pandas/doc/source/getting_started/comparison | public_repos/pandas/doc/source/getting_started/comparison/includes/column_selection.rst | The same operations are expressed in pandas below.
Keep certain columns
''''''''''''''''''''
.. ipython:: python
tips[["sex", "total_bill", "tip"]]
Drop a column
'''''''''''''
.. ipython:: python
tips.drop("sex", axis=1)
Rename a column
'''''''''''''''
.. ipython:: python
tips.rename(columns={"total_b... | 0 |
public_repos/pandas/doc/source/getting_started/comparison | public_repos/pandas/doc/source/getting_started/comparison/includes/missing.rst | In pandas, :meth:`Series.isna` and :meth:`Series.notna` can be used to filter the rows.
.. ipython:: python
outer_join[outer_join["value_x"].isna()]
outer_join[outer_join["value_x"].notna()]
pandas provides :ref:`a variety of methods to work with missing data <missing_data>`. Here are some examples:
Drop rows... | 0 |
public_repos/pandas/doc/source/getting_started/comparison | public_repos/pandas/doc/source/getting_started/comparison/includes/copies.rst | Most pandas operations return copies of the ``Series``/``DataFrame``. To make the changes "stick",
you'll need to either assign to a new variable:
.. code-block:: python
sorted_df = df.sort_values("col1")
or overwrite the original one:
.. code-block:: python
df = df.sort_values("col1")
.. note:... | 0 |
public_repos/pandas/doc/source/getting_started/comparison | public_repos/pandas/doc/source/getting_started/comparison/includes/case.rst | The equivalent pandas methods are :meth:`Series.str.upper`, :meth:`Series.str.lower`, and
:meth:`Series.str.title`.
.. ipython:: python
firstlast = pd.DataFrame({"string": ["John Smith", "Jane Cook"]})
firstlast["upper"] = firstlast["string"].str.upper()
firstlast["lower"] = firstlast["string"].str.lower()
... | 0 |
public_repos/pandas/doc/source/getting_started | public_repos/pandas/doc/source/getting_started/intro_tutorials/08_combine_dataframes.rst | .. _10min_tut_08_combine:
{{ header }}
.. ipython:: python
import pandas as pd
.. raw:: html
<div class="card gs-data">
<div class="card-header gs-data-header">
<div class="gs-data-title">
Data used for this tutorial:
</div>
</div>
<ul class="... | 0 |
public_repos/pandas/doc/source/getting_started | public_repos/pandas/doc/source/getting_started/intro_tutorials/10_text_data.rst | .. _10min_tut_10_text:
{{ header }}
.. ipython:: python
import pandas as pd
.. raw:: html
<div class="card gs-data">
<div class="card-header gs-data-header">
<div class="gs-data-title">
Data used for this tutorial:
</div>
</div>
<ul class="lis... | 0 |
public_repos/pandas/doc/source/getting_started | public_repos/pandas/doc/source/getting_started/intro_tutorials/07_reshape_table_layout.rst | .. _10min_tut_07_reshape:
{{ header }}
.. ipython:: python
import pandas as pd
.. raw:: html
<div class="card gs-data">
<div class="card-header gs-data-header">
<div class="gs-data-title">
Data used for this tutorial:
</div>
</div>
<ul class="... | 0 |
public_repos/pandas/doc/source/getting_started | public_repos/pandas/doc/source/getting_started/intro_tutorials/09_timeseries.rst | .. _10min_tut_09_timeseries:
{{ header }}
.. ipython:: python
import pandas as pd
import matplotlib.pyplot as plt
.. raw:: html
<div class="card gs-data">
<div class="card-header gs-data-header">
<div class="gs-data-title">
Data used for this tutorial:
</... | 0 |
public_repos/pandas/doc/source/getting_started | public_repos/pandas/doc/source/getting_started/intro_tutorials/03_subset_data.rst | .. _10min_tut_03_subset:
{{ header }}
.. ipython:: python
import pandas as pd
.. raw:: html
<div class="card gs-data">
<div class="card-header gs-data-header">
<div class="gs-data-title">
Data used for this tutorial:
</div>
</div>
<ul class="l... | 0 |
public_repos/pandas/doc/source/getting_started | public_repos/pandas/doc/source/getting_started/intro_tutorials/06_calculate_statistics.rst | .. _10min_tut_06_stats:
{{ header }}
.. ipython:: python
import pandas as pd
.. raw:: html
<div class="card gs-data">
<div class="card-header gs-data-header">
<div class="gs-data-title">
Data used for this tutorial:
</div>
</div>
<ul class="li... | 0 |
public_repos/pandas/doc/source/getting_started | public_repos/pandas/doc/source/getting_started/intro_tutorials/01_table_oriented.rst | .. _10min_tut_01_tableoriented:
{{ header }}
What kind of data does pandas handle?
=====================================
.. raw:: html
<ul class="task-bullet">
<li>
I want to start using pandas
.. ipython:: python
import pandas as pd
To load the pandas package and start working with it, import t... | 0 |
public_repos/pandas/doc/source/getting_started | public_repos/pandas/doc/source/getting_started/intro_tutorials/index.rst | {{ header }}
.. _10times1minute:
=========================
Getting started tutorials
=========================
.. toctree::
:maxdepth: 1
01_table_oriented
02_read_write
03_subset_data
04_plotting
05_add_columns
06_calculate_statistics
07_reshape_table_layout
08_combine_dataframes... | 0 |
public_repos/pandas/doc/source/getting_started | public_repos/pandas/doc/source/getting_started/intro_tutorials/04_plotting.rst | .. _10min_tut_04_plotting:
{{ header }}
How do I create plots in pandas?
----------------------------------
.. image:: ../../_static/schemas/04_plot_overview.svg
:align: center
.. ipython:: python
import pandas as pd
import matplotlib.pyplot as plt
.. raw:: html
<div class="card gs-data">
... | 0 |
public_repos/pandas/doc/source/getting_started | public_repos/pandas/doc/source/getting_started/intro_tutorials/02_read_write.rst | .. _10min_tut_02_read_write:
{{ header }}
.. ipython:: python
import pandas as pd
.. raw:: html
<div class="card gs-data">
<div class="card-header gs-data-header">
<div class="gs-data-title">
Data used for this tutorial:
</div>
</div>
<ul clas... | 0 |
public_repos/pandas/doc/source/getting_started | public_repos/pandas/doc/source/getting_started/intro_tutorials/05_add_columns.rst | .. _10min_tut_05_columns:
{{ header }}
.. ipython:: python
import pandas as pd
.. raw:: html
<div class="card gs-data">
<div class="card-header gs-data-header">
<div class="gs-data-title">
Data used for this tutorial:
</div>
</div>
<ul class="... | 0 |
public_repos/pandas/doc/source/getting_started/intro_tutorials | public_repos/pandas/doc/source/getting_started/intro_tutorials/includes/air_quality_no2.rst | .. raw:: html
<div data-bs-toggle="collapse" href="#collapsedata" role="button" aria-expanded="false" aria-controls="collapsedata">
<span class="badge bg-secondary">Air quality data</span>
</div>
<div class="collapse" id="collapsedata">
<div class="card-body">
<p class="card-tex... | 0 |
public_repos/pandas/doc/source/getting_started/intro_tutorials | public_repos/pandas/doc/source/getting_started/intro_tutorials/includes/titanic.rst | .. raw:: html
<div data-bs-toggle="collapse" href="#collapsedata" role="button" aria-expanded="false" aria-controls="collapsedata">
<span class="badge bg-secondary">Titanic data</span>
</div>
<div class="collapse" id="collapsedata">
<div class="card-body">
<p class="card-text">
... | 0 |
public_repos/pandas/doc | public_repos/pandas/doc/sphinxext/contributors.py | """Sphinx extension for listing code contributors to a release.
Usage::
.. contributors:: v0.23.0..v0.23.1
This will be replaced with a message indicating the number of
code contributors and commits, and then list each contributor
individually. For development versions (before a tag is available)
use::
.. co... | 0 |
public_repos/pandas/doc | public_repos/pandas/doc/sphinxext/README.rst | sphinxext
=========
This directory contains custom sphinx extensions in use in the pandas
documentation.
| 0 |
public_repos/pandas/doc | public_repos/pandas/doc/sphinxext/announce.py | #!/usr/bin/env python3
"""
Script to generate contributor and pull request lists
This script generates contributor and pull request lists for release
announcements using GitHub v3 protocol. Use requires an authentication token in
order to have sufficient bandwidth, you can get one following the directions at
`<https:/... | 0 |
public_repos/pandas/doc | public_repos/pandas/doc/cheatsheet/README.md | # Pandas Cheat Sheet
The Pandas Cheat Sheet was created using Microsoft Powerpoint 2013.
To create the PDF version, within Powerpoint, simply do a "Save As"
and pick "PDF" as the format.
This cheat sheet, originally written by Irv Lustig, [Princeton Consultants](https://www.princetonoptimization.com/), was inspired b... | 0 |
public_repos/pandas/doc | public_repos/pandas/doc/_templates/sidebar-nav-bs.html | <nav class="bd-links" id="bd-docs-nav" aria-label="Main navigation">
<div class="bd-toc-item navbar-nav">
{% if pagename.startswith("reference") %}
{{ generate_toctree_html("sidebar", maxdepth=4, collapse=True, includehidden=True, titles_only=True) }}
{% else %}
{{ generate_toctree_html("sidebar", max... | 0 |
public_repos/pandas/doc | public_repos/pandas/doc/_templates/pandas_footer.html | <p class="copyright">
© {{copyright}} pandas via <a href="https://numfocus.org">NumFOCUS, Inc.</a> Hosted by <a href="https://www.ovhcloud.com">OVHcloud</a>.
</p>
| 0 |
public_repos/pandas/doc | public_repos/pandas/doc/_templates/api_redirect.html | {% set redirect = redirects[pagename.split("/")[-1]] %}
<html>
<head>
<meta http-equiv="Refresh" content="0; url={{ redirect }}.html" />
<title>This API page has moved</title>
</head>
<body>
<p>This API page has moved <a href="{{ redirect }}.html">here</a>.</p>
</body>
</html>
| 0 |
public_repos/pandas/doc/_templates | public_repos/pandas/doc/_templates/autosummary/accessor_method.rst | {{ fullname }}
{{ underline }}
.. currentmodule:: {{ module.split('.')[0] }}
.. autoaccessormethod:: {{ (module.split('.')[1:] + [objname]) | join('.') }}
| 0 |
public_repos/pandas/doc/_templates | public_repos/pandas/doc/_templates/autosummary/accessor_attribute.rst | {{ fullname }}
{{ underline }}
.. currentmodule:: {{ module.split('.')[0] }}
.. autoaccessorattribute:: {{ (module.split('.')[1:] + [objname]) | join('.') }}
| 0 |
public_repos/pandas/doc/_templates | public_repos/pandas/doc/_templates/autosummary/accessor.rst | {{ fullname }}
{{ underline }}
.. currentmodule:: {{ module.split('.')[0] }}
.. autoaccessor:: {{ (module.split('.')[1:] + [objname]) | join('.') }}
| 0 |
public_repos/pandas/doc/_templates | public_repos/pandas/doc/_templates/autosummary/class.rst | {{ fullname | escape | underline}}
.. currentmodule:: {{ module }}
.. autoclass:: {{ objname }}
{% block methods %}
{% block attributes %}
{% if attributes %}
.. rubric:: {{ _('Attributes') }}
.. autosummary::
{% for item in attributes %}
{% if item in members and not item.startswith('_') %... | 0 |
public_repos/pandas/doc/_templates | public_repos/pandas/doc/_templates/autosummary/accessor_callable.rst | {{ fullname }}
{{ underline }}
.. currentmodule:: {{ module.split('.')[0] }}
.. autoaccessorcallable:: {{ (module.split('.')[1:] + [objname]) | join('.') }}.__call__
| 0 |
public_repos/pandas/doc/_templates | public_repos/pandas/doc/_templates/autosummary/class_without_autosummary.rst | {{ fullname }}
{{ underline }}
.. currentmodule:: {{ module }}
.. autoclass:: {{ objname }}
| 0 |
public_repos/pandas/doc | public_repos/pandas/doc/scripts/eval_performance.py | from timeit import repeat as timeit
import numpy as np
import seaborn as sns
from pandas import DataFrame
setup_common = """from pandas import DataFrame
import numpy as np
df = DataFrame(np.random.randn(%d, 3), columns=list('abc'))
%s"""
setup_with = "s = 'a + b * (c ** 2 + b ** 2 - a) / (a * c) ** 3'"
def bench_... | 0 |
public_repos/pandas | public_repos/pandas/gitpod/settings.json | {
"esbonio.server.pythonPath": "/usr/local/bin/python",
"restructuredtext.linter.disabledLinters": ["doc8","rst-lint", "rstcheck"],
"python.defaultInterpreterPath": "/usr/local/bin/python"
}
| 0 |
public_repos/pandas | public_repos/pandas/gitpod/workspace_config | #!/bin/bash
# Basic configurations for the workspace
set -e
# gitpod/workspace-base needs at least one file here
touch /home/gitpod/.bashrc.d/empty
# Add git aliases
git config --global alias.co checkout
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.br branch
git c... | 0 |
public_repos/pandas | public_repos/pandas/gitpod/Dockerfile | #
# Dockerfile for pandas development
#
# Usage:
# -------
#
# To make a local build of the container, from the 'Docker-dev' directory:
# docker build --rm -f "Dockerfile" -t <build-tag> "."
#
# To use the container use the following command. It assumes that you are in
# the root folder of the pandas git repository, m... | 0 |
public_repos/pandas | public_repos/pandas/gitpod/gitpod.Dockerfile | # Doing a local shallow clone - keeps the container secure
# and much slimmer than using COPY directly or making a
# remote clone
ARG BASE_CONTAINER="pandas/pandas-dev:latest"
FROM gitpod/workspace-base:latest as clone
# the clone should be deep enough for versioneer to work
RUN git clone https://github.com/pandas-dev... | 0 |
public_repos/pandas | public_repos/pandas/.circleci/config.yml | version: 2.1
jobs:
test-arm:
machine:
image: ubuntu-2004:2022.04.1
resource_class: arm.large
environment:
ENV_FILE: ci/deps/circle-310-arm64.yaml
PYTEST_WORKERS: auto
PATTERN: "not single_cpu and not slow and not network and not clipboard and not arm_slow and not db"
PYTEST_... | 0 |
public_repos/pandas | public_repos/pandas/.circleci/setup_env.sh | #!/bin/bash -e
echo "Install Mambaforge"
MAMBA_URL="https://github.com/conda-forge/miniforge/releases/download/23.1.0-0/Mambaforge-23.1.0-0-Linux-aarch64.sh"
echo "Downloading $MAMBA_URL"
wget -q $MAMBA_URL -O minimamba.sh
chmod +x minimamba.sh
MAMBA_DIR="$HOME/miniconda3"
rm -rf $MAMBA_DIR
./minimamba.sh -b -p $MAMB... | 0 |
public_repos/pandas | public_repos/pandas/scripts/generate_pip_deps_from_conda.py | #!/usr/bin/env python3
"""
Convert the conda environment.yml to the pip requirements-dev.txt,
or check that they have the same packages (for the CI)
Usage:
Generate `requirements-dev.txt`
$ python scripts/generate_pip_deps_from_conda.py
Compare and fail (exit status != 0) if `requirements-dev.txt` has no... | 0 |
public_repos/pandas | public_repos/pandas/scripts/validate_unwanted_patterns.py | #!/usr/bin/env python3
"""
Unwanted patterns test cases.
The reason this file exist despite the fact we already have
`ci/code_checks.sh`,
(see https://github.com/pandas-dev/pandas/blob/master/ci/code_checks.sh)
is that some of the test cases are more complex/impossible to validate via regex.
So this file is somewhat ... | 0 |
public_repos/pandas | public_repos/pandas/scripts/sort_whatsnew_note.py | """
Sort whatsnew note blocks by issue number.
NOTE: this assumes that each entry is on its own line, and ends with an issue number.
If that's not the case, then an entry might not get sorted. However, virtually all
recent-enough whatsnew entries follow this pattern. So, although not perfect, this
script should be goo... | 0 |
public_repos/pandas | public_repos/pandas/scripts/run_vulture.py | """Look for unreachable code."""
import argparse
import sys
from vulture import Vulture
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("files", nargs="*")
args = parser.parse_args()
v = Vulture()
v.scavenge(args.files)
ret = 0
for item in v.get_unused_c... | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.