8000 Fixed docstrings as referenced in issue no: #24071 by killerontherun1 · Pull Request #26520 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

Fixed docstrings as referenced in issue no: #24071 #26520

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

Closed
wants to merge 65 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
62deebc
Fixed docstrings as referenced in issue no: #24071
May 25, 2019
129b40c
CLN: remove __bytes__ (#26447)
topper-123 May 19, 2019
60d2438
BUG: Fix #25959 - Don't call .array in DatetimeLikeArrayMixin's map (…
ThomasKluiters May 19, 2019
843d372
DEPR: Change .ix DeprecationWarning -> FutureWarning (#26438)
jorisvandenbossche May 19, 2019
81ad35d
BUG: bugfix 26390 assigning PandasArray to DataFrame error (#26417)
shantanu-gontia May 19, 2019
a141cc5
BUG: fix calling local references with keyword arguments in query (#2…
danielhrisca May 19, 2019
5a8aad7
TST/DEPR: remove .ix from tests\indexing\multiindex\test_loc.py (#26451)
simonjayhawkins May 19, 2019
e3af0ce
BUG: ngroups and len(groups) do not equal when grouping with a list o…
shantanu-gontia May 20, 2019
323eb5e
BUG-20629 allow .at accessor with CategoricalIndex (#26298)
JustinZhengBC May 20, 2019
a5ce533
BUG: Exception when frame constructed from dict of iterators (#26356)
topper-123 May 20, 2019
f294d30
Add defensive check for argument errors keyword in to_numeric (#26466)
sumanau7 May 20, 2019
e98df14
DOC: fix example with Timestamp/integer addition (#26467)
jorisvandenbossche May 20, 2019
9fb07d6
DOC: whatsnew fixes
gfyoung May 20, 2019
1f6a751
DOC: #25723 passing kwargs to excel document engine (#26465)
Dunni3 May 20, 2019
198f7b8
DEPR: deprecate SparseArray.values (#26421)
jorisvandenbossche May 21, 2019
9712c2e
ENH - Index set operation modifications to address issue #23525 (#23538)
ms7463 May 21, 2019
6879e25
DOC/CLN: wil -> will (#26484)
simonjayhawkins May 21, 2019
be6d194
Fixed typo mutiplication -> multiplication. (#26489)
javabrett May 22, 2019
fbdea8c
DOC: fix SyntaxError in doc build on Windows (#26499)
simonjayhawkins May 23, 2019
8eb0c08
DOC: Highlighted role of index alignment in DataFrame.dot(other) (#26…
matsmaiwald May 23, 2019
b8d46a4
DOC/CLN: Change API reference section title (#26486)
simonjayhawkins May 24, 2019
736d2c5
CLN: Remove StringMixin from PandasObject (#26505)
topper-123 May 24, 2019
81acbef
Fix type annotations in pandas.core.indexes.datetimes (#26404)
vaibhavhrt May 24, 2019
4fa2a28
Better error message for DataFrame.hist() without numerical columns (…
matsmaiwald May 24, 2019
385fced
Excel Test Cleanup - ReadWriteClass (#26473)
WillAyd May 24, 2019
5cc13b5
CLN: pd.TimeGrouper (#26477)
mroeschke May 24, 2019
b72832d
CLN: Remove ExcelWriter.sheetname (#26464)
mroeschke May 25, 2019
3e32dcd
Merge branch 'master' into docstring_fix
May 25, 2019
67ebeb9
Fixed GL01 and GL02 in pandas.api
May 26, 2019
3b57213
GL01 and GL02 solved for pandas.eval
May 26, 2019
c9d2fb5
solved GL01 GL02 for pandas.HDFStore
May 26, 2019
0341bf4
solved GL01 GL02 for pandas.Index.T
May 26, 2019
dbbf44d
Fixed GL01 and GL02 in pandas.api
May 26, 2019
19fd64b
GL01 and GL02 solved for pandas.eval
May 26, 2019
f00abcf
solved GL01 GL02 for pandas.HDFStore
May 26, 2019
9dbf25f
CLN: remove __bytes__ (#26447)
topper-123 May 19, 2019
526c4df
BUG: Fix #25959 - Don't call .array in DatetimeLikeArrayMixin's map (…
ThomasKluiters May 19, 2019
612dc08
DEPR: Change .ix DeprecationWarning -> FutureWarning (#26438)
jorisvandenbossche May 19, 2019
62aee5a
BUG: bugfix 26390 assigning PandasArray to DataFrame error (#26417)
shantanu-gontia May 19, 2019
7b33e85
BUG: fix calling local references with keyword arguments in query (#2…
danielhrisca May 19, 2019
d69b8ce
TST/DEPR: remove .ix from tests\indexing\multiindex\test_loc.py (#26451)
simonjayhawkins May 19, 2019
c648673
BUG: ngroups and len(groups) do not equal when grouping with a list o…
shantanu-gontia May 20, 2019
5861fc9
BUG-20629 allow .at accessor with CategoricalIndex (#26298)
JustinZhengBC May 20, 2019
b68ca02
BUG: Exception when frame constructed from dict of iterators (#26356)
topper-123 May 20, 2019
c2d13dc
Add defensive check for argument errors keyword in to_numeric (#26466)
sumanau7 May 20, 2019
e588b69
DOC: fix example with Timestamp/integer addition (#26467)
jorisvandenbossche May 20, 2019
39b4db2
DOC: whatsnew fixes
gfyoung May 20, 2019
e1af4aa
DOC: #25723 passing kwargs to excel document engine (#26465)
Dunni3 May 20, 2019
0eb589b
DEPR: deprecate SparseArray.values (#26421)
jorisvandenbossche May 21, 2019
407eee1
ENH - Index set operation modifications to address issue #23525 (#23538)
ms7463 May 21, 2019
dbe8837
DOC/CLN: wil -> will (#26484)
simonjayhawkins May 21, 2019
35d517d
Fixed typo mutiplication -> multiplication. (#26489)
javabrett May 22, 2019
0b28ddf
DOC: fix SyntaxError in doc build on Windows (#26499)
simonjayhawkins May 23, 2019
b3c191a
DOC: Highlighted role of index alignment in DataFrame.dot(other) (#26…
matsmaiwald May 23, 2019
c75f08f
DOC/CLN: Change API reference section title (#26486)
simonjayhawkins May 24, 2019
030240f
CLN: Remove StringMixin from PandasObject (#26505)
topper-123 May 24, 2019
6105c62
Fix type annotations in pandas.core.indexes.datetimes (#26404)
vaibhavhrt May 24, 2019
1eca8b7
Better error message for DataFrame.hist() without numerical columns (…
matsmaiwald May 24, 2019
5e2b989
Excel Test Cleanup - ReadWriteClass (#26473)
WillAyd May 24, 2019
ea8822c
CLN: pd.TimeGrouper (#26477)
mroeschke May 24, 2019
c1cbc6d
CLN: Remove ExcelWriter.sheetname (#26464)
mroeschke May 25, 2019
d122189
GL01 and GL02 solved for pandas.eval
May 26, 2019
32211fc
solved GL01 GL02 for pandas.Index.T
May 26, 2019
15f1fa3
Merge branch 'docstring_fix' of https://github.com/killerontherun1/pa…
May 26, 2019
3d10423
Revert "Fixed docstrings as referenced in issue no: #24071"
May 26, 2019
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
Prev Previous commit
Next Next commit
BUG: Exception when frame constructed from dict of iterators (#26356)
  • Loading branch information
topper-123 authored and killerontherun1 committed May 25, 2019
commit a5ce533e10cc56e98b4917eb9e0b0e4eab01a599
1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.25.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ Reshaping
- Bug in :func:`pivot_table` where columns with ``NaN`` values are dropped even if ``dropna`` argument is ``False``, when the ``aggfunc`` argument contains a ``list`` (:issue:`22159`)
- Bug in :func:`concat` where the resulting ``freq`` of two :class:`DatetimeIndex` with the same ``freq`` would be dropped (:issue:`3232`).
- Bug in :func:`merge` where merging with equivalent Categorical dtypes was raising an error (:issue:`22501`)
- bug in :class:`DataFrame` instantiating with a dict of iterators or generators (e.g. ``pd.DataFrame({'A': reversed(range(3))})``) raised an error (:issue:`26349`).
- bug in :class:`DataFrame` instantiating with a ``range`` (e.g. ``pd.DataFrame(range(3))``) raised an error (:issue:`26342`).
- Bug in :class:`DataFrame` constructor when passing non-empty tuples would cause a segmentation fault (:issue:`25691`)
- Bug in :func:`Series.apply` failed when the series is a timezone aware :class:`DatetimeIndex` (:issue:`25959`)
Expand Down
11 changes: 10 additions & 1 deletion pandas/core/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from datetime import datetime, timedelta
from functools import partial
import inspect
from typing import Any
from typing import Any, Iterable, Union

import numpy as np

Expand Down Expand Up @@ -289,6 +289,15 @@ def maybe_make_list(obj):
return obj


def maybe_iterable_to_list(obj: Union[Iterable, Any]) -> Union[list, Any]:
"""
If obj is Iterable but not list-like, consume into list.
"""
if isinstance(obj, abc.Iterable) and not isinstance(obj, abc.Sized):
return list(obj)
return obj


def is_null_slice(obj):
"""
We have a null slice.
Expand Down
5 changes: 3 additions & 2 deletions pandas/core/internals/construction.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,11 @@ def init_dict(data, index, columns, dtype=None):
else:
keys = com.dict_keys_to_ordered_list(data)
columns = data_names = Index(keys)
arrays = (com.maybe_iterable_to_list(data[k]) for k in keys)
# GH#24096 need copy to be deep for datetime64tz case
# TODO: See if we can avoid these copies
arrays = [data[k] if not is_datetime64tz_dtype(data[k]) else
data[k].copy(deep=True) for k in keys]
arrays = [arr if not is_datetime64tz_dtype(arr) else
arr.copy(deep=True) for arr in arrays]
return arrays_to_mgr(arrays, data_names, index, columns, dtype=dtype)


Expand Down
14 changes: 5 additions & 9 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Data structure for 1-dimensional cross-sectional and time series data
"""
from collections import OrderedDict, abc
from collections import OrderedDict
from io import StringIO
from shutil import get_terminal_size
from textwrap import dedent
Expand Down Expand Up @@ -220,15 +220,11 @@ def __init__(self, data=None, index=None, dtype=None, name=None,
elif isinstance(data, (set, frozenset)):
raise TypeError("{0!r} type is unordered"
"".format(data.__class__.__name__))
# If data is Iterable but not list-like, consume into list.
elif (isinstance(data, abc.Iterable) and
not isinstance(data, abc.Sized)):
data = list(data)
else:

elif isinstance(data, ABCSparseArray):
# handle sparse passed here (and force conversion)
if isinstance(data, ABCSparseArray):
data = data.to_dense()
data = data.to_dense()
else:
data = com.maybe_iterable_to_list(data)

if index is None:
if not is_list_like(data):
Expand Down
24 changes: 24 additions & 0 deletions pandas/tests/frame/test_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,30 @@ def test_constructor_dict_of_tuples(self):
expected = DataFrame({k: list(v) for k, v in data.items()})
tm.assert_frame_equal(result, expected, check_dtype=False)

def test_constructor_dict_of_ranges(self):
# GH 26356
data = {'a': range(3), 'b': range(3, 6)}

result = DataFrame(data)
expected = DataFrame({'a': [0, 1, 2], 'b': [3, 4, 5]})
tm.assert_frame_equal(result, expected)

def test_constructor_dict_of_iterators(self):
# GH 26349
data = {'a': iter(range(3)), 'b': reversed(range(3))}

result = DataFrame(data)
expected = DataFrame({'a': [0, 1, 2], 'b': [2, 1, 0]})
tm.assert_frame_equal(result, expected)

def test_constructor_dict_of_generators(self):
# GH 26349
data = {'a': (i for i in (range(3))),
'b': (i for i in reversed(range(3)))}
result = DataFrame(data)
expected = DataFrame({'a': [0, 1, 2], 'b': [2, 1, 0]})
tm.assert_frame_equal(result, expected)

def test_constructor_dict_multiindex(self):
def check(result, expected):
return tm.assert_frame_equal(result, expected, check_dtype=True,
Expand Down
0