Questions tagged [csv]

A comma-separated values (CSV) file stores tabular data (numbers and text) as plain text, with rows and columns delimited by line terminators and commas, respectively. You may also use this tag for variants where fields are separated by tabs or semicolons.

Filter by
Sorted by
Tagged with
6
votes
3answers
274 views

Command line tools to format tables

I am a big fan of one-liners using sed awk perl and other tools. But there are that are ...
3
votes
2answers
44 views

Creating two output files from two formatted files

I've been working on a project to take data from csv files, re-format it, and display it as charts. I'm working for a company over the summer and when I leave, I would like my code to be readable/...
10
votes
2answers
438 views

Averaging numbers from a file, obeying Single Responsibility Principle

Task: Given comma_separated.txt file with string: 1,2,3,4,5,6,7,8,9,10,11,12...,n Calculate the average ...
3
votes
2answers
3k views

String converting and parsing a few rows of a .csv file

There are not many available resources for refactoring go code. I'm a novice gopher who would appreciate any feedback on a small program which reads a .csv file, string converts and parses a few rows ...
5
votes
1answer
1k views

Finding nearest city from a center place (latitude and longitude) with radius in miles

This is my code for finding the nearest city within a certain radius. I am not sure, is my code is OK or is it wrong? Please review and offer suggestions on my code. ...
5
votes
4answers
189 views

Comparing phone numbers across CSVs Python

(continuation from Speeding up and fixing phone numbers from CSVs with Regex) I'm pulling all of the phone numbers from all CSVs in two different directories, outputting them in a single simple ...
1
vote
1answer
104 views

Returning information about the result of a file processing, without using output parameters [closed]

As part of a C# class CsvConverter that converts various file types to CSV, I am designing a private class CsvConversionResult. ...
1
vote
2answers
100 views

Grabbing city names and numbers from a CSV file

I've got information that is imported from a CSV file that my site grabs every day with PHP. I'm just learning RegEx so I'm able to do what I need to do but am looking to get more efficient with my ...
6
votes
1answer
1k views

Correctly import CSV data, even when possibly malformed

I've created a CSV parser that tries to build a string table out of a CSV file. The goal is to handle CSV files as well as Excel. Input CSV file: ...
9
votes
5answers
2k views

Convert total minutes into “Hours:minute:seconds” for marathon data

The point of the script below is to read in the 10th column which is the total number of minutes a runner took to finish the marathon and convert it into form of "hours:minutes:seconds". Is there a ...
7
votes
1answer
3k views

Refactoring Tkinter GUI that reads from and updates csv files, and opens E-Run files

Background My lab administers four computer programs in three separate appointments. At each appointment, the subject does the programs in a pseudo-randomized order. Also, three of the programs have ...
4
votes
1answer
5k views

Integration of data using Simpson's rule

I wrote a Python program that performs an integration of data using Simpson's rule. The program takes the areas to be integrated from a foo.ref file, with the following syntax: ...
5
votes
1answer
491 views

explode textarea and commas [closed]

Am attempting to recreate a common feature, where a user can type several items in to a textarea, separated by commas and newlines and then submit them, i.e. for multiple record entry. The data does ...
3
votes
2answers
220 views

CSV email script efficiency

I'm tasked with getting emails from a .csv file and using them to submit a form. I am using the csv and mechanize Python libraries to achieve this. ...
2
votes
2answers
326 views

Loop in a .csv file with IF cases

I am new to Python and can't quite make my if-cases any shorter. Any ideas on how to do that? ...
1
vote
2answers
833 views

Student administration application using a .csv file for persistence

The application is a student administration system using a .csv file for persistence as part of our school project. This is my first created a basic DAO. I'd like to have some feedback about what ...
5
votes
1answer
187 views

String modification application

Below is working code of a semi complete program. Its purpose is to take an input string of any type and modify it based on rules defined for each type. So in this example I pass it a string in CSV ...
4
votes
2answers
165 views

Data screening using Perl

Background information I've been asked to write a little Perl script that allows genomic data to be screened against reference files in order to determine locations of specific mutations. The input ...
2
votes
2answers
825 views

Speeding up and fixing phone numbers from CSVs with Regex

I've hodgepodged together an attempt to extract all phone numbers from all CSVs in a directory, regardless of where they are and what format they're in. I want all phone numbers to be printed to a ...
4
votes
1answer
2k views

Converting latitude and longitude coordinates from CSV using web service

I am working on converting a mailing list that has longitude and latitude coordinates within the CSV file. This script I came up with does what I need, but this is my first real-world use of python. I ...
4
votes
1answer
101 views

Reading messages with binary tree

I'm building a binary tree. Example: key AAAA1.ETR, value 1. I'm reading files with this structure: ...
6
votes
2answers
604 views

Read CSV, compute some stuff and prepare data to be sent to GNUPlot

I would really appreciate some good advice on how to refactor a small app: It basically reads a CSV (energy/heat values?), computes some stuff, and then prepares some data which should later be sent ...
6
votes
1answer
3k views

Calculate query coverage from BLAST output

I have a BLAST output file and want to calculate query coverage, appending the query lengths as an additional column to the output. Let's say I have 2 7 15 <...
2
votes
1answer
3k views

Grouping a CSV by column

I've started writing a small CSV parser class as I needed a method to group a CSV file by a given column. ...
19
votes
8answers
50k views

Java function to read a CSV file

I have a java function that reads a csv and returns its content as a Vector<Vector<String>>. The function seems to work as I need it, but my gut ...
3
votes
2answers
4k views

Reading in a file and performing string manipulation

In a question I answered I posted the following code: ...
22
votes
4answers
8k views

Regex to parse semicolon-delimited fields is too slow

I have a file with just 3500 lines like these: filecontent= "13P397;Fotostuff;t;IBM;IBM lalala 123|IBM lalala 1234;28.000 things;;IBMlalala123|IBMlalala1234" ...
4
votes
4answers
3k views

File parsing code in C++

I'm processing about 3.5gb/15minutes, and I was wondering if I could get this down to a better time... Note that this is for a very specific CSV file, so I am not concerned about generality - only ...
6
votes
1answer
632 views

Creating a pythonic snippet to read and clean .csv files

I am trying to import a .csv file, clean the contents, and make sure all the errors are eliminated. IO error file format error data error I am using the snippet below. Could someone help me clean ...
3
votes
1answer
2k views

How to make this csv-reading PHP code more efficient?

I have the following code that reads a .csv file that than outputs the result in the form of a HTML table: ...
5
votes
1answer
956 views

Improve my copying of a CSV file

I need to merge some large csv files but I feel that the way I am doing it is not optmized. It gets a number of csvfiles and creates one ...
1
vote
3answers
957 views

CSV file cleanup

I'm fairly new to Python and am going to be parsing hundreds of thousands of names eventually. What I wanted to do was take individual CSV files, and create new CSV files with only the info I wanted. ...
1
vote
1answer
811 views

Ruby CSV reading performance problems

I (ruby beginner) have a performance issue with the following ruby code. The idea is to aggregate a CSV into a smaller, better-to-handle file and calculating the average of some values. Basically the ...
4
votes
1answer
854 views

Code correctness and refinement for quantile normalization

The below code is still far from feature complete, but am looking to have some of the sections critiqued to learn better idioms or adjustments (e.g. - yet to be implemented: handling of csv files with ...
2
votes
2answers
9k views

Writing defaultdict to CSV file

I have a defaultdict being written to file like this: ...
-2
votes
1answer
2k views

CSV parsing in Perl

I am looking for a Perl (5.8.8) script for CSV parsing that would follow CVS standards. (See Wikipedia or RFC-4180 for details) Sure, code should be fast enough, but more important is that it should ...
7
votes
1answer
470 views

Intern with no mentor struggling with refactoring and OOP

A little background I'm an intern at a large engineering company, and I'm also the only CS major in the entire building. The people on my team don't have technical backgrounds, but hired me to start ...
3
votes
1answer
4k views

Is there a better or more elegant way to code this CSV cell-parser (using CSVReader)?

I'm currently doing my first internship and had to create an application that will check through the first row of a CSV for valid or invalid input. Is there a more elegant way to code or to refactor ...
1
vote
2answers
1k views

Custom template iterator on CSV reading class

I made myself this code to read CSV files as I want to delve into machine learning. I do think that my code design is poor but I can't quite see why. The syntax of it does not feel right. I want to be ...
4
votes
3answers
4k views

Design Strategy of CSV Parser

I wanted to review my design strategy for CSV parser. I have 4 CSV files, which have different layouts as shown below. Each row of a CSV file will be mapped to a class. For example, if ...
6
votes
5answers
32k views

Faster way of reading csv to grid

I have following in Windows Forms .NET 3.5 It works fine for csv with records less than 10,000 but is slower for records above 30,000. Input csv file can can any records between 1 - 1,00,000 records ...
2
votes
2answers
1k views

Updating a chart from Yahoo Finance CSV files

I want to load some CSV columns or contents in my Ajax code. Please help me or improve my code. This will be live API code for me. Data will be downloaded from Yahoo Finance in CSV format on an ...
4
votes
3answers
1k views

73 Lines of Mayhem - Parse, Sort and Save to CSV in PHP CLI

Inside of a folder named txt I have 138 text files (totaling 349MB) full of email addresses. I have no idea (yet) how many addresses there are. They are separated ...

1
8 9 10 11
12