Hi,
I'm learning Python so I can take advantage of the really cool stuff in the
Natural Language Toolkit. But I'm having problems with some basic file
manipulation stuff.
My basic question: How do I read data in from a csv, manipulate it, and then
add it back to the csv in new columns (keep
I checked out the csv module and got a little further along, but still can't
quite figure out how to iterate line by line properly.
# This shows that I'm reading the file in correctly:
input_file=open("test-8-29-10.csv","rb")
for row in input_file:
print row
MyWord,Category,Ct,CatCt
!,A,29
Hi,
I'm parsing IMDB movie reviews (each movie is in its own text file). In my
script, I'm trying to extract genre information. Movies have up to three
categories of genres--but not all have a "genre" tag and that fact is making my
script abort whenever it encounters a movie text file that doe
Hi Vince,
Thanks very much for the one-line version--unfortunately, I still get errors.
The overall script runs over every text file in a directory, but as soon as it
hits a text file without a tag, it gives this error:
Traceback (most recent call last):
File
"C:\Users\tylersc\Desktop\Tyle
My Python script needs to process 45,000 files, but it seems to blow up after
about 10,000. Note that I'm outputting bazillions of rows to a csv, so that may
be part of the issue.
Here's the error I get (I'm running it through IDLE on Windows 7):
Microsoft Visual C++ Runtime Library
Runtime Er
Hi,
I have created a csv file that lists how often each word in the Internet Movie
Database occurs with different star-ratings and in different genres. The input
file looks something like this--since movies can have multiple genres, there
are three genre rows. (This is fake, simplified data.)
Thanks very much for the extensive comments, Steve. I can get the code you
wrote to work on my toy data, but my real input data is actually contained in
10 files that are about 1.5 GB each--when I try to run the code on one of those
files, everything freezes.
To solve this, I tried just havi
Hi,
I have code that works fine when I run it on Python 2.6.5, but I get an
"invalid syntax" error in Python 2.4.3. I'm hoping you can help me fix it.
The line in question splits a chunk of semi-colon separated words into separate
elements.
rgenre = re.split(r';', rf.info["genre"] if "genre"