Skip to content

Patch 7 #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Sep 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,18 @@ install:
# create our env
- cmd: conda create -n pandas python=%PYTHON_VERSION% cython pytest>=3.1.0 pytest-xdist
- cmd: activate pandas
- cmd: pip install moto
- SET REQ=ci\requirements-%PYTHON_VERSION%_WIN.run
- cmd: echo "installing requirements from %REQ%"
- cmd: conda install -n pandas --file=%REQ%
- cmd: conda list -n pandas
- cmd: echo "installing requirements from %REQ% - done"

# add some pip only reqs to the env
- SET REQ=ci\requirements-%PYTHON_VERSION%_WIN.pip
- cmd: echo "installing requirements from %REQ%"
- cmd: pip install -Ur %REQ%

# build em using the local source checkout in the correct windows env
- cmd: '%CMD_IN_ENV% python setup.py build_ext --inplace'

Expand Down
3 changes: 3 additions & 0 deletions asv_bench/benchmarks/categoricals.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ def time_value_counts_dropna(self):
def time_rendering(self):
str(self.sel)

def time_set_categories(self):
self.ts.cat.set_categories(self.ts.cat.categories[::2])


class Categoricals3(object):
goal_time = 0.2
Expand Down
59 changes: 59 additions & 0 deletions asv_bench/benchmarks/period.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,65 @@ def time_value_counts_pindex(self):
self.i.value_counts()


class Properties(object):
def setup(self):
self.per = Period('2017-09-06 08:28', freq='min')

def time_year(self):
self.per.year

def time_month(self):
self.per.month

def time_day(self):
self.per.day

def time_hour(self):
self.per.hour

def time_minute(self):
self.per.minute

def time_second(self):
self.per.second

def time_is_leap_year(self):
self.per.is_leap_year

def time_quarter(self):
self.per.quarter

def time_qyear(self):
self.per.qyear

def time_week(self):
self.per.week

def time_daysinmonth(self):
self.per.daysinmonth

def time_dayofweek(self):
self.per.dayofweek

def time_dayofyear(self):
self.per.dayofyear

def time_start_time(self):
self.per.start_time

def time_end_time(self):
self.per.end_time

def time_to_timestamp():
self.per.to_timestamp()

def time_now():
self.per.now()

def time_asfreq():
self.per.asfreq('A')


class period_standard_indexing(object):
goal_time = 0.2

Expand Down
1 change: 1 addition & 0 deletions ci/install_circle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ time conda create -n pandas -q --file=${REQ_BUILD} || exit 1
time conda install -n pandas pytest>=3.1.0 || exit 1

source activate pandas
time pip install moto || exit 1

# build but don't install
echo "[build em]"
Expand Down
2 changes: 1 addition & 1 deletion ci/install_travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ if [ -e ${REQ} ]; then
fi

time conda install -n pandas pytest>=3.1.0
time pip install pytest-xdist
time pip install pytest-xdist moto

if [ "$LINT" ]; then
conda install flake8
Expand Down
Empty file added ci/requirements-2.7_WIN.pip
Empty file.
Empty file.
Empty file added ci/requirements-3.6_WIN.pip
Empty file.
1 change: 1 addition & 0 deletions ci/requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ cython
pytest>=3.1.0
pytest-cov
flake8
moto
10 changes: 5 additions & 5 deletions doc/source/advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ Index Types
We have discussed ``MultiIndex`` in the previous sections pretty extensively. ``DatetimeIndex`` and ``PeriodIndex``
are shown :ref:`here <timeseries.overview>`. ``TimedeltaIndex`` are :ref:`here <timedeltas.timedeltas>`.

In the following sub-sections we will highlite some other index types.
In the following sub-sections we will highlight some other index types.

.. _indexing.categoricalindex:

Expand All @@ -645,7 +645,7 @@ and allows efficient indexing and storage of an index with a large number of dup
df.dtypes
df.B.cat.categories
Setting the index, will create create a ``CategoricalIndex``
Setting the index, will create a ``CategoricalIndex``

.. ipython:: python
Expand Down Expand Up @@ -681,7 +681,7 @@ Groupby operations on the index will preserve the index nature as well
Reindexing operations, will return a resulting index based on the type of the passed
indexer, meaning that passing a list will return a plain-old-``Index``; indexing with
a ``Categorical`` will return a ``CategoricalIndex``, indexed according to the categories
of the PASSED ``Categorical`` dtype. This allows one to arbitrarly index these even with
of the PASSED ``Categorical`` dtype. This allows one to arbitrarily index these even with
values NOT in the categories, similarly to how you can reindex ANY pandas index.

.. ipython :: python
Expand Down Expand Up @@ -722,7 +722,7 @@ Int64Index and RangeIndex
Prior to 0.18.0, the ``Int64Index`` would provide the default index for all ``NDFrame`` objects.
``RangeIndex`` is a sub-class of ``Int64Index`` added in version 0.18.0, now providing the default index for all ``NDFrame`` objects.
``RangeIndex`` is an optimized version of ``Int64Index`` that can represent a monotonic ordered set. These are analagous to python `range types <https://docs.python.org/3/library/stdtypes.html#typesseq-range>`__.
``RangeIndex`` is an optimized version of ``Int64Index`` that can represent a monotonic ordered set. These are analogous to python `range types <https://docs.python.org/3/library/stdtypes.html#typesseq-range>`__.
.. _indexing.float64index:
Expand Down Expand Up @@ -963,7 +963,7 @@ index can be somewhat complicated. For example, the following does not work:
s.loc['c':'e'+1]
A very common use case is to limit a time series to start and end at two
specific dates. To enable this, we made the design design to make label-based
specific dates. To enable this, we made the design to make label-based
slicing include both endpoints:
.. ipython:: python
Expand Down
11 changes: 10 additions & 1 deletion doc/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,19 @@ Top-level dealing with datetimelike
to_timedelta
date_range
bdate_range
cdate_range
period_range
timedelta_range
infer_freq

Top-level dealing with intervals
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. autosummary::
:toctree: generated/

interval_range

Top-level evaluation
~~~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -1282,7 +1291,7 @@ Index
-----

**Many of these methods or variants thereof are available on the objects
that contain an index (Series/Dataframe) and those should most likely be
that contain an index (Series/DataFrame) and those should most likely be
used before calling these methods directly.**

.. autosummary::
Expand Down
2 changes: 1 addition & 1 deletion doc/source/basics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@ Passing a named function will yield that name for the row:
Aggregating with a dict
+++++++++++++++++++++++

Passing a dictionary of column names to a scalar or a list of scalars, to ``DataFame.agg``
Passing a dictionary of column names to a scalar or a list of scalars, to ``DataFrame.agg``
allows you to customize which functions are applied to which columns. Note that the results
are not in any particular order, you can use an ``OrderedDict`` instead to guarantee ordering.

Expand Down
2 changes: 1 addition & 1 deletion doc/source/computation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ aggregation with, outputting a DataFrame:
r['A'].agg([np.sum, np.mean, np.std])
On a widowed DataFrame, you can pass a list of functions to apply to each
On a windowed DataFrame, you can pass a list of functions to apply to each
column, which produces an aggregated result with a hierarchical index:

.. ipython:: python
Expand Down
4 changes: 2 additions & 2 deletions doc/source/groupby.rst
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ must be either implemented on GroupBy or available via :ref:`dispatching
.. note::

If you pass a dict to ``aggregate``, the ordering of the output colums is
If you pass a dict to ``aggregate``, the ordering of the output columns is
non-deterministic. If you want to be sure the output columns will be in a specific
order, you can use an ``OrderedDict``. Compare the output of the following two commands:

Expand Down Expand Up @@ -1211,7 +1211,7 @@ Groupby by Indexer to 'resample' data

Resampling produces new hypothetical samples (resamples) from already existing observed data or from a model that generates data. These new samples are similar to the pre-existing samples.

In order to resample to work on indices that are non-datetimelike , the following procedure can be utilized.
In order to resample to work on indices that are non-datetimelike, the following procedure can be utilized.

In the following examples, **df.index // 5** returns a binary array which is used to determine what gets selected for the groupby operation.

Expand Down
2 changes: 1 addition & 1 deletion doc/source/indexing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ Finally, one can also set a seed for ``sample``'s random number generator using
Setting With Enlargement
------------------------

The ``.loc/[]`` operations can perform enlargement when setting a non-existant key for that axis.
The ``.loc/[]`` operations can perform enlargement when setting a non-existent key for that axis.

In the ``Series`` case this is effectively an appending operation

Expand Down
2 changes: 1 addition & 1 deletion doc/source/io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3077,7 +3077,7 @@ Compressed pickle files

.. versionadded:: 0.20.0

:func:`read_pickle`, :meth:`DataFame.to_pickle` and :meth:`Series.to_pickle` can read
:func:`read_pickle`, :meth:`DataFrame.to_pickle` and :meth:`Series.to_pickle` can read
and write compressed pickle files. The compression types of ``gzip``, ``bz2``, ``xz`` are supported for reading and writing.
`zip`` file supports read only and must contain only one data file
to be read in.
Expand Down
6 changes: 3 additions & 3 deletions doc/source/merging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1329,7 +1329,7 @@ By default we are taking the asof of the quotes.
on='time',
by='ticker')
We only asof within ``2ms`` betwen the quote time and the trade time.
We only asof within ``2ms`` between the quote time and the trade time.

.. ipython:: python
Expand All @@ -1338,8 +1338,8 @@ We only asof within ``2ms`` betwen the quote time and the trade time.
by='ticker',
tolerance=pd.Timedelta('2ms'))
We only asof within ``10ms`` betwen the quote time and the trade time and we exclude exact matches on time.
Note that though we exclude the exact matches (of the quotes), prior quotes DO propogate to that point
We only asof within ``10ms`` between the quote time and the trade time and we exclude exact matches on time.
Note that though we exclude the exact matches (of the quotes), prior quotes DO propagate to that point
in time.

.. ipython:: python
Expand Down
2 changes: 1 addition & 1 deletion doc/source/missing_data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ Interpolation

The ``limit_direction`` keyword argument was added.

Both Series and Dataframe objects have an ``interpolate`` method that, by default,
Both Series and DataFrame objects have an ``interpolate`` method that, by default,
performs linear interpolation at missing datapoints.

.. ipython:: python
Expand Down
4 changes: 2 additions & 2 deletions doc/source/options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,9 @@ display.large_repr truncate For DataFrames exceeding max_ro
display.latex.repr False Whether to produce a latex DataFrame
representation for jupyter frontends
that support it.
display.latex.escape True Escapes special caracters in Dataframes, when
display.latex.escape True Escapes special characters in DataFrames, when
using the to_latex method.
display.latex.longtable False Specifies if the to_latex method of a Dataframe
display.latex.longtable False Specifies if the to_latex method of a DataFrame
uses the longtable format.
display.latex.multicolumn True Combines columns when using a MultiIndex
display.latex.multicolumn_format 'l' Alignment of multicolumn labels
Expand Down
2 changes: 1 addition & 1 deletion doc/source/reshaping.rst
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ the level numbers:
stacked.unstack('second')
Notice that the ``stack`` and ``unstack`` methods implicitly sort the index
levels involved. Hence a call to ``stack`` and then ``unstack``, or viceversa,
levels involved. Hence a call to ``stack`` and then ``unstack``, or vice versa,
will result in a **sorted** copy of the original DataFrame or Series:

.. ipython:: python
Expand Down
2 changes: 1 addition & 1 deletion doc/source/sparse.rst
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ dtype, ``fill_value`` default changes:
s.to_sparse()
You can change the dtype using ``.astype()``, the result is also sparse. Note that
``.astype()`` also affects to the ``fill_value`` to keep its dense represantation.
``.astype()`` also affects to the ``fill_value`` to keep its dense representation.


.. ipython:: python
Expand Down
2 changes: 1 addition & 1 deletion doc/source/style.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Notice the similarity with the standard `df.applymap`, which operates on DataFrames elementwise. We want you to be able to resuse your existing knowledge of how to interact with DataFrames.\n",
"Notice the similarity with the standard `df.applymap`, which operates on DataFrames elementwise. We want you to be able to reuse your existing knowledge of how to interact with DataFrames.\n",
"\n",
"Notice also that our function returned a string containing the CSS attribute and value, separated by a colon just like in a `<style>` tag. This will be a common theme.\n",
"\n",
Expand Down
27 changes: 18 additions & 9 deletions doc/source/timeseries.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,7 @@ as ``BusinessHour`` except that it skips specified custom holidays.
# Tuesday after MLK Day (Monday is skipped because it's a holiday)
dt + bhour_us * 2

You can use keyword arguments suported by either ``BusinessHour`` and ``CustomBusinessDay``.
You can use keyword arguments supported by either ``BusinessHour`` and ``CustomBusinessDay``.

.. ipython:: python

Expand Down Expand Up @@ -1088,7 +1088,7 @@ frequencies. We will refer to these aliases as *offset aliases*.
"BMS", "business month start frequency"
"CBMS", "custom business month start frequency"
"Q", "quarter end frequency"
"BQ", "business quarter endfrequency"
"BQ", "business quarter end frequency"
"QS", "quarter start frequency"
"BQS", "business quarter start frequency"
"A, Y", "year end frequency"
Expand Down Expand Up @@ -1132,13 +1132,13 @@ For some frequencies you can specify an anchoring suffix:
:header: "Alias", "Description"
:widths: 15, 100

"W\-SUN", "weekly frequency (sundays). Same as 'W'"
"W\-MON", "weekly frequency (mondays)"
"W\-TUE", "weekly frequency (tuesdays)"
"W\-WED", "weekly frequency (wednesdays)"
"W\-THU", "weekly frequency (thursdays)"
"W\-FRI", "weekly frequency (fridays)"
"W\-SAT", "weekly frequency (saturdays)"
"W\-SUN", "weekly frequency (Sundays). Same as 'W'"
"W\-MON", "weekly frequency (Mondays)"
"W\-TUE", "weekly frequency (Tuesdays)"
"W\-WED", "weekly frequency (Wednesdays)"
"W\-THU", "weekly frequency (Thursdays)"
"W\-FRI", "weekly frequency (Fridays)"
"W\-SAT", "weekly frequency (Saturdays)"
"(B)Q(S)\-DEC", "quarterly frequency, year ends in December. Same as 'Q'"
"(B)Q(S)\-JAN", "quarterly frequency, year ends in January"
"(B)Q(S)\-FEB", "quarterly frequency, year ends in February"
Expand Down Expand Up @@ -1705,6 +1705,15 @@ has multiplied span.

pd.PeriodIndex(start='2014-01', freq='3M', periods=4)

If ``start`` or ``end`` are ``Period`` objects, they will be used as anchor
endpoints for a ``PeriodIndex`` with frequency matching that of the
``PeriodIndex`` constructor.

.. ipython:: python

pd.PeriodIndex(start=pd.Period('2017Q1', freq='Q'),
end=pd.Period('2017Q2', freq='Q'), freq='M')

Just like ``DatetimeIndex``, a ``PeriodIndex`` can also be used to index pandas
objects:

Expand Down
2 changes: 1 addition & 1 deletion doc/source/visualization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ Histogram can be stacked by ``stacked=True``. Bin size can be changed by ``bins`
plt.close('all')
You can pass other keywords supported by matplotlib ``hist``. For example, horizontal and cumulative histgram can be drawn by ``orientation='horizontal'`` and ``cumulative='True'``.
You can pass other keywords supported by matplotlib ``hist``. For example, horizontal and cumulative histogram can be drawn by ``orientation='horizontal'`` and ``cumulative=True``.

.. ipython:: python
Expand Down
Loading