Skip to content
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

Update repr to show all entities and display to row/col counts #124

Merged
merged 1 commit into from Mar 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 3 additions & 5 deletions featuretools/entityset/base_entity.py
Expand Up @@ -93,14 +93,12 @@ def __init__(self, id, entityset, variable_types=None, name=None,
def __repr__(self):
repr_out = "Entity: {}\n".format(self.name)
repr_out += " Variables:"
for v in self.variables[:5]:
for v in self.variables:
repr_out += "\n {} (dtype: {})".format(v.id, v.dtype)
if len(self.variables) > 5:
num_left = len(self.variables) - 5
repr_out += "\n ...And {} more".format(num_left)

shape = self.get_shape()
repr_out += u"\n Shape:\n ({}, {})".format(shape[0], shape[1])
repr_out += u"\n Shape:\n (Rows: {}, Columns: {})".format(
shape[0], shape[1])
return repr_out

@property
Expand Down
23 changes: 10 additions & 13 deletions featuretools/entityset/base_entityset.py
Expand Up @@ -129,28 +129,23 @@ def __repr__(self):
fmat = self.id
repr_out = u"Entityset: {}\n".format(fmat)
repr_out += u" Entities:"
for e in self.entities[:5]:
for e in self.entities:
if e.df.shape:
repr_out += u"\n {} (shape = [{}, {}])".format(e.id, e.df.shape[0], e.df.shape[1])
repr_out += u"\n {} [Rows: {}, Columns: {}]".format(
e.id, e.df.shape[0], e.df.shape[1])
else:
repr_out += u"\n {} (shape = [None, None])".format(e.id)
if len(self.entities) > 5:
num_left = len(self.entities) - 5
repr_out += u"\n ...And {} more".format(num_left)
repr_out += u"\n {} [Rows: None, Columns: None]".format(
e.id)
repr_out += "\n Relationships:"

if len(self.relationships) == 0:
repr_out += "\n No relationships"

for r in self.relationships[:5]:
for r in self.relationships:
repr_out += u"\n %s.%s -> %s.%s" % \
(r._child_entity_id, r._child_variable_id,
r._parent_entity_id, r._parent_variable_id)

if len(self.relationships) > 5:
num_left = len(self.relationships) - 5
repr_out += u"\n ...and {} more".format(num_left)

return repr_out

def delete_entity_variables(self, entity_id, variables, **kwargs):
Expand Down Expand Up @@ -181,7 +176,8 @@ def add_relationship(self, relationship):
relationship to be added.
"""
if relationship in self.relationships:
logger.warning("Not adding duplicate relationship: %s", relationship)
logger.warning(
"Not adding duplicate relationship: %s", relationship)
return self

# _operations?
Expand Down Expand Up @@ -286,7 +282,8 @@ def find_forward_path(self, start_entity_id, goal_entity_id):
return []

for r in self.get_forward_relationships(start_entity_id):
new_path = self.find_forward_path(r.parent_entity.id, goal_entity_id)
new_path = self.find_forward_path(
r.parent_entity.id, goal_entity_id)
if new_path is not None:
return [r] + new_path

Expand Down