Skip to content

BUG: construction of Series with integers on windows not default to int64 #13661

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 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion doc/source/whatsnew/v0.19.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ Bug Fixes
- Bug when passing a not-default-indexed ``Series`` as ``xerr`` or ``yerr`` in ``.plot()`` (:issue:`11858`)
- Bug in matplotlib ``AutoDataFormatter``; this restores the second scaled formatting and re-adds micro-second scaled formatting (:issue:`13131`)
- Bug in selection from a ``HDFStore`` with a fixed format and ``start`` and/or ``stop`` specified will now return the selected range (:issue:`8287`)

- Bug in ``Series`` construction from a tuple of integers on windows not returning default dtype (int64) (:issue:`13646`)

- Bug in ``.groupby(..).resample(..)`` when the same object is called multiple times (:issue:`13174`)
- Bug in ``.to_records()`` when index name is a unicode string (:issue:`13172`)
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -2820,7 +2820,7 @@ def _try_cast(arr, take_fast_path):
subarr = data.copy()
return subarr

elif isinstance(data, list) and len(data) > 0:
elif isinstance(data, (list, tuple)) and len(data) > 0:
if dtype is not None:
try:
subarr = _try_cast(data, False)
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/frame/test_operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -1196,7 +1196,7 @@ def test_alignment_non_pandas(self):

align = pd.core.ops._align_method_FRAME

for val in [[1, 2, 3], (1, 2, 3), np.array([1, 2, 3])]:
for val in [[1, 2, 3], (1, 2, 3), np.array([1, 2, 3], dtype=np.intp)]:

tm.assert_series_equal(align(df, val, 'index'),
Series([1, 2, 3], index=df.index))
Expand Down
11 changes: 11 additions & 0 deletions pandas/tests/series/test_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,17 @@ def test_constructor_iterator(self):
result = Series(range(10), dtype='int64')
assert_series_equal(result, expected)

def test_constructor_list_like(self):

# make sure that we are coercing different
# list-likes to standard dtypes and not
# platform specific
expected = Series([1, 2, 3], dtype='int64')
for obj in [[1, 2, 3], (1, 2, 3),
np.array([1, 2, 3], dtype='int64')]:
result = Series(obj, index=[0, 1, 2])
assert_series_equal(result, expected)

def test_constructor_generator(self):
gen = (i for i in range(10))

Expand Down
2 changes: 1 addition & 1 deletion pandas/types/cast.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def _possibly_convert_platform(values):
""" try to do platform conversion, allow ndarray or list here """

if isinstance(values, (list, tuple)):
values = lib.list_to_object_array(values)
values = lib.list_to_object_array(list(values))
if getattr(values, 'dtype', None) == np.object_:
if hasattr(values, '_values'):
values = values._values
Expand Down