Coder Social home page Coder Social logo

convert-csv-to-arff's People

Contributors

anaavila avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

convert-csv-to-arff's Issues

Can I add single quotes for value with space only? (e.g., Bosnia and Herzegovina)

Hello,

As of now, the code that author created tries to add single quotes to every value. (FYI, the part of the code is below).

check for comams or blanks and adds single quotes

for j in range(0,totalCols):
for i in range(1,totalRows):
allData[i][j] = allData[i][j].lower()
if "\r" in allData[i][j] or '\r' in allData[i][j] or "\n" in allData[i][j] or '\n' in allData[i][j]:
allData[i][j] = allData[i][j].rstrip(os.linesep)
allData[i][j] = allData[i][j].rstrip("\n")
allData[i][j] = allData[i][j].rstrip("\r")
try:
if allData[i][j] == str(float(allData[i][j])) or allData[i][j] == str(int(allData[i][j])):
print
except ValueError as e:
allData[i][j] = "'" + allData[i][j] + "'"

However, I am wondering how to add single quotes to values with space only, such as Bosnia and Herzegovina.
For example,
the return should be like... {Algeria, Argentina, 'Bosnia and Herzegovina', Chile, 'Costa Rica'} .

Please feel free to leave any comment and give help.

Thank you for your help.

Sincerely,

How to sort alphabetical order in attribute showing unique data of each column

Hello,

While I was looking at the code that the author created, I had a curious if there is a way to sort the attribute showing unique data of each column in alphabetical order when the csv format converted to arff format. For example, in @Attribute 'Group', it shows {'h','f','b','a','c','d','e','g'}. But, I am wondering how I can make it show as {'a','b','c','d','e','f','g','h'}.

I've tried sort() function in the code, but it did not work and was confused about where to put it.
Please help me to solve this issue.

Thank you!

convert to sparse ARFF

Hello,

I've been looked through this code (it is really helpful to understand converting csv to arff format. Thank you so much) over the last two weeks.

While I was thinking about this code, I suddenly had a question about how to convert the arff file to sparse arff format.

I've been thinking about it but am not sure how to implement it based on this code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.