Tagged Questions
5
votes
1answer
35 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 ...
3
votes
1answer
68 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
2answers
322 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 ...
3
votes
4answers
64 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
111 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
285 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 ...
5
votes
1answer
148 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 ...
6
votes
1answer
209 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
0answers
2k views
Reading columns and rows in a .csv file
I have some data in a .csv file, which looks roughly like this:
...
6
votes
1answer
178 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 ...
1
vote
1answer
284 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 ...
1
vote
3answers
78 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
134 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
307 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
196 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
1k views
2
votes
2answers
621 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
864 views
1
vote
4answers
139 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:
...
2
votes
2answers
164 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?
...
5
votes
2answers
524 views
Critiques on a trivially easy to use Python CSV class
I have been working on a project where I needed to analyze multiple, large datasets contained inside many CSV files at the same time. I am not a programmer but an engineer so I did a lot of searching ...
3
votes
1answer
224 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:
...
2
votes
3answers
1k views
Retrieving the first occurrence of every unique value from a CSV column
A large .csv file I was given has a large table of flight data. A function I wrote to help parse it iterates over the column of Flight IDs, and then returns a dictionary containing the index and value ...
3
votes
2answers
139 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.
...
4
votes
1answer
299 views
Script that scrubs data from a .csv file
Really, what I would like to know is: "What does this script tell you about how I need to improve as a programmer?" I'm somewhat new to both Python and programming, so feel free to minimize your ...
4
votes
4answers
2k views
searching a value from one csv file in another csv file - Python
I am writing a script that takes one csv file searches a value in another csv file then writes an output depending on the result it finds.
I have been using python's csv. Distreader and writer, I ...
8
votes
3answers
1k views
Python: getting lists of values from a CSV - Is there a cleaner way to do this?
So, I have a function that takes a column title, and a response.body from a urllib GET (I already know the body contains text/csv), and iterates through the data to build a list of values to be ...