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.
2
votes
1answer
19 views
Split CSV by Repeated cells python
Any time that a row ID (oddly placed in column 8, i.e. row[7]) is repeated after the first instance, I want to write those rows into a second file. The code I'm using is extremely slow -- it's a ...
2
votes
2answers
36 views
CSV File Parser in Ruby - Attempt No. 2
The following is my second attempt at a basic CSV parser in Ruby. I've addressed suggestions that I've got for my previous version here.
I have omitted all test cases - the code listing would be too ...
5
votes
3answers
43 views
Some simple Perl and Regex
Reads from a flat file of three columns, delimited by at least one tab character. Filters the three columns based on input; returns list of corresponding emails. Arguments passed like ...
2
votes
1answer
26 views
Parse a csv file and create a dictionary of partial results
I have a bunch of .csv files which I have to read and look for data. The .csv file is of the format:
...
2
votes
0answers
22 views
Parsing CSVs for bulk database insertions
I'm writing this as (eventually) part of a larger program. This will serve as the bulk data insertion from .csv files we parse.
I'm primarily looking for parts that are
breaking Go's formatting, ...
4
votes
1answer
192 views
Combat log parser for World of Warcraft
This is part of a bigger project I'm doing to get better at JavaScript. It's basically the beginnings of a combat log parser for World of Warcraft. It looks a bit messy right now and I could really ...
4
votes
3answers
198 views
Splitting and printing comma-separated values
I stumbled upon a question on SO asking how to split a comma-separated string into individual values.
Since it's been a while since I've had any good reason to write C I'd like to ask for some ...
0
votes
1answer
62 views
2
votes
1answer
68 views
CSV writer implementation refactored
Based on my initial implementation found here and the suggested improvements in answers and comments, I've refactored the code.
The main changes are:
Removed redundant buffering.
Simplified ...
6
votes
1answer
160 views
CSV writer implementation
I've recently been assigned to write up a CSV writer with "as much flexibility" as possible concerning pretty much all (output stream, string fields with potential new line characters, separator ...
1
vote
1answer
82 views
Python CSV file import and object manipulation
I am trying to import a .csv file and save data in objects for later manipulation in Python. I am very new to coding so please do let me know my fundamental errors.
...
5
votes
3answers
69 views
Extracting two columns from exported iTunes playlist
My friend wanted me to send her a list of songs from one of my iTunes playlists, so I exported the playlist within the app itself. It comes as a plain text file, where each field is separated a ...
3
votes
1answer
67 views
Enhance CSV file database import
I'm using the script below to import a large .csv file to my database. If the table is empty the process takes about 5 minutes to finish on a local machine. If I'm using the file to update existing ...
1
vote
0answers
31 views
Store CSV in Redis
I needed to make a small script to read a csv file and store 2 columns in Redis. Can you guys take a look over the code and let me know how I can improve my code style?
...
10
votes
3answers
361 views
Print Student Names from CSV
Description
Print all student names from a CSV file.
CSV Format:
CSV file does not contain string delimited by double quotes.
None of the cells has "," ...
1
vote
1answer
31 views
5
votes
1answer
47 views
Using a TSV text file and map for a Q&A program
The program outputs a menu asking for a new question or to ask a question. If you ask a question, it will search a .tsv text file for the question and return the answer. It will then check a map that ...
3
votes
1answer
96 views
3
votes
2answers
150 views
Concatenating rows in CSV files and removing old CSV files
I have written my first Python script that will go into live use at my workplace. I am relatively new to Python and I think this script is pretty good but I would like your input.
It runs very fast, ...
3
votes
1answer
70 views
Read CSV with 3 columns and group some elements
I have a csv with 3 columns (date, name, number) and it is about 20K rows long. I want to create a dictionary keyed by date whose value is a dictionary of ...
2
votes
1answer
64 views
AD update from CSV
I get a CSV dump of all employee records from our payroll system once a week. The CSV has something like 28K records. The key between the two systems is the ...
11
votes
2answers
509 views
CSV reader using StreamReader and LINQ
Mostly due to readability, I am using the following code to
find a specific csv file on a drive
read that CSV file using a streamReader
parse it into a ...
2
votes
1answer
165 views
Slow Python text-processing script
This script of mine merges columns 1 and 2 from one input file and sees if these merged combinations exist in the other infile (and vice versa).
I know I get stuck in appending. It did not get past ...
0
votes
0answers
57 views
Speeding up filtering function in Pandas
I have a CSV file with 400 000 rows and the following headers:
...
2
votes
1answer
62 views
A module to display, update and save a dictionary as .csv v2.0
I'd like feedback on my revised code after my previous question.
The goal is to create a module which can display, update, save dictionaries as .csv files. I'll use this in another program to update ...
3
votes
3answers
199 views
A program to display, update and save a dictionary as .csv
I'm now looking for feedback on v2.0 of this program instead.
I'd like some feedback about my code. What bad habits do I have? What advice could help me write more Pythonic?
I'm trying to write a ...
1
vote
1answer
185 views
Processing Excel files of a predefined template to generate output CSV files of another predefined template
I'm a freelancer and I recently wrote a python script that processes input xlsx files that contain data in a particular format and output a csv file in another format as required.
The code works well ...
4
votes
0answers
56 views
Vectorize Fisher's Exact Test
I have two data frames/ lists of data, humanSplit and ratSplit, and they are of the form
...
2
votes
0answers
79 views
Adding file name information to CSV file columns
Is there a simple way to combine the functions of this Powershell script? It would be nice to have it file to one output file instead of several output files.
...
2
votes
2answers
33 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 ...
1
vote
1answer
73 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
286 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 ...
5
votes
3answers
109 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
242 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
360 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
1k 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 ...
16
votes
5answers
2k views
Parsing CSV to specific format
I've written this code to read CSV files written in 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
227 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
58 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
99 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:
...
5
votes
3answers
73 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 ...
4
votes
2answers
126 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
168 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.
...
6
votes
2answers
1k views
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, the code works when I ...
5
votes
1answer
131 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
85 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
92 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
136 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 ...
1
vote
1answer
428 views
Parse Bloomberg Excel/CSV with Pandas DataFrame
I retrieved Bloomberg data using the Excel API. In the typical fashion, the first row contains tickers in every fourth column, and the second row has the labels Date, PX_LAST, [Empty Column], Date, ...
8
votes
2answers
1k 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
...