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

chore: using csv.DictReader to read csv files to remove pandas #416

Closed
wants to merge 1 commit into from
Closed

chore: using csv.DictReader to read csv files to remove pandas #416

wants to merge 1 commit into from

Conversation

dungdm93
Copy link
Contributor

@dungdm93 dungdm93 commented Dec 2, 2020

Signed-off-by: Đặng Minh Dũng dungdm93@live.com

Summary of Changes

Currently, amundsendatabuilder use pandas to read csv file like this:

        with open(node_file, 'r', encoding='utf8') as node_csv:
            for node_record in pandas.read_csv(node_csv, na_filter=False).to_dict(orient='records'):
                label = node_record[NODE_LABEL_KEY]
                if label not in self.labels:
                    self._try_create_index(label)
                    self.labels.add(label)

It seem be overkilled for this simple case, so this PR use csv.DictReader instead and remove pandas from the requirements in order to not install unnecessary dependency.

Tests

Rerun the quick start script locally.

Documentation

What documentation did you add or modify and why? Add any relevant links then remove this line

CheckList

Make sure you have checked all steps below to ensure a timely review.

  • PR title addresses the issue accurately and concisely. Example: "Updates the version of Flask to v1.0.2"
  • PR includes a summary of changes.
  • PR adds unit tests, updates existing unit tests, OR documents why no test additions or modifications are needed.
  • In case of new functionality, my PR adds documentation that describes how to use it.
    • All the public functions and the classes in the PR contain docstrings that explain what it does
  • PR passes make test

Signed-off-by: Đặng Minh Dũng <dungdm93@live.com>
@feng-tao
Copy link
Member

feng-tao commented Dec 2, 2020

hey @dungdm93 , thanks for the contribution. But we used to do the way in this pr before @rogertangcn fixed it in #382 as using csv reader has bunches of issues like amundsen-io/amundsen#513.

@dungdm93
Copy link
Contributor Author

dungdm93 commented Dec 3, 2020

Oh, because of infer schema. Thanks for your explanation.
I'm going to close this MR right now.

@dungdm93 dungdm93 closed this Dec 3, 2020
@dungdm93 dungdm93 deleted the csv-dictreader branch December 3, 2020 00:57
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.

2 participants