8000 CLN16668: remove OrderedDefaultDict by faic · Pull Request #16939 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

CLN16668: remove OrderedDefaultDict #16939

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 4 commits into from
Jul 15, 2017
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
CLN16668: set default value to empty dict at init
  • Loading branch information
Dmitrii Gorislavetc committed Jul 15, 2017
commit 2f64621a012f6fd6d33cd7191d6c4646b55ccf89
4 changes: 3 additions & 1 deletion pandas/core/panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,11 @@ def from_dict(cls, data, intersect=False, orient='items', dtype=None):
"""
orient = orient.lower()
if orient == 'minor':
new_data = OrderedDict(dict)
new_data = OrderedDict()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to replace this with new_data = defaultdict(OrderedDict)

for col, df in compat.iteritems(data):
for item, s in compat.iteritems(df):
if item not in new_data:
new_data[item] = {}
new_data[item][col] = s
data = new_data
elif orient != 'items': # pragma: no cover
Expand Down
0