Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Iterating a dictwriter
Post: Iterating a dictwriter

The below code behaves very strangely and unexpectedly in a few places. In the for loop, the loop always selects the first row (Invoice Amount) in the CSV file even though I know the loop is iterating...
pstarrett General Coding Help 0 2,605 Feb-19-2018, 01:44 AM
    Thread: Adding Columns to CSV using iterator
Post: RE: Adding Columns to CSV using iterator

That did the trick...thank you, Buran!
pstarrett Data Science 10 27,635 Jan-22-2018, 02:37 AM
    Thread: Adding Columns to CSV using iterator
Post: RE: Adding Columns to CSV using iterator

Sorry, here is the code, in tags. It seems the for loop will run once for row_ID and once for row hence the double entry in my CSV file. Maybe I'm wrong about why this is happening but it is happening...
pstarrett Data Science 10 27,635 Jan-21-2018, 05:32 AM
    Thread: Adding Columns to CSV using iterator
Post: RE: Adding Columns to CSV using iterator

Thank you, Buran, that code works great. The only remaining issue that I cannot seem to resolve is that the enumerate winds up duplicating the two columns since it makes one pass through the loop for ...
pstarrett Data Science 10 27,635 Jan-19-2018, 12:09 AM
    Thread: Adding Columns to CSV using iterator
Post: RE: Adding Columns to CSV using iterator

Below is what I tried based on previous advice. Enumerate does not work with a writer (writer is not iterable). I am simply trying to open an existing CSV file and write into columns that are already ...
pstarrett Data Science 10 27,635 Jan-16-2018, 05:06 AM
    Thread: Adding Columns to CSV using iterator
Post: Adding Columns to CSV using iterator

Here is what I need to do. 1. I have an existing CSV file with 12 columns in it containing financial information. This CSV is sorted. I need to ADD two columns: 'product item number' (a 7 digit int)...
pstarrett Data Science 10 27,635 Jan-09-2018, 05:00 AM
    Thread: Sklearn Agglomerative Hierarchical Clustering - help with array set up
Post: RE: Sklearn Agglomerative Hierarchical Clustering ...

zivoni, thank you very much. I will give that a try!
pstarrett Data Science 4 5,320 Feb-21-2017, 05:05 AM
    Thread: Sklearn Agglomerative Hierarchical Clustering - help with array set up
Post: RE: Sklearn Agglomerative Hierarchical Clustering ...

Larz60, thank you very much for the link. I will try to digest this but there is a lot going on in areas where I have no background (I did see this example actually and passed on it given how involved...
pstarrett Data Science 4 5,320 Feb-20-2017, 07:07 PM
    Thread: Sklearn Agglomerative Hierarchical Clustering - help with array set up
Post: Sklearn Agglomerative Hierarchical Clustering - he...

I am working with sklearn's Agglomerative Hierarchical Clustering and I have a simple issue with how to set up the input array. I am following the example here: https://docs.scipy.org/doc/scipy/refer...
pstarrett Data Science 4 5,320 Feb-19-2017, 11:43 PM
    Thread: Unable to open files without file extension
Post: RE: Unable to open files without file extension

Thank you for the answer and it is in the direction but ultimately got me to the right place. I am using Python 3.4 right now so that version of the glob library is used in 3.5. I am required to use t...
pstarrett General Coding Help 3 7,272 Dec-24-2016, 07:45 PM
    Thread: Unable to open files without file extension
Post: Unable to open files without file extension

I am working with the Enron emails and they do not have a file extension. I can get the first set of code to work but I cannot in the second (see error I am getting there): This code works (cwd stand...
pstarrett General Coding Help 3 7,272 Dec-24-2016, 03:03 AM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020