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

Support for data type in CSV class. #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pandeydivesh15
Copy link

Currently, CSV class object doesn't care about the DataType of incoming/outgoing data. This can create inconvenience for some users. For eg. if I have a numerical CSV file, the CSV._load() function still loads all data in unicode string format.

This patch allows users to send Datatype also, when they are initiating a CSV object. In case no datatype is given, datatype defaults to unicode/u.

…ng/outgoing data. This can create inconvenience for some users. For eg. if I have a numerical CSV file, the CSV._load() function still loads all data in unicode string format.

This patch allows users to send Datatype also, when they are initiating a CSV object. In case no datatype is given, datatype defaults to unicode/u.
@pandeydivesh15
Copy link
Author

Some other modifications are also possible in CSV class.

  • Currently, if some CSV object holds some fixed sized rows and user wishes to append some more rows, then there is no check to ensure that the size of newly added row will be same as before. For eg.
>>> data = CSV("test.csv")
>>> data
[[u's', u'y', u's']]
>>> data.append([1,2])
>>> data
[[u's', u'y', u's'], [1, 2]]

As you can see, sizes are bot proper, as well as datatypes mismatch.

  • There is special importance given to headers(they exist in some CSV files). We can try to modify code to incorporate header information. For eg.
PassengerID,Survived
892,0
893,0

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

1 participant