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

[Feature]: new method for saving results #1093

Closed
1 task done
soulteary opened this issue Apr 19, 2022 · 1 comment · Fixed by #1110
Closed
1 task done

[Feature]: new method for saving results #1093

soulteary opened this issue Apr 19, 2022 · 1 comment · Fixed by #1110
Assignees
Labels
kind/feature Issues related to feature request from users

Comments

@soulteary
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues.

Is your feature request related to a problem? Please describe.

hello maintainers 👋

I saw in the project that we can use the show method to display the results. But I didn't find a way to save these results.

def show(self, limit=5, header=None, tablefmt='html', formatter={}):
"""
Print the first n lines of a DataCollection.
Args:
limit (`int`):
The number of lines to print. Default value is 5.
Print all if limit is non-positive.
header (list of `str`):
The field names.
tablefmt (`str`):
The format of the output, support html, plain, grid.
"""
contents = [x for i, x in enumerate(self._iterable) if i < limit]
if all(isinstance(x, Entity) for x in contents):
header = tuple(contents[0].to_dict()) if not header else header
data = [list(x.to_dict().values()) for x in contents]
else:
data = [[x] for x in contents]
table_display(to_printable_table(data, header, tablefmt, formatter), tablefmt)

Are you considering adding a method that can make it easier for users to directly save the displayed results?

Perhaps the user can specify the type of files to save, the directory location, and whether to package the result through parameters.

Would love to hear other people's thoughts and suggestions.

Describe the solution you'd like.

No response

Describe an alternate solution.

No response

Anything else? (Additional Context)

No response

@GuoRentong GuoRentong assigned reiase and unassigned Chiiizzzy Apr 19, 2022
@binbinlv binbinlv added the kind/feature Issues related to feature request from users label Apr 21, 2022
@Chiiizzzy Chiiizzzy linked a pull request Apr 21, 2022 that will close this issue
@reiase
Copy link
Contributor

reiase commented Apr 21, 2022

@soulteary We have just implemented a to_csv method, you can make a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Issues related to feature request from users
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants