csv

how to use subsonic to read csv file

hi there, i'm supposed to convert a csv file into a nice report for bosses. At first, I didn't even think of programming at all. As a power user of both excel and word, i thought i could get the job done in no time with this, maybe even without any stupid ms macro at all... it turns out i was wrong. so i'm gonna have to program somet...

python csv: save results to csv file

import csv with open('test.csv', 'rb') as f: data = list(csv.reader(f)) import collections counter = collections.defaultdict(int) for row in data: counter[row[1]] += 1 for row in data: if counter[row[1]] >= 4: writer = csv.writer(open("test1.csv", "wb")) writer.writerows(row) i am getting strange output! what is...

Download CSV file using "AJAX"

Hi, I'm trying to accomplish a fairly simple task for my website, but I"m not sure exactly how to go about it. I want the user to be viewing a table, then click a button, at which point the user can save the contents of that table as a csv file. This request can sometimes be quite complicated so I generate a progress page to alert the us...

c#, Excel + csv: how to get the correct encoding?

Good evening my dear programming gods! I've been trying this for quite a while now, but can't figure it out :-( I'm trying to export data to Excel via a *.csv file. It works great so far, but I have some encoding problems when opening the files in Excel (original string on the left, EXCEL result on the right): Messwert(µm / m) ==> Mes...

python csv - not closing file

im reading a csv file and then writing a new one: import csv with open('thefile.csv', 'rb') as f: data = list(csv.reader(f)) import collections counter = collections.defaultdict(int) for row in data: counter[row[11]] += 1 writer = csv.writer(open('/pythonwork/thefile_subset1.csv', 'w')) for row in data: if counter[row[11]] ...

python : getting rid of extra line:

import csv with open('thefile.csv', 'rb') as f: data = list(csv.reader(f)) import collections counter = collections.defaultdict(int) for row in data: counter[row[10]] += 1 with open('/pythonwork/thefile_subset11.csv', 'w') as outfile: writer = csv.writer(outfile) for row in data: if counter[row[10]] >=...

python: inserting a whole line into a list

import csv with open('thefile.csv', 'rb') as f: data = list(csv.reader(f)) import collections counter = collections.defaultdict(int) for row in data: counter[row[10]] += 1 with open('/pythonwork/thefile_subset11.csv', 'w') as outfile: writer = csv.writer(outfile) sample_cutoff=500 b[] for row in data: ...

test suite for CSV specification?

i am facing some problem for writing test suite (test cases)for basic CSV specification . i have no idea how to write that? can anyone help? ...

DBD::CSV: Returns header in lower case

I've got a problem with the module DBD::CSV v0.30. Since a update to the newes version, all headers in the fetchrow_hashref generated hash are lower case instead of mixed case. Finaly the data will be comited to a mysql database and the column header should be mixed case. This is a snipet of my script using the DBD::CSV my $csv_dbh ...

Fill in a column in a CSV file using POWERSHELL V2

i have a CSV file : COL1;COL2;COL3;COL4 1;1;;4 6;9;;0 9;8;;4 How do i fill in COL3 with a default value X? so the result would be : COL1;COL2;COL3;COL4 1;1;x;4 6;9;x;0 9;8;x;4 How can i achieve this using Powershell V2 or even ultra edit or Notepad++ Thanks ...

python: proper usage of global variable

here's the code! import csv def do_work(): global data global b get_file() samples_subset1() return def get_file(): start_file='thefile.csv' with open(start_file, 'rb') as f: data = list(csv.reader(f)) import collections counter = collections.defaultdict(int) f...

python newbie question: converting code to classes

i have this code: import csv import collections def do_work(): (data,counter)=get_file('thefile.csv') b=samples_subset1(data, counter,'/pythonwork/samples_subset3.csv',500) return def get_file(start_file): with open(start_file, 'rb') as f: data = list(csv.reader(f)) counter = collecti...

Regex Unclosed Quote

Hi all, I am trying to figure out a way to read a CSV with returns in it in PHP. The problem is when you read the file like this: if (($handle = fopen($file, "r")) !== FALSE) { while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { row data... } } If you have a retun in the CSV it does not work, it just sees the retur...

How to use csv.reader in python with french character like é,à,ç,ê,ë,...

I have a csv file like 120 column by 4500 row. I read the field "customer name" in the first column, first row. I then look fot this field in a second cvs file containing the "customer name , and customer ID" I write a new cvs file with "customer name", customer ID", and all the rest of the 119 colunm.and continue until end of first fi...

python: complicated loop through list

import csv import collections def do_work(): (data,counter)=get_file('thefile.csv') b=samples_subset1(data,counter,'/pythonwork/samples_subset4.csv',500) medications_subset2(b,['HYDROCODONE','MORPHINE','OXYCODONE']) def get_file(start_file): with open(start_file,'rb') as f: data=list(csv.reader(f)) counter=collections.d...

Comparing 2 CSV files in C# advice?

I need to develop an application where two csv files are compared. The first file has a list of email addresses. The second list also has email addresses, but includes name and address info. The first list contains email addresses that need to be removed from the second list. I have the Fast CSV reader from the CodeProject site which wor...

How to create a table and its related model.py automatically from a csv file in Django

Think of this: You create a CMS of some sort, which asks you for an application name and a csv file for that application. Then it automatically creates that app on the fly, creates the required model.py based on the csv columns, activates the admin page for it and allows only you to have the full permission to this new table via django ...

RegEx - Java Split Command Parsing Csv File

I have a CSV in this below format 11000,Christopher,Nolan,MR.,Inception,25993,France,"Lefoullon,Paris",920,Director,*461-7755,33-461-7755,12175,"O'Horner, James",12300,"Glebova, Nathalie",,[email protected],Capital,NEW http://stackoverflow.com/questions/2241758/regarding-java-split-command-parsing-csv-file In this link @Mar...

Generic class to CSV (all properties)

Im looking for a way to create CSV from all class instances. What i want is that i could export ANY class (all of its instances) to CSV. Can some1 direct me to possible solution for this (in case already anwsered). thanx ! ...

Convert from Database / Excel / CSV to YAML data fixtures?

Was wondering if there is an easy to convert structured files into YAML data fixtures for Doctrine / Symfony. I don't see any utility with Doctrine to accept CSV. I might just start writing something simple to do this. Is it worthwhile? ...