Skip to content

Commit 00563c6

Browse files
committed
Merge remote-tracking branch 'upstream/master' into unique-index
2 parents 2f2be76 + 6110608 commit 00563c6

Some content is hidden

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

49 files changed

+564
-756
lines changed

MANIFEST.in

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ graft pandas
1515
global-exclude *.bz2
1616
global-exclude *.csv
1717
global-exclude *.dta
18+
global-exclude *.feather
1819
global-exclude *.gz
1920
global-exclude *.h5
2021
global-exclude *.html
@@ -24,7 +25,10 @@ global-exclude *.pickle
2425
global-exclude *.png
2526
global-exclude *.pyc
2627
global-exclude *.pyd
28+
global-exclude *.ods
29+
global-exclude *.odt
2730
global-exclude *.sas7bdat
31+
global-exclude *.sav
2832
global-exclude *.so
2933
global-exclude *.xls
3034
global-exclude *.xlsm

doc/source/development/contributing.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ We'll now kick off a three-step process:
208208
209209
# Build and install pandas
210210
python setup.py build_ext --inplace -j 4
211-
python -m pip install -e --no-build-isolation .
211+
python -m pip install -e . --no-build-isolation
212212
213213
At this point you should be able to import pandas from your locally built version::
214214

@@ -252,7 +252,7 @@ You'll need to have at least python3.5 installed on your system.
252252
253253
# Build and install pandas
254254
python setup.py build_ext --inplace -j 4
255-
python -m pip install -e --no-build-isolation .
255+
python -m pip install -e . --no-build-isolation
256256
257257
Creating a branch
258258
-----------------

doc/source/user_guide/io.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -4845,7 +4845,7 @@ The above example creates a partitioned dataset that may look like:
48454845
from shutil import rmtree
48464846
try:
48474847
rmtree('test')
4848-
except Exception:
4848+
except OSError:
48494849
pass
48504850
48514851
.. _io.sql:

doc/source/user_guide/options.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ display.max_colwidth 50 The maximum width in charac
353353
a column in the repr of a pandas
354354
data structure. When the column overflows,
355355
a "..." placeholder is embedded in
356-
the output.
356+
the output. 'None' value means unlimited.
357357
display.max_info_columns 100 max_info_columns is used in DataFrame.info
358358
method to decide if per column information
359359
will be printed.

doc/source/whatsnew/v1.0.0.rst

+14-7
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ including other versions of pandas.
2121
Enhancements
2222
~~~~~~~~~~~~
2323

24+
- :meth:`DataFrame.to_string` added the ``max_colwidth`` parameter to control when wide columns are truncated (:issue:`9784`)
25+
-
2426

2527
.. _whatsnew_1000.enhancements.other:
2628

@@ -35,6 +37,15 @@ Other enhancements
3537
(:issue:`28368`)
3638
-
3739

40+
41+
Build Changes
42+
^^^^^^^^^^^^^
43+
44+
Pandas has added a `pyproject.toml <https://www.python.org/dev/peps/pep-0517/>`_ file and will no longer include
45+
cythonized files in the source distribution uploaded to PyPI (:issue:`28341`, :issue:`20775`). If you're installing
46+
a built distribution (wheel) or via conda, this shouldn't have any effect on you. If you're building pandas from
47+
source, you should no longer need to install Cython into your build environment before calling ``pip install pandas``.
48+
3849
.. _whatsnew_1000.api_breaking:
3950

4051
Backwards incompatible API changes
@@ -105,6 +116,7 @@ Performance improvements
105116
Bug fixes
106117
~~~~~~~~~
107118

119+
- Bug in :meth:`DataFrame.to_html` when using ``formatters=<list>`` and ``max_cols`` together. (:issue:`25955`)
108120

109121
Categorical
110122
^^^^^^^^^^^
@@ -169,6 +181,7 @@ Indexing
169181
^^^^^^^^
170182

171183
- Bug in assignment using a reverse slicer (:issue:`26939`)
184+
- Bug in :meth:`DataFrame.explode` would duplicate frame in the presence of duplicates in the index (:issue:`28010`)
172185
- Bug in reindexing a :meth:`PeriodIndex` with another type of index that contained a `Period` (:issue:`28323`) (:issue:`28337`)
173186
- Fix assignment of column via `.loc` with numpy non-ns datetime type (:issue:`27395`)
174187

@@ -191,6 +204,7 @@ I/O
191204
- Bug in :meth:`DataFrame.to_json` where using a Tuple as a column or index value and using ``orient="columns"`` or ``orient="index"`` would produce invalid JSON (:issue:`20500`)
192205
- Improve infinity parsing. :meth:`read_csv` now interprets ``Infinity``, ``+Infinity``, ``-Infinity`` as floating point values (:issue:`10065`)
193206
- Bug in :meth:`DataFrame.to_csv` where values were truncated when the length of ``na_rep`` was shorter than the text input data. (:issue:`25099`)
207+
- Bug in :func:`DataFrame.to_string` where values were truncated using display options instead of outputting the full content (:issue:`9784`)
194208

195209
Plotting
196210
^^^^^^^^
@@ -223,13 +237,6 @@ Sparse
223237
-
224238
-
225239

226-
227-
Build Changes
228-
^^^^^^^^^^^^^
229-
- Fixed pyqt development dependency issue because of different pyqt package name in conda and PyPI (:issue:`26838`)
230-
- Added a `pyproject.toml <https://www.python.org/dev/peps/pep-0517/>`_ file (:issue:`20775`)
231-
232-
233240
ExtensionArray
234241
^^^^^^^^^^^^^^
235242

pandas/core/arrays/sparse.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,10 @@ def construct_from_string(cls, string):
245245
if string.startswith("Sparse"):
246246
try:
247247
sub_type, has_fill_value = cls._parse_subtype(string)
248-
result = SparseDtype(sub_type)
249-
except Exception:
248+
except ValueError:
250249
raise TypeError(msg)
251250
else:
251+
result = SparseDtype(sub_type)
252252
msg = (
253253
"Could not construct SparseDtype from '{}'.\n\nIt "
254254
"looks like the fill_value in the string is not "

pandas/core/base.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -1289,17 +1289,17 @@ def value_counts(
12891289
12901290
Parameters
12911291
----------
1292-
normalize : boolean, default False
1292+
normalize : bool, default False
12931293
If True then the object returned will contain the relative
12941294
frequencies of the unique values.
1295-
sort : boolean, default True
1295+
sort : bool, default True
12961296
Sort by frequencies.
1297-
ascending : boolean, default False
1297+
ascending : bool, default False
12981298
Sort in ascending order.
1299-
bins : integer, optional
1299+
bins : int, optional
13001300
Rather than count values, group them into half-open bins,
13011301
a convenience for ``pd.cut``, only works with numeric data.
1302-
dropna : boolean, default True
1302+
dropna : bool, default True
13031303
Don't include counts of NaN.
13041304
13051305
Returns
@@ -1496,7 +1496,7 @@ def memory_usage(self, deep=False):
14961496
size_hint="",
14971497
sort=textwrap.dedent(
14981498
"""\
1499-
sort : boolean, default False
1499+
sort : bool, default False
15001500
Sort `uniques` and shuffle `labels` to maintain the
15011501
relationship.
15021502
"""

pandas/core/common.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -445,15 +445,15 @@ def pipe(obj, func, *args, **kwargs):
445445
446446
Parameters
447447
----------
448-
func : callable or tuple of (callable, string)
448+
func : callable or tuple of (callable, str)
449449
Function to apply to this object or, alternatively, a
450450
``(callable, data_keyword)`` tuple where ``data_keyword`` is a
451451
string indicating the keyword of `callable`` that expects the
452452
object.
453-
args : iterable, optional
454-
positional arguments passed into ``func``.
455-
kwargs : dict, optional
456-
a dictionary of keyword arguments passed into ``func``.
453+
*args : iterable, optional
454+
Positional arguments passed into ``func``.
455+
**kwargs : dict, optional
456+
A dictionary of keyword arguments passed into ``func``.
457457
458458
Returns
459459
-------

pandas/core/config_init.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,10 @@ def use_numexpr_cb(key):
148148
"""
149149

150150
max_colwidth_doc = """
151-
: int
151+
: int or None
152152
The maximum width in characters of a column in the repr of
153153
a pandas data structure. When the column overflows, a "..."
154-
placeholder is embedded in the output.
154+
placeholder is embedded in the output. A 'None' value means unlimited.
155155
"""
156156

157157
colheader_justify_doc = """
@@ -340,7 +340,9 @@ def is_terminal():
340340
validator=is_instance_factory([type(None), int]),
341341
)
342342
cf.register_option("max_categories", 8, pc_max_categories_doc, validator=is_int)
343-
cf.register_option("max_colwidth", 50, max_colwidth_doc, validator=is_int)
343+
cf.register_option(
344+
"max_colwidth", 50, max_colwidth_doc, validator=is_nonnegative_int
345+
)
344346
if is_terminal():
345347
max_cols = 0 # automatically determine optimal number of columns
346348
else:

pandas/core/dtypes/common.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -2049,10 +2049,8 @@ def pandas_dtype(dtype):
20492049
# raise a consistent TypeError if failed
20502050
try:
20512051
npdtype = np.dtype(dtype)
2052-
except Exception:
2053-
# we don't want to force a repr of the non-string
2054-
if not isinstance(dtype, str):
2055-
raise TypeError("data type not understood")
2052+
except SyntaxError:
2053+
# np.dtype uses `eval` which can raise SyntaxError
20562054
raise TypeError("data type '{}' not understood".format(dtype))
20572055

20582056
# Any invalid dtype (such as pd.Timestamp) should raise an error.

0 commit comments

Comments
 (0)