Git Product home page Git Product logo

Comments (5)

patatetom avatar patatetom commented on May 18, 2024 3

hi,
and/or adding a --delim option (or something similar) on the command line to force the definition (in case of detection problem for example)...
regards.

from rich-cli.

hjacobs avatar hjacobs commented on May 18, 2024

OK, apparently the problem is with only sniffing truncated data ([:1024]) which can break the CSV sniffer algorithm as it tries to detect the delimiter by counting the occurrences on each line (and truncating in the middle of a line will therefore corrupt the data for the sniffer).

Changing the logic to sniff the first N lines instead of first 1024 characters would solve this issue.

from rich-cli.

harkabeeparolus avatar harkabeeparolus commented on May 18, 2024

OK, apparently the problem is with only sniffing truncated data ([:1024]) which can break the CSV sniffer algorithm as it tries to detect the delimiter by counting the occurrences on each line (and truncating in the middle of a line will therefore corrupt the data for the sniffer).

Wow, is that the reason why?!? ๐Ÿ˜ฒ I've been wondering for years why the code example in the official Python csv.Sniffer docs does not seem to work. I never realized it is because it breaks in the middle of a line. ๐Ÿคจ

Seems to me this should be fixed in the official Python docs as well, since I've never managed to get it to work...

Anyway, thanks for this gem! ๐Ÿ˜Š

from rich-cli.

luckman212 avatar luckman212 commented on May 18, 2024

Is there any --delim or similar option to force delim detection?

from rich-cli.

YUKI2eN3e avatar YUKI2eN3e commented on May 18, 2024

I just submitted a pull request to add --csv-format that lets you set the dialect to use.

from rich-cli.

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.