0

I have a csv file with a couple columns and about 100k rows. One of the columns is a date, and I was wondering what the easiest way was to count the number of rows that have a certain date for all the possible dates and make a new csv file with just the date and the number of rows that have that date in the specific column. Any language or method is fine!

Thanks

Example of what data looks like now

182319283
  • 23
  • 3
  • You could use a pivot table for this. If you want a programming solution then it would be best to provide some code you already tried and describe what problem you had with it. – Tim Williams Jul 20 '18 at 20:39
  • @TimWilliams Hi! I addede a picture of what the table looks like now, there are hundreds of dates over 100,000 rows so I can't manually do a sum+if combo for each date. I rarely do data management, but I want to do this to speed up my queries – 182319283 Jul 20 '18 at 20:50
  • What's wrong with using a pivot table? – Tim Williams Jul 20 '18 at 20:51
  • https://stackoverflow.com/questions/38400218/sql-pivot-function-text-file-database-with-vba-excel shows how to query a text file using ADO - you can use something like `select date_field, count(epsilon_id) as num from [filename] group by date_field` and then save the results to csv – Tim Williams Jul 20 '18 at 20:55
  • You can open a CSV and work with it just like you would an Excel workbook (except without formatting). The number of rows is irrelevant. – ashleedawg Jul 20 '18 at 21:04

1 Answers1

0

I recommend using CsvHelper and Visual Studio in C#. This is by far the easiest as well as a fast way to read and process CSV files. CsvHelper is a popular library that makes it easy to process most any CSV files and is much faster than the standard .NET alternatives.

Here is another blog about using the class. Keep it Simple with CvsHelper

Dan Randolph
  • 741
  • 8
  • 14