Giter VIP home page Giter VIP logo

Comments (3)

BurntSushi avatar BurntSushi commented on May 23, 2024 1

OK, so to be clear here, you're running into an error because your CSV data has multiple rows with varying numbers of columns. The xsv fixlengths command is what you should be using to resolve that. If you read the xsv fixlengths --help docs, you'll notice that there is a bit of work that needs to be done to "fix" the CSV data.

So yes, it was very much intentional that xsv has no way to "skip" bad records. In particular, there is no obvious way to know which records are bad and which aren't. There is a fundamental ambiguity here. This isn't necessarily about your CSV data being malformed so much as xsv has no obvious way to interpret it. It might be obvious to you, but that's why xsv fixlengths exists. Use that to make it obvious to xsv.

from xsv.

BurntSushi avatar BurntSushi commented on May 23, 2024

Am I just supposed to take your word for it? :-) Could you please show an example?

xsv should never crash on any input.

It might return errors in some cases. And what to do in those cases depends on what you're trying to do. But you didn't give any examples nor did you describe what you're trying to do nor the output of xsv when it crashed.

(If it were possible, I would love to have a --please-no-bugs that one could pass to any program to prevent it from crashing. :P)

from xsv.

tobiasmuehl avatar tobiasmuehl commented on May 23, 2024

My apologies, I picked the wrong word. xsv indeed doesn't crash - it exits with an error, which is correct, as my input CSV file is malformed (too many columns). In looking into this problem I stumbled upon csvclean from csvkit which can be used to fix/remove bad lines from my CSV file. Given that xsv already has the fixlengths command, perhaps adding a flag to skip lines with errors wouldn't be too much trouble?

from xsv.

Related Issues (20)

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.