Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

The New Coffee Room

  1. TNCR
  2. General Discussion
  3. Tech tip of the day for those who have to deal with CSV files

Tech tip of the day for those who have to deal with CSV files

Scheduled Pinned Locked Moved General Discussion
8 Posts 6 Posters 82 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • KlausK Offline
    KlausK Offline
    Klaus
    wrote on last edited by Klaus
    #1

    I discovered these life-changing utilities today:
    https://csvkit.readthedocs.io/en/latest/

    Instead of going through the intense pain of importing tables into something like Excel, they allow you to just SQL-query your data on the command line instead.

    For instance, if we have data about exam results in a CSV file and I want a histogram of the result distribution, I just do

    > csvsql -I --table grades examresults.csv --query 'SELECT Grade,COUNT(*) AS Count FROM grades GROUP BY Grade'
    Grade,Count
    "1,0",3
    "1,7",13
    "2,0",24
    "2,3",25
    "2,7",42
    "3,0",53
    "3,3",53
    "3,7",81
    "4,0",32
    "5,0",132
    

    Ever tried something like that in Excel? It's a PITA.

    I can't believe I've managed to live my life until this point without this tool.

    1 Reply Last reply
    • HoraceH Offline
      HoraceH Offline
      Horace
      wrote on last edited by
      #2

      That would come in handy if I could craft SQL queries off the top of my head like that.

      Education is extremely important.

      KlausK 1 Reply Last reply
      • markM Offline
        markM Offline
        mark
        wrote on last edited by
        #3

        😎

        1 Reply Last reply
        • HoraceH Horace

          That would come in handy if I could craft SQL queries off the top of my head like that.

          KlausK Offline
          KlausK Offline
          Klaus
          wrote on last edited by
          #4

          @Horace said in Tech tip of the day for those who have to deal with CSV files:

          That would come in handy if I could craft SQL queries off the top of my head like that.

          Believe it or not, but mastering SQL is a tiny task compared to mastering Excel. Also, using SQL is already the advanced use case. Many of the tools work out-of-the-box without the need for SQL.

          Their true power comes from their composability, thanks to the Unix philosophy. Ken Thompson and Dennis Ritchie should have been award the Nobel peace prize or something.

          1 Reply Last reply
          • AxtremusA Away
            AxtremusA Away
            Axtremus
            wrote on last edited by
            #5

            “csvsql” … nice, and it doesn’t look that hard to program too, amazing it’s not already more popular.

            1 Reply Last reply
            • taiwan_girlT Offline
              taiwan_girlT Offline
              taiwan_girl
              wrote on last edited by
              #6

              ISnt that a US pharmacy? LOL

              George KG 1 Reply Last reply
              • taiwan_girlT taiwan_girl

                ISnt that a US pharmacy? LOL

                George KG Offline
                George KG Offline
                George K
                wrote on last edited by
                #7

                @taiwan_girl said in Tech tip of the day for those who have to deal with CSV files:

                ISnt that a US pharmacy? LOL

                "CVS"

                "Now look here, you Baltic gas passer... " - Mik, 6/14/08

                The saying, "Lite is just one damn thing after another," is a gross understatement. The damn things overlap.

                taiwan_girlT 1 Reply Last reply
                • George KG George K

                  @taiwan_girl said in Tech tip of the day for those who have to deal with CSV files:

                  ISnt that a US pharmacy? LOL

                  "CVS"

                  taiwan_girlT Offline
                  taiwan_girlT Offline
                  taiwan_girl
                  wrote on last edited by
                  #8

                  @George-K :woman-facepalming:

                  1 Reply Last reply
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups