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.

learn more… | top users | synonyms

1
vote
1answer
63 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. ...
10
votes
1answer
204 views

Find the peak stock price for each company from CSV data

During the hiring process, a company gave me this test: Q) Consider Share prices for a N number of companies given for each month since year 1990 in a CSV file. Format of the file is as below ...
3
votes
3answers
72 views

CSV demographics analyzer seems to waste memory/move slowly

I'm much more fluent in JS, but I needed to sort a lot of dates, ages, genders, etc. from a tab-delimited text file so I wrote this. Could I get some tips on how to make this more efficient and more ...
3
votes
3answers
184 views

CSV reader (revised)

This is the successor of my previous CSV reader. I implemented quite some useful suggestions. I will give explanation on a few parts: Prefixing constant identifiers with ...
8
votes
5answers
250 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 ...
2
votes
5answers
351 views

CSV reader and parser

I have implemented a CSV reader. I think I did pretty well. Since CSV is a loosely defined format to begin with I decided to allow some malformations, like anything but a delimiter after an enclosed ...
15
votes
5answers
607 views

Parsing CSV to specific format

I've written this code to read CSV files written to a specific format. I would like to gather some feedback on where it could be improved. I'm trying to get into the test driven development ideology ...
6
votes
1answer
49 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 ...
5
votes
1answer
44 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
1answer
75 views

Converting JDBC to CSV

One of my first ever jython scripts lets me get comma-separated values out of an RDBMS. I submit it here in hopes that you'll rip me apart. Without further ado, have at it: ...
4
votes
2answers
56 views

Command line tools to format tables

I am a a big fan of one-liners using sed awk perl and other tools. But there are things hard ...
4
votes
2answers
67 views

Improving performances processing compressed csv files

I have some csv files compressed in .bz2 format. I need to take a subset of the records (and data) and switch to .gz. I am not ...
5
votes
1answer
97 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
2answers
475 views

How to optimize for larger files: MemoryError in Python while combining multiple JSON files and outputting as single CSV

I have a number of JSON files to combine and output as a single CSV (to load into R), with each JSON file at about 1.5gb. While doing a trial on 4-5 JSON files at 250MB each, I get the following ...
5
votes
1answer
119 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
72 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 ...
4
votes
4answers
77 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 ...
2
votes
2answers
115 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 ...
7
votes
2answers
403 views

Parsing CSV file with BufferedReader vs Scanner

I have to parse file line by line and in single line I have split by ",". First String would be Name and Second would be count. Finaly I have to display the Key and Count For example ...
10
votes
2answers
395 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 ...
0
votes
0answers
112 views

Optimizing a function to read bigger files in php

I have the following function that reads data from a csv file and it is supposed to take in data which is from a certain certain timeinterval in this case 07:59 and saves them up in another csv file. ...
4
votes
1answer
406 views

Printing out JSON data from Twitter as a CSV?

I'm extremely new to Python, and the Twitter API, but I found a example online that walked me through the process. Now that I've been playing around with it for awhile, I've begun to push the limits ...
3
votes
1answer
74 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
163 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 ...
2
votes
2answers
122 views

Updating tables with bulk of data through CSV

My work is pretty simple. I have to migrate a bulk of data into the specified tables, so that the data does show up at the front-end. The data is provided through the ...
5
votes
1answer
199 views

Fastest Way to Write Multiple CSV's

I'm writing a program to process log files. Currently, I have a script that will extract the desired information from each log and put it into a list - I have about nine different lists all ...
4
votes
1answer
76 views

Cutting strings into smaller ones based on specific criteria

So, I've got this largish (for me) script, and I want to see if anybody could tell me if there are any ways to improve it, both in terms of speed, amount of code and the quality of the code. I still ...
3
votes
1answer
299 views

Knn console application; problematic implementation

I'm working on a small command line application in c# where data is read from a CSV file along with a query and KNN is calculated for the query based on the data. My problem isn't the algorithm at ...
3
votes
1answer
58 views

Generating two .csv files from named parameters

I wrote Clojure code which takes named params and has to generate 2 .csv files as output. Please review it. ...
6
votes
1answer
293 views

Speed up CSV reading code (vector of doubles)

I am trying to read a single-columned CSV of doubles into Java with a string header. It is 11 megabytes and takes over 15 minutes to read, which is clearly ...
6
votes
1answer
228 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 ...
1
vote
1answer
107 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. ...
2
votes
0answers
3k views

Reading columns and rows in a .csv file

I have some data in a .csv file, which looks roughly like this: ...
3
votes
2answers
414 views

Reading in a file and performing string manipulation

In a question I answered I posted the following code: ...
6
votes
1answer
182 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
227 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: ...
4
votes
2answers
406 views

Perl Code Improvements - reading CSV file

I am very new to Perl, but quite pleased with my short introduction to it! So, scenario is I have a number of text files (they are reports from a financial system) stored in a directory. Each report ...
1
vote
1answer
297 views

get city and state using zip code, scrape in Python

I'm looking for any and all feedback on quality, style and efficacy of the code. If there's a simple way to get the header put in, I'd love to hear that. The code is used to take zip codes from a csv ...
5
votes
1answer
145 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
84 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. ...
3
votes
1answer
147 views

Using a .csv file to insert data into the Django model

I have a script that uses a .csv file into insert data to the Django model. Now, I wonder if there's a better way of doing this. ...
16
votes
4answers
2k 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
1answer
310 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 ...
2
votes
1answer
204 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 ...
0
votes
1answer
2k views
2
votes
2answers
717 views

Python: Open Multiple Files

I am trying to open two CSV files, one for reading and one for writing. The script should continue only if both files were successfully opened. My code seems to accomplish that but it seems like it ...
1
vote
2answers
1k views

Writing defaultdict to CSV file

I have a defaultdict being written to file like this: ...
1
vote
2answers
69 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 ...
1
vote
4answers
142 views

How can I shorten and remove repetition from this Python script?

I've got a CSV that contains users and permissions in the below format, where users can have as little as one or as many as eight different permissions: ...
6
votes
1answer
351 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 ...