Understanding how to quote XML string in order to serialize using Python's ElementTree

2016-01-09 Thread kbtyo
My specs: Python 3.4.3 Windows 7 IDE is Jupyter Notebooks What I have referenced: 1) http://stackoverflow.com/questions/1546717/python-escaping-strings-for-use-in-xml 2) http://stackoverflow.com/questions/7802418/how-to-properly-escape-single-and-double-quotes 3)http://stackoverflow.com/quest

Understanding " 'xml.etree.ElementTree.Element' does not support the buffer interface"

2016-01-10 Thread kbtyo
Hello Everyone: I am curious to know why I receive the aforementioned message. I am using Python 3.4.3 and Windows 7. I am running the following script from Windows Powershell: Response = 's.csv' with open(Response, 'rU', encoding='utf-8') as data: separated = data.

Improving code written in order to reduce verbosity and perhaps use a decorator?

2016-01-10 Thread kbtyo
Hello everyone: A member on the Stack Overflow community advised me to post my question on this forum: http://codereview.stackexchange.com/questions/116395/opening-the-same-csv-file-in-two-different-ways-in-order-to-transform-data-in-on I appreciate your feedback immensely. Sincerely, Saran -

Suggestions for best practices when automating geocoding task

2016-02-11 Thread kbtyo
Good Morning, I welcome feedback and suggestions for libraries or resources in order to automate the following: 1. Given a directory of CSV files (each containing an address field) a. Read each CSV file b. Use address instance in row as part of a query and send request to external API

Organizing function calls once files have been moved to a directory

2015-06-23 Thread kbtyo
I am working on a workflow module that will allow one to recursively check for file extensions and if there is a match move them to a folder for processing (parsing, data wrangling etc). I have a simple search process, and log for the files that are present (see below). However, I am puzzled b

Re: To write headers once with different values in separate row in CSV

2015-06-24 Thread kbtyo
On Tuesday, June 23, 2015 at 3:12:40 PM UTC-4, John Gordon wrote: > In Sahlusar > writes: > > > However, when I extrapolate this same logic with a list like: > > > ('Response.MemberO.PMembers.PMembers.Member.CurrentEmployer.EmployerAddress > > .TimeAtPreviousAddress.', None), where the headers

Re: To write headers once with different values in separate row in CSV

2015-06-24 Thread kbtyo
On Tuesday, June 23, 2015 at 9:50:50 PM UTC-4, Steven D'Aprano wrote: > On Wed, 24 Jun 2015 03:15 am, Sahlusar wrote: > > > That is not the underlying issue. Any thoughts or suggestions would be > > very helpful. > > > Thank you for spending over 100 lines to tell us what is NOT the underlying >

Re: Organizing function calls once files have been moved to a directory

2015-06-24 Thread kbtyo
On Tuesday, June 23, 2015 at 10:18:43 PM UTC-4, Steven D'Aprano wrote: > On Wed, 24 Jun 2015 06:16 am, kbtyo wrote: > > > I am working on a workflow module that will allow one to recursively check > > for file extensions and if there is a match move them to a folder for

Re: To write headers once with different values in separate row in CSV

2015-06-24 Thread kbtyo
On Wednesday, June 24, 2015 at 8:38:24 AM UTC-4, Steven D'Aprano wrote: > On Wed, 24 Jun 2015 09:37 pm, kbtyo wrote: > > > On Tuesday, June 23, 2015 at 9:50:50 PM UTC-4, Steven D'Aprano wrote: > >> On Wed, 24 Jun 2015 03:15 am, Sahlusar wrote: > >> >

Re: To write headers once with different values in separate row in CSV

2015-06-25 Thread kbtyo
Okay, so I have gone back to the drawing board and have the following predicament (my apologies, in advance for the indentation): Here is my sample: 0 0 0 0 0 0

enumerate XML tags (keys that will become headers) along with text (values) and write to CSV in one row (as opposed to "stacked" values with one header)

2015-06-25 Thread kbtyo
My question can be found here: http://stackoverflow.com/questions/31058100/enumerate-column-headers-in-csv-that-belong-to-the-same-tag-key-in-python Here is an additional sample sample of the XML that I am working with: 0 0 0 0

TypeError: unhashable type: 'dict' when attempting to hash list - advice sought

2015-08-29 Thread kbtyo
I am using Jupyter Notebook and Python 3.4. I have a data structure in the format, (type list): [{'AccountNumber': N, 'Amount': '0', 'Answer': '12:00:00 PM', 'ID': None, 'Type': 'WriteLetters', 'Amount': '10', {'AccountNumber': Y, 'Amount': '0', 'Answer': ' 12:00:00 PM',

Re: TypeError: unhashable type: 'dict' when attempting to hash list - advice sought

2015-08-30 Thread kbtyo
On Saturday, August 29, 2015 at 10:50:18 PM UTC-4, MRAB wrote: > On 2015-08-30 03:05, kbtyo wrote: > > I am using Jupyter Notebook and Python 3.4. I have a data structure in the > > format, (type list): > > > > [{'AccountNumber': N, > > 'Amount&

Re: TypeError: unhashable type: 'dict' when attempting to hash list - advice sought

2015-08-30 Thread kbtyo
On Saturday, August 29, 2015 at 11:04:53 PM UTC-4, Ben Finney wrote: > kbtyo writes: > > > I am using Jupyter Notebook and Python 3.4. > > Thank you for saying so! It is not always required, but when it matters, > this information is important to state up front. > > &

Re: TypeError: unhashable type: 'dict' when attempting to hash list - advice sought

2015-08-30 Thread kbtyo
On Sunday, August 30, 2015 at 1:16:12 PM UTC-4, MRAB wrote: > On 2015-08-30 17:31, kbtyo wrote: > > On Saturday, August 29, 2015 at 10:50:18 PM UTC-4, MRAB wrote: > >> On 2015-08-30 03:05, kbtyo wrote: > >> > I am using Jupyter Notebook and Python 3.4. I have a data s

AttributeError: 'module' object has no attribute '__path__'

2015-08-31 Thread kbtyo
I am using Jupyter notebooks, with Python 3.4. The error below references the Anaconda distribution package. This error occurred quite precipitously (only 2 minutes before I was able to import the modules). I am using Windows 7. My path in the console uses Python27. I also have python 34 as wel

How to decipher error "Nonetype" Error

2015-09-02 Thread kbtyo
I am currently using Jupyter and Pythopn 3.4. I am currently using the following script to parse and convert XML data structures, nested in a CSV - formatted file, convert into a dictionary and then append write it back into the same CSV. I am using the following (I added comments to explain the

Re: How to decipher error "Nonetype" Error

2015-09-02 Thread kbtyo
On Wednesday, September 2, 2015 at 6:29:05 PM UTC-4, Chris Angelico wrote: > On Thu, Sep 3, 2015 at 8:15 AM, kbtyo wrote: > > However, when I hit line 40 (referencing the gist), I receive the following

continue vs. pass in this IO reading and writing

2015-09-03 Thread kbtyo
Good Morning: I am experimenting with many exception handling and utilizing continue vs pass. After pouring over a lot of material on SO and other forums I am still unclear as to the difference when setting variables and applying functions within multiple "for" loops. Specifically, I understa

Re: continue vs. pass in this IO reading and writing

2015-09-03 Thread kbtyo
On Thursday, September 3, 2015 at 11:27:58 AM UTC-4, Chris Angelico wrote: > On Fri, Sep 4, 2015 at 1:05 AM, kbtyo wrote: > > However, I am uncertain as to how this executes in a context like this: > > > > import glob > > import csv > > fr

Re: continue vs. pass in this IO reading and writing

2015-09-03 Thread kbtyo
On Thursday, September 3, 2015 at 11:27:58 AM UTC-4, Chris Angelico wrote: > On Fri, Sep 4, 2015 at 1:05 AM, kbtyo wrote: > > However, I am uncertain as to how this executes in a context like this: > > > > import glob > > import csv > > from collections import Orde

Re: continue vs. pass in this IO reading and writing

2015-09-03 Thread kbtyo
On Thursday, September 3, 2015 at 11:52:16 AM UTC-4, Chris Angelico wrote: > On Fri, Sep 4, 2015 at 1:38 AM, kbtyo wrote: > > Thank you for the elaboration. So, what I hear you saying is that (citing, > > "In this case, there's no further body, so it's going to be

Re: continue vs. pass in this IO reading and writing

2015-09-03 Thread kbtyo
On Thursday, September 3, 2015 at 12:12:04 PM UTC-4, Chris Angelico wrote: > On Fri, Sep 4, 2015 at 1:57 AM, kbtyo wrote: > > I have used CSV and collections. For some reason when I apply this > > algorithm, all of my files are not added (the output is ridiculously small >

Potential Solution for AssertionError: invalid dtype determination in get_concat_dtype when concatenating operation on list of Dataframes?

2015-09-09 Thread kbtyo
I have a list of Pandas Dataframes that I am attempting to combine using the concatenation function. dataframe_lists = [df1, df2, df3] result = pd.concat(dataframe_lists, keys = ['one', 'two','three'], ignore_index=True) The full traceback that I receive when I execute this function is: -

Pandas Left Merge with xlsx with CSV producing null value columns in output

2015-10-01 Thread kbtyo
I would appreciate any feedback on the following question that I have raised here: http://stackoverflow.com/questions/32889129/pandas-left-merge-with-xlsx-with-csv-producing-null-value-columns-in-output Thank you for your feedback and support. -- https://mail.python.org/mailman/listinfo/python

Re: Pandas Left Merge with xlsx with CSV producing null value columns in output

2015-10-02 Thread kbtyo
On Thursday, October 1, 2015 at 7:47:18 PM UTC-4, Mark Lawrence wrote: > On 01/10/2015 16:03, kbtyo wrote: > > I would appreciate any feedback on the following question that I have > > raised here: > > > > http://stackoverflow.com/questions/32889129/pandas-left-merge-w