Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into bug/categorical-i…
Browse files Browse the repository at this point in the history
…ndexing-1row-df

* upstream/master: (32 commits)
  DEPR: Series.cat.categorical (pandas-dev#29914)
  DEPR: infer_dtype default for skipna is now True (pandas-dev#29876)
  Fix broken asv (pandas-dev#29906)
  DEPR: Remove weekday_name (pandas-dev#29831)
  Fix mypy errors for pandas\tests\series\test_operators.py (pandas-dev#29826)
  CI: Setting path only once in GitHub Actions (pandas-dev#29867)
  DEPR: passing td64 data to DTA or dt64 data to TDA (pandas-dev#29794)
  CLN: remove unsupported sparse code from io.pytables (pandas-dev#29863)
  x.__class__ TO type(x) (pandas-dev#29889)
  DEPR: ftype, ftypes (pandas-dev#29895)
  REF: use named funcs instead of lambdas (pandas-dev#29841)
  Correct type inference for UInt64Index during access (pandas-dev#29420)
  CLN: follow-up to 29725 (pandas-dev#29890)
  CLN: trim unnecessary code in indexing tests (pandas-dev#29845)
  TST added test for groupby agg on mulitlevel column (pandas-dev#29772) (pandas-dev#29866)
  mypy fix (pandas-dev#29891)
  Typing annotations (pandas-dev#29850)
  Fix mypy error in pandas/tests.indexes.test_base.py (pandas-dev#29188)
  CLN: remove never-used kwargs, make kwargs explicit (pandas-dev#29873)
  TYP: Added typing to __eq__ functions (pandas-dev#29818)
  ...
  • Loading branch information
keechongtan committed Nov 29, 2019
2 parents 2b71592 + ea2e26a commit e5c1420
Show file tree
Hide file tree
Showing 88 changed files with 463 additions and 1,053 deletions.
17 changes: 4 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ on:

env:
ENV_FILE: environment.yml
# TODO: remove export PATH=... in each step once this works
# PATH: $HOME/miniconda3/bin:$PATH

jobs:
checks:
Expand All @@ -20,68 +18,61 @@ jobs:
- name: Checkout
uses: actions/checkout@v1

- name: Setting conda path
run: echo "::set-env name=PATH::${HOME}/miniconda3/bin:${PATH}"

- name: Looking for unwanted patterns
run: ci/code_checks.sh patterns
if: true

- name: Setup environment and build pandas
run: |
export PATH=$HOME/miniconda3/bin:$PATH
ci/setup_env.sh
run: ci/setup_env.sh
if: true

- name: Linting
run: |
export PATH=$HOME/miniconda3/bin:$PATH
source activate pandas-dev
ci/code_checks.sh lint
if: true

- name: Dependencies consistency
run: |
export PATH=$HOME/miniconda3/bin:$PATH
source activate pandas-dev
ci/code_checks.sh dependencies
if: true

- name: Checks on imported code
run: |
export PATH=$HOME/miniconda3/bin:$PATH
source activate pandas-dev
ci/code_checks.sh code
if: true

- name: Running doctests
run: |
export PATH=$HOME/miniconda3/bin:$PATH
source activate pandas-dev
ci/code_checks.sh doctests
if: true

- name: Docstring validation
run: |
export PATH=$HOME/miniconda3/bin:$PATH
source activate pandas-dev
ci/code_checks.sh docstrings
if: true

- name: Typing validation
run: |
export PATH=$HOME/miniconda3/bin:$PATH
source activate pandas-dev
ci/code_checks.sh typing
if: true

- name: Testing docstring validation script
run: |
export PATH=$HOME/miniconda3/bin:$PATH
source activate pandas-dev
pytest --capture=no --strict scripts
if: true

- name: Running benchmarks
run: |
export PATH=$HOME/miniconda3/bin:$PATH
source activate pandas-dev
cd asv_bench
asv check -E existing
Expand Down
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,11 @@ pip install pandas
```

## Dependencies
- [NumPy](https://www.numpy.org): 1.13.3 or higher
- [python-dateutil](https://labix.org/python-dateutil): 2.5.0 or higher
- [pytz](https://pythonhosted.org/pytz): 2015.4 or higher
- [NumPy](https://www.numpy.org)
- [python-dateutil](https://labix.org/python-dateutil)
- [pytz](https://pythonhosted.org/pytz)

See the [full installation instructions](https://pandas.pydata.org/pandas-docs/stable/install.html#dependencies)
for recommended and optional dependencies.
See the [full installation instructions](https://pandas.pydata.org/pandas-docs/stable/install.html#dependencies) for minimum supported versions of required, recommended and optional dependencies.

## Installation from sources
To install pandas from source you need Cython in addition to the normal
Expand Down
2 changes: 1 addition & 1 deletion asv_bench/benchmarks/timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class InferFreq:
def setup(self, freq):
if freq is None:
self.idx = date_range(start="1/1/1700", freq="D", periods=10000)
self.idx.freq = None
self.idx._data._freq = None
else:
self.idx = date_range(start="1/1/1700", freq=freq, periods=10000)

Expand Down
89 changes: 0 additions & 89 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,95 +16,6 @@ jobs:
name: Windows
vmImage: vs2017-win2016

- job: 'Checks'
pool:
vmImage: ubuntu-16.04
timeoutInMinutes: 90
steps:
- script: |
echo '##vso[task.prependpath]$(HOME)/miniconda3/bin'
echo '##vso[task.setvariable variable=ENV_FILE]environment.yml'
echo '##vso[task.setvariable variable=AZURE]true'
displayName: 'Setting environment variables'
# Do not require a conda environment
- script: ci/code_checks.sh patterns
displayName: 'Looking for unwanted patterns'
condition: true

- script: |
sudo apt-get update
sudo apt-get install -y libc6-dev-i386
ci/setup_env.sh
displayName: 'Setup environment and build pandas'
condition: true
# Do not require pandas
- script: |
source activate pandas-dev
ci/code_checks.sh lint
displayName: 'Linting'
condition: true
- script: |
source activate pandas-dev
ci/code_checks.sh dependencies
displayName: 'Dependencies consistency'
condition: true
# Require pandas
- script: |
source activate pandas-dev
ci/code_checks.sh code
displayName: 'Checks on imported code'
condition: true
- script: |
source activate pandas-dev
ci/code_checks.sh doctests
displayName: 'Running doctests'
condition: true
- script: |
source activate pandas-dev
ci/code_checks.sh docstrings
displayName: 'Docstring validation'
condition: true
- script: |
source activate pandas-dev
ci/code_checks.sh typing
displayName: 'Typing validation'
condition: true
- script: |
source activate pandas-dev
pytest --capture=no --strict scripts
displayName: 'Testing docstring validation script'
condition: true
- script: |
source activate pandas-dev
cd asv_bench
asv check -E existing
git remote add upstream https://github.com/pandas-dev/pandas.git
git fetch upstream
if git diff upstream/master --name-only | grep -q "^asv_bench/"; then
asv machine --yes
ASV_OUTPUT="$(asv dev)"
if [[ $(echo "$ASV_OUTPUT" | grep "failed") ]]; then
echo "##vso[task.logissue type=error]Benchmarks run with errors"
echo "$ASV_OUTPUT"
exit 1
else
echo "Benchmarks run without errors"
fi
else
echo "Benchmarks did not run, no changes detected"
fi
displayName: 'Running benchmarks'
condition: true
- job: 'Web_and_Docs'
pool:
vmImage: ubuntu-16.04
Expand Down
7 changes: 0 additions & 7 deletions doc/redirects.csv
Original file line number Diff line number Diff line change
Expand Up @@ -357,10 +357,8 @@ generated/pandas.DataFrame.from_csv,../reference/api/pandas.DataFrame.from_csv
generated/pandas.DataFrame.from_dict,../reference/api/pandas.DataFrame.from_dict
generated/pandas.DataFrame.from_items,../reference/api/pandas.DataFrame.from_items
generated/pandas.DataFrame.from_records,../reference/api/pandas.DataFrame.from_records
generated/pandas.DataFrame.ftypes,../reference/api/pandas.DataFrame.ftypes
generated/pandas.DataFrame.ge,../reference/api/pandas.DataFrame.ge
generated/pandas.DataFrame.get_dtype_counts,../reference/api/pandas.DataFrame.get_dtype_counts
generated/pandas.DataFrame.get_ftype_counts,../reference/api/pandas.DataFrame.get_ftype_counts
generated/pandas.DataFrame.get,../reference/api/pandas.DataFrame.get
generated/pandas.DataFrame.get_value,../reference/api/pandas.DataFrame.get_value
generated/pandas.DataFrame.get_values,../reference/api/pandas.DataFrame.get_values
Expand Down Expand Up @@ -883,10 +881,8 @@ generated/pandas.Panel.first_valid_index,../reference/api/pandas.Panel.first_val
generated/pandas.Panel.floordiv,../reference/api/pandas.Panel.floordiv
generated/pandas.Panel.from_dict,../reference/api/pandas.Panel.from_dict
generated/pandas.Panel.fromDict,../reference/api/pandas.Panel.fromDict
generated/pandas.Panel.ftypes,../reference/api/pandas.Panel.ftypes
generated/pandas.Panel.ge,../reference/api/pandas.Panel.ge
generated/pandas.Panel.get_dtype_counts,../reference/api/pandas.Panel.get_dtype_counts
generated/pandas.Panel.get_ftype_counts,../reference/api/pandas.Panel.get_ftype_counts
generated/pandas.Panel.get,../reference/api/pandas.Panel.get
generated/pandas.Panel.get_value,../reference/api/pandas.Panel.get_value
generated/pandas.Panel.get_values,../reference/api/pandas.Panel.get_values
Expand Down Expand Up @@ -1223,11 +1219,8 @@ generated/pandas.Series.flags,../reference/api/pandas.Series.flags
generated/pandas.Series.floordiv,../reference/api/pandas.Series.floordiv
generated/pandas.Series.from_array,../reference/api/pandas.Series.from_array
generated/pandas.Series.from_csv,../reference/api/pandas.Series.from_csv
generated/pandas.Series.ftype,../reference/api/pandas.Series.ftype
generated/pandas.Series.ftypes,../reference/api/pandas.Series.ftypes
generated/pandas.Series.ge,../reference/api/pandas.Series.ge
generated/pandas.Series.get_dtype_counts,../reference/api/pandas.Series.get_dtype_counts
generated/pandas.Series.get_ftype_counts,../reference/api/pandas.Series.get_ftype_counts
generated/pandas.Series.get,../reference/api/pandas.Series.get
generated/pandas.Series.get_value,../reference/api/pandas.Series.get_value
generated/pandas.Series.get_values,../reference/api/pandas.Series.get_values
Expand Down
1 change: 0 additions & 1 deletion doc/source/reference/frame.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ Attributes and underlying data
:toctree: api/

DataFrame.dtypes
DataFrame.ftypes
DataFrame.get_dtype_counts
DataFrame.select_dtypes
DataFrame.values
Expand Down
2 changes: 0 additions & 2 deletions doc/source/reference/series.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ Attributes
Series.array
Series.values
Series.dtype
Series.ftype
Series.shape
Series.nbytes
Series.ndim
Expand All @@ -43,7 +42,6 @@ Attributes
Series.flags
Series.empty
Series.dtypes
Series.ftypes
Series.data
Series.name
Series.put
Expand Down
2 changes: 1 addition & 1 deletion doc/source/user_guide/scale.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Use efficient datatypes

The default pandas data types are not the most memory efficient. This is
especially true for text data columns with relatively few unique values (commonly
referred to as "low-cardinality" data). By using more efficient data types you
referred to as "low-cardinality" data). By using more efficient data types, you
can store larger datasets in memory.

.. ipython:: python
Expand Down
7 changes: 3 additions & 4 deletions doc/source/user_guide/timeseries.rst
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,6 @@ There are several time/date properties that one can access from ``Timestamp`` or
week,"The week ordinal of the year"
dayofweek,"The number of the day of the week with Monday=0, Sunday=6"
weekday,"The number of the day of the week with Monday=0, Sunday=6"
weekday_name,"The name of the day in a week (ex: Friday)"
quarter,"Quarter of the date: Jan-Mar = 1, Apr-Jun = 2, etc."
days_in_month,"The number of days in the month of the datetime"
is_month_start,"Logical indicating if first day of month (defined by frequency)"
Expand Down Expand Up @@ -1591,18 +1590,18 @@ labels.
s = pd.date_range('2000-01-01', '2000-01-05').to_series()
s.iloc[2] = pd.NaT
s.dt.weekday_name
s.dt.day_name()
# default: label='left', closed='left'
s.resample('B').last().dt.weekday_name
s.resample('B').last().dt.day_name()
Notice how the value for Sunday got pulled back to the previous Friday.
To get the behavior where the value for Sunday is pushed to Monday, use
instead

.. ipython:: python
s.resample('B', label='right', closed='right').last().dt.weekday_name
s.resample('B', label='right', closed='right').last().dt.day_name()
The ``axis`` parameter can be set to 0 or 1 and allows you to resample the
specified axis for a ``DataFrame``.
Expand Down
9 changes: 8 additions & 1 deletion doc/source/whatsnew/v1.0.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,14 @@ or ``matplotlib.Axes.plot``. See :ref:`plotting.formatters` for more.
**Other removals**

- Floordiv of integer-dtyped array by :class:`Timedelta` now raises ``TypeError`` (:issue:`21036`)
- :func:`pandas.api.types.infer_dtype` argument ``skipna`` defaults to ``True`` instead of ``False`` (:issue:`24050`)
- Removed the previously deprecated :meth:`Index.summary` (:issue:`18217`)
- Removed the previously deprecated "fastpath" keyword from the :class:`Index` constructor (:issue:`23110`)
- Removed the previously deprecated :meth:`Series.get_value`, :meth:`Series.set_value`, :meth:`DataFrame.get_value`, :meth:`DataFrame.set_value` (:issue:`17739`)
- Changed the the default value of `inplace` in :meth:`DataFrame.set_index` and :meth:`Series.set_axis`. It now defaults to False (:issue:`27600`)
- Removed the previously deprecated :attr:`Series.cat.categorical`, :attr:`Series.cat.index`, :attr:`Series.cat.name` (:issue:`24751`)
- Removed support for nested renaming in :meth:`DataFrame.aggregate`, :meth:`Series.aggregate`, :meth:`DataFrameGroupBy.aggregate`, :meth:`SeriesGroupBy.aggregate`, :meth:`Rolling.aggregate` (:issue:`18529`)
- Passing ``datetime64`` data to :class:`TimedeltaIndex` or ``timedelta64`` data to ``DatetimeIndex`` now raises ``TypeError`` (:issue:`23539`, :issue:`23937`)
- A tuple passed to :meth:`DataFrame.groupby` is now exclusively treated as a single key (:issue:`18314`)
- Removed :meth:`Series.from_array` (:issue:`18258`)
- Removed :meth:`DataFrame.from_items` (:issue:`18458`)
Expand Down Expand Up @@ -439,6 +443,7 @@ or ``matplotlib.Axes.plot``. See :ref:`plotting.formatters` for more.
- Removed the previously deprecated :meth:`Series.valid`; use :meth:`Series.dropna` instead (:issue:`18800`)
- Removed the previously properties :attr:`DataFrame.is_copy`, :attr:`Series.is_copy` (:issue:`18812`)
- Removed the previously deprecated :meth:`DataFrame.get_ftype_counts`, :meth:`Series.get_ftype_counts` (:issue:`18243`)
- Removed the previously deprecated :meth:`DataFrame.ftypes`, :meth:`Series.ftypes`, :meth:`Series.ftype` (:issue:`26744`)
- Removed the previously deprecated :meth:`Index.get_duplicated`, use ``idx[idx.duplicated()].unique()`` instead (:issue:`20239`)
- Removed the previously deprecated :meth:`Series.clip_upper`, :meth:`Series.clip_lower`, :meth:`DataFrame.clip_upper`, :meth:`DataFrame.clip_lower` (:issue:`24203`)
- Removed the ability to alter :attr:`DatetimeIndex.freq`, :attr:`TimedeltaIndex.freq`, or :attr:`PeriodIndex.freq` (:issue:`20772`)
Expand All @@ -452,6 +457,7 @@ or ``matplotlib.Axes.plot``. See :ref:`plotting.formatters` for more.
- Removed previously deprecated keyword "n" from :meth:`DatetimeIndex.shift`, :meth:`TimedeltaIndex.shift`, :meth:`PeriodIndex.shift`, use "periods" instead (:issue:`22458`)
- Changed the default value for the `raw` argument in :func:`Series.rolling().apply() <pandas.core.window.Rolling.apply>`, :func:`DataFrame.rolling().apply() <pandas.core.window.Rolling.apply>`,
- :func:`Series.expanding().apply() <pandas.core.window.Expanding.apply>`, and :func:`DataFrame.expanding().apply() <pandas.core.window.Expanding.apply>` to ``False`` (:issue:`20584`)
- Removed previously deprecated :attr:`Timestamp.weekday_name`, :attr:`DatetimeIndex.weekday_name`, and :attr:`Series.dt.weekday_name` (:issue:`18164`)
-

.. _whatsnew_1000.performance:
Expand Down Expand Up @@ -533,7 +539,8 @@ Numeric
- Improved error message when using `frac` > 1 and `replace` = False (:issue:`27451`)
- Bug in numeric indexes resulted in it being possible to instantiate an :class:`Int64Index`, :class:`UInt64Index`, or :class:`Float64Index` with an invalid dtype (e.g. datetime-like) (:issue:`29539`)
- Bug in :class:`UInt64Index` precision loss while constructing from a list with values in the ``np.uint64`` range (:issue:`29526`)
-
- Bug in :class:`NumericIndex` construction that caused indexing to fail when integers in the ``np.uint64`` range were used (:issue:`28023`)
- Bug in :class:`NumericIndex` construction that caused :class:`UInt64Index` to be casted to :class:`Float64Index` when integers in the ``np.uint64`` range were used to index a :class:`DataFrame` (:issue:`28279`)

Conversion
^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ dependencies:
- fastparquet>=0.3.2 # pandas.read_parquet, DataFrame.to_parquet
- html5lib # pandas.read_html
- lxml # pandas.read_html
- openpyxl # pandas.read_excel, DataFrame.to_excel, pandas.ExcelWriter, pandas.ExcelFile
- openpyxl<=3.0.1 # pandas.read_excel, DataFrame.to_excel, pandas.ExcelWriter, pandas.ExcelFile
- pyarrow>=0.13.1 # pandas.read_parquet, DataFrame.to_parquet, pandas.read_feather, DataFrame.to_feather
- pyqt>=5.9.2 # pandas.read_clipboard
- pytables>=3.4.2 # pandas.read_hdf, DataFrame.to_hdf
Expand Down
1 change: 1 addition & 0 deletions pandas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
_np_version_under1p15,
_np_version_under1p16,
_np_version_under1p17,
_np_version_under1p18,
)

try:
Expand Down
2 changes: 1 addition & 1 deletion pandas/_libs/internals.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ cdef class BlockPlacement:
else:
v = self._as_array

return f'{self.__class__.__name__}({v})'
return f'{type(self).__name__}({v})'

def __repr__(self) -> str:
return str(self)
Expand Down
Loading

0 comments on commit e5c1420

Please sign in to comment.