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

3
votes
2answers
46 views

Compare lines in 2 text files with different numbers of fields

This is the (hopefully) final version of my script for my file comparison problem mentioned previously in two posts on Stack Overflow (here and here). I have come up with the code shown below, which ...
3
votes
0answers
128 views

Opening the same CSV file in two different ways in order to transform data in one column and update original CSV using Python

I have the following functions and accompanying script. The purpose of these is is to extract XML data from one CSV column (one XML document for each row), and then transform it into a dictionary ...
5
votes
1answer
59 views

Query AD and build CSV based on certain user object properties

My question is about code efficiency. I recently had to write a Powershell 3.0 script which had the following criteria: It had to pull all enabled user objects from active directory It had to pull ...
7
votes
3answers
44 views

Accessing files in a child directory in Python 2.7.x

I have written the below script for use in Python 2.7.x. In essence, I want the script to access a folder contained within the directory the script is and then add all files contained within to a ...
6
votes
1answer
68 views

Python: Writing lists to .csv file

I’m teaching myself programming, using Python as my initial weapon of choice. I have learnt a few basics and decided to set myself the challenge of asking the user for a list of names, adding the ...
6
votes
1answer
31 views

Convert data back-and-forth between CSV files and pretty-print

I wrote a script to convert CSV files in human readable format and vice versa. Human readable format is achieved like so: ...
8
votes
2answers
54 views

Iterate list to map entries in Python

I have two files, namely: File1: CL1 AA XX YY ZZ SS \n CL2 3_b AA File2: AA string1 AA string2 3_b string3 My ...
12
votes
3answers
580 views

Retrieving a csv header

I have two seperate calls that returns a .csv file. I need to extract a couple of headers from the files depending on which one is called. The headers does not always sit in the same index, and the ...
7
votes
3answers
144 views

MP3 Vote Collator - Final

Here is the completed code for my first Python project, for which I received some help and feedback here: Collate votes on MP3 files to list them by popularity Seeing as there have been considerable ...
8
votes
3answers
160 views

Collate votes on MP3 files to list them by popularity

For my first Python project, I decided to create a script that would automatically collate MP3 files into a music countdown. I wanted to 'learn by doing', so I dived straight in and used the Python ...
6
votes
3answers
48 views

Categorizing gene sequences read from a CSV file

I am relatively new to programming and would love to get some feedback on the following section of my code. ...
4
votes
1answer
35 views

Powershell to break apart large flat files (e.g. csv)

I created the below script to help break apart large flat files; to save myself effort opening files which are several gigs in a text editor and manually split them. So far I've only tested on sample ...
7
votes
4answers
216 views

Blocking production lines in Python

I have the following code that works great, but takes 40 mins to 1 hours to finish the task. It has at least 30 rules for blocking lines, and 30k+ orders to check. I'm new to Python (3 months working ...
3
votes
2answers
84 views

Python code to encrypt and email PDF file using PyPDF2

This is my first programming project with real world application. It's purpose is to take a file from a directory, encrypt it with a predetermined password, and email to appropriate recipient. ID ...
3
votes
1answer
92 views

Finding nearest float values corresponding to a data point (of three variables) in a table with multiple columns using C++

I have a data file which contains floating point data arranged in 4 columns. Each row represent a specific data point. The first column(X) is made up of 100 different values but the values are ...
1
vote
1answer
30 views

Computing sums in some CSV files horizontally and in other CSV files vertically

I'd like to eliminate the code duplication in the following two methods by moving the common code into a separate method callable by both. The comments indicate the blocks of code that have a ...
3
votes
3answers
310 views

Merging two files into one .CSV

I'm relatively new to Python scripting. I made a script that takes two raw data files and merges them into one CSV file, but it takes a long time to complete. Are there any logic problems in this ...
0
votes
1answer
29 views

Parsing an uploaded file, returning record of 10 fields for each line [closed]

I have a program that reads a .txt file from a given directory. Each record line contains a data and I am parsing it. I think this is costly with it comes to performance but I might be wrong. Here is ...
3
votes
0answers
38 views

Change an identifier in a .csv file, based on another .csv file

I have only dabbled in Java before (my previous experience being mostly with PHP and JavaScript) but a request come through for a small application that seemed like a good chance to get some ...
2
votes
0answers
50 views

Clean reading of HTML table with R

I have some data under an HTML format and would like to import it in R. However, it seems that type inference is much less sophisticated than what exists with functions such as read.table. I am using ...
3
votes
2answers
39 views

Writing embedded list to CSV in Python

I have a method in a Python app to write a list of records to a CSV file. Each record is a "football player", which is really just a dictionary. But one of the dictionary items contains a list of ...
1
vote
1answer
109 views

Parsing a CSV file in node.js and express.js

I want to import a CSV file and do some operation on it. The following is the code I'm using and it is working fine: ...
3
votes
5answers
276 views

Loading and converting data from CSV

My application imports a CSV file and parses each row, turning it into an object in my code. The speed for a 500,000 row x 68 column takes 2+ minutes to read. I've narrowed down the bottleneck to the ...
2
votes
2answers
82 views

Creating a tuple from a CSV file

I have written code that reads in a CSV file and creates a tuple from all the items in a group. The group ID is in column 1 of the table and the item name is in column 2. The actual datafile is ~500M ...
1
vote
0answers
39 views

Copying csv to sql_table

I wrote code that takes csv and export it to sql table. It looks like this: ...
2
votes
1answer
39 views

Determine column averages

I'm trying to write terse Perl code to calculate the average of each column in a file. The file can have >= 1 columns. ...
4
votes
2answers
108 views

Grouping positive & negative reviews and counting the words

Can somebody help me make the code below smarter and free of redundancy? The code does exactly what I want, but I believe there are many redundant loops and arrays. ...
3
votes
4answers
67 views

Using Python to rename multiple csv files in Windows

I need to rename a large list of csv files that are generated from 3 different servers. The files are produced with a date stamp as the extension, which I need to move in each file name to retain the ...
2
votes
2answers
55 views

Processing eBay category list for database import

Although I've been programming a fair while I'm learning Python and would like to know how I can make my code more "Pythonic". I'm have a CSV file of eBay categories, containing the name and numeric ...
0
votes
1answer
31 views

CSV Creation from two tables with URL for user to click on

The code works but with an increase in data it's now slower so needs a tweak so looking for pointers. ...
2
votes
1answer
31 views

Save list over many csv files each with given number of lines

I wrote a little code for outputting to csv. It takes a list object named outtext and saves multiple .csv files. Each csv file contains ...
4
votes
1answer
72 views

Group lines from the CSV file

I have a CSV file which looks like this: ...
2
votes
1answer
51 views

PHP class to represent types of refrigerants

I'm relatively experienced with Java and C++ so picking up PHP wasn't too difficult. I wanted to get some feedback on my first PHP class. There's nothing extremely complicated as of now, but its nice ...
-3
votes
3answers
57 views

Write object data to CSV files [closed]

Does this method follow the rules of objective programming? If not, how can I change it? ...
5
votes
2answers
54 views

Process text file of fulltext articles from news publications

I'm relatively new to programming and have started writing some code for work. This script is something I wrote that I'd like to have someone comment on. Am I doing anything silly, stupid or totally ...
2
votes
0answers
432 views

CSV to JSON conversion in Java

Since I've looked far and wide for a good example of this to no avail, I have created my own using the JSONArray and JSONObject ...
2
votes
3answers
101 views

Read file into list when class is instantiated in Python 2.7

I would like to read a file into a list when I create the class below. Once the list is ready, I would like to access it outside the class in order to process more code based on the list which now ...
7
votes
3answers
230 views

Parsing pipe delimited lines

I am parsing the following line of code via a specific format. Line is: S|111111|87654321|Bar UK|BCreace UK|GBP|24/08/2010| The Format is: ...
3
votes
2answers
48 views

Advanced CSV-to-SQLite converter

I just wrote an advanced CSV parser that translates CSV to SQL(SQLite Compatible) statements, which are then inserted into the database. It translates variable names in the CSV to values defined in ...
2
votes
1answer
29 views

Create an array of categories from comma-seperated text input

This code works just fine, but could obviously be more elegantly written. The basic idea is to create an array of categories from a text input. The code splits up the text input by commas to create ...
4
votes
1answer
123 views

Generating frequency tables based on CSV dataset, in R

As a follow-up to this question concerning Python I present you with the exact same thing - for R. Initially I started with R. However, it takes 44 minutes to run when unleashed on all my data. I ...
4
votes
2answers
78 views

Dataset and frequency list generation by looping over files

I have been told that it would be wise to split up my code into semantically useful blocks. I tried the following but I need feedback. What I already did: As you can see I create two .csv files, so ...
2
votes
1answer
36 views

CSV parsing program that creates distinct header rows with transaction rows underneath

My code reads in the data using DictReader, then creates a header row that contains my composite key (PEOPLE_ID, DON_DATE), and then adds various values that are ...
4
votes
3answers
123 views

Writing huge 2D vectors to text file too slow

I have 10 large (34 million cell) 2D gridded vectors storing doubles. When written they are over 200 MB in size. I use an ofstream object to write them to a text ...
3
votes
1answer
302 views

Stripping whitespace in a CSV file

I am interested in removing leading/trailing whitespace in a .csv file, and I was wondering if there's a better way to execute this: ...
4
votes
1answer
190 views

Updating a .csv file

I have a CSV file, call it csv_file. It has the following content: Username, Password name1, pass1 name2, pass2 ... I also have a dictionary, call it ...
6
votes
3answers
212 views

Manipulating a .csv file to look for two common values to create a key, then summing up values

My code reads a .csv file, looks for a couple values to create its key, and then wraps up the data based on a few business rules I have. I'm trying to learn "the right way", so I'd really appreciate ...
3
votes
2answers
243 views

Python script to create Android/iOS strings from a .csv

My script takes a CSV file of strings and then creates an XML file for Android and a .strings file to be used for iOS. It separates each locale meaning that a file will be created for each language. ...
6
votes
3answers
91 views

Building a report of DNA sites and chunks

Here is the slow part of my code: ...
3
votes
1answer
336 views

Reading, writing and filtering a CSV file

I have a CSV with 5+ million rows and I want to filter it: ...