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/24 pandas plugin #137

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

rhenanbartels
Copy link
Contributor

Hi Álvaro, I've just finish the code to import/export from/to pandas DataFrame. Can you please review it?

Thanks in advance!

@turicas
Copy link
Owner

turicas commented Nov 4, 2015

@rhenanbartels, thanks for your PR! I'm going to review it now, but you need to rebase since there are some conflicts between your branch and the current develop.

rows/__init__.py Outdated
@@ -29,6 +29,7 @@
from rows.plugins._json import import_from_json, export_to_json
from rows.plugins.csv import import_from_csv, export_to_csv
from rows.plugins.txt import export_to_txt
from rows.plugins._pandas import import_from_pandas
Copy link
Owner

Choose a reason for hiding this comment

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

As pandas is an optional dependency to rows, you need to put this import inside a try/except clause. Need also to import export_to_pandas.

@turicas
Copy link
Owner

turicas commented Nov 4, 2015

@rhenanbartels, I just finished the code review. Please address the changes. ;-)

Since this is the first plugin that does not use serialization/deserialization from/to a file (it just changes objects in memory), I don't know if the API should be the same. Thinking in maybe put it inside rows.converters... Any ideas?

@rhenanbartels
Copy link
Contributor Author

Yes, I was thinking about that, maybe a rows.conveter is a solution. And we can also think about other types of convertions. For instance, we can easy the work of exporting numpy matrix to .xls, .xlsx or .csv (which is a very commom task), converting it to table object and then exporting it.

yield list(data_frame)

for _, row in data_frame.iterrows():
yield dataframe_row_to_list(row)
Copy link
Owner

Choose a reason for hiding this comment

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

May use dataframe.itertuples.

yield list(data_frame)

for _, row in data_frame.iterrows():
yield dataframe_row_to_list(row)
Copy link
Owner

Choose a reason for hiding this comment

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

May use dataframe.itertuples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants