-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
CLN: Removing Python 3.6 or higher references that are always true #29492
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
Changes from 3 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
7ce9c79
Removing all unneeded PY36 checks from code (tests pending)
datapythonista fcb1297
Removing PY36 compatibility from tests
datapythonista 3aaa37e
Addressing review comments
datapythonista 473ea21
Removing unused import
datapythonista 2f0501f
Merge remote-tracking branch 'upstream/master' into py36
datapythonista 47949ac
Adding type check with new syntax.
datapythonista a62e8b0
Removing unorderable exception function
datapythonista cac049b
Merge branch 'py36' of github.com:datapythonista/pandas into py36
datapythonista ef1940c
Using types inline
datapythonista acf18fc
Revert "Removing unorderable exception function"
datapythonista 555626f
Updating docstring of unorderable exception
datapythonista 7011793
Merge remote-tracking branch 'upstream/master' into py36
datapythonista 85ee6ac
Merge remote-tracking branch 'upstream/master' into py36
datapythonista 2a175f3
Removing unnecessary isinstance of OrderedDict
datapythonista File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,6 @@ | |
import numpy.ma as ma | ||
|
||
from pandas._libs import lib | ||
import pandas.compat as compat | ||
from pandas.compat import PY36 | ||
|
||
from pandas.core.dtypes.cast import ( | ||
construct_1d_arraylike_from_scalar, | ||
|
@@ -235,7 +233,7 @@ def init_dict(data, index, columns, dtype=None): | |
arrays.loc[missing] = [val] * missing.sum() | ||
|
||
else: | ||
keys = com.dict_keys_to_ordered_list(data) | ||
keys = list(data.keys()) | ||
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 | ||
|
@@ -331,16 +329,13 @@ def extract_index(data): | |
have_raw_arrays = False | ||
have_series = False | ||
have_dicts = False | ||
have_ordered = False | ||
|
||
for val in data: | ||
if isinstance(val, ABCSeries): | ||
have_series = True | ||
indexes.append(val.index) | ||
elif isinstance(val, dict): | ||
have_dicts = True | ||
if isinstance(val, OrderedDict): | ||
have_ordered = True | ||
indexes.append(list(val.keys())) | ||
elif is_list_like(val) and getattr(val, "ndim", 1) == 1: | ||
have_raw_arrays = True | ||
|
@@ -352,7 +347,7 @@ def extract_index(data): | |
if have_series: | ||
index = _union_indexes(indexes) | ||
elif have_dicts: | ||
index = _union_indexes(indexes, sort=not (compat.PY36 or have_ordered)) | ||
index = _union_indexes(indexes, sort=False) | ||
|
||
if have_raw_arrays: | ||
lengths = list(set(raw_lengths)) | ||
|
@@ -531,7 +526,7 @@ def _list_of_dict_to_arrays(data, columns, coerce_float=False, dtype=None): | |
"""Convert list of dicts to numpy arrays | ||
|
||
if `columns` is not passed, column names are inferred from the records | ||
- for OrderedDict and (on Python>=3.6) dicts, the column names match | ||
- for OrderedDict and dicts, the column names match | ||
the key insertion-order from the first record to the last. | ||
- For other kinds of dict-likes, the keys are lexically sorted. | ||
|
||
|
@@ -550,7 +545,7 @@ def _list_of_dict_to_arrays(data, columns, coerce_float=False, dtype=None): | |
""" | ||
if columns is None: | ||
gen = (list(x.keys()) for x in data) | ||
types = (dict, OrderedDict) if PY36 else OrderedDict | ||
types = (dict, OrderedDict) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe update docstring and inline types There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think its also worth inlining types now that types is a less complex expression and only used once. |
||
sort = not any(isinstance(d, types) for d in data) | ||
columns = lib.fast_unique_multiple_list_gen(gen, sort=sort) | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and update docstring here