-
Notifications
You must be signed in to change notification settings - Fork 9
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
Added from_csv and to_csv functions #33
Open
gouravkr
wants to merge
13
commits into
PFython:master
Choose a base branch
from
gouravkr:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is brilliant thanks so much Gourav. Please bear with me while I have a good look through before merging officially. All the best, Pete |
Hi. Any update on this? Do I need to make any changes? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is for issue#31
I have added two functions in cleverdict.py file to handle creation of CleverDict from csv files and exporting of CleverDict objects into csv files. The CleverDicts created with from_csv function will be a nested CleverDict where top level dict will be indexed from 0 and each row will be converted to a CleverDict object, allowing people to use it like a list of dicts. For example:
The to_csv function requires a similarly formatted CleverDict of CleverDicts and each underlying cleverdict is exported as a row, allowing the use of ignore, only parameters.
Ample tests have also been added in the existing tests file.
The code has been tested under Python 3.7 on Linux and 3.9 on Windows and all tests pass successfully.
I have made use of the csv library to read and write csv files.