Hi,
I have a CSV file as follows:
IDProducts
1 a b c d
1 a e
2 a b c
2 a
3 b c
3 a
4 d
5 a d
I am trying to write a script that will take the CSV file and output another
text file as follows:
ID Products
1a
1b
1c
1d
1a
1e
etc.. for
f lookup table
functionality.
M.
On 9/27/07, Kent Johnson <[EMAIL PROTECTED]> wrote:
>
> GTXY20 wrote:
> > Hi,
> >
> > I have a CSV file as follows:
> >
> > IDProducts
> > 1 a b c d
> > 1 a e
> > 2 a b c
> > 2 a
&g
Hello,
Any way to display the count of the values in a dictionary where the values
are stored as a list? here is my dictionary:
{'1': ['a', 'b', 'c'], '3': ['a', 'b', 'c'], '2': ['a', 'b', 'c'], '4':
['a', 'c']}
I would like to display count as follows and I would not know all the value
types i
file instead of calling within a python shell do you think that
this would speed up the process?
All in total I will probably be looking at about 2 million dictionary keys
with assorted value quantities.
M.
On 10/1/07, Kent Johnson <[EMAIL PROTECTED]> wrote:
>
> GTXY20 wrot
orted(count.items()):
fdist=k
qty=v
print fdist,qty
Not sure...
M.
On 10/1/07, Kent Johnson <[EMAIL PROTECTED]> wrote:
>
> GTXY20 wrote:
> >
> > This works perfectly.
> >
> > However I will be dealing with an import of a very large dic
print fdist,qty
M.
On 10/1/07, GTXY20 <[EMAIL PROTECTED]> wrote:
>
>
> Thanks again I have worked that issue out.
>
> However I have the following function and it is throwing this error:
>
> FEXpython_v2.py", line 32, in UnitHolderDistributionqty
&g
Hello all,
Let's say I have the following dictionary:
{1:(a,b,c), 2:(a,c), 3:(b,c), 4:(a,d)}
I also have another dictionary for new value association:
{a:1, b:2, c:3}
How should I approach if I want to modify the first dictionary to read:
{1:(1,2,3), 2:(1,3), 3:(2,3), 4:(1,d)}
There is the p
TED]> wrote:
>
> On 02/10/2007, GTXY20 <[EMAIL PROTECTED]> wrote:
> > Hello all,
> >
> > Let's say I have the following dictionary:
> >
> > {1:(a,b,c), 2:(a,c), 3:(b,c), 4:(a,d)}
> >
> > I also have another dictionary for new value associ
Sorry - solved my own problem - it was the way I was creating my dictionary
and assigning the value as a list.
I will post my final working code shortly.
M.
On 10/2/07, GTXY20 <[EMAIL PROTECTED]> wrote:
>
> I seem to be encountering a problem and I think it is because I actually
&g
= value
try:
return transDict[c]
except KeyError:
return c
for key in data.keys():
data[key] = map(transFn, data[key])
On 10/2/07, GTXY20 <[EMAIL PROTECTED]> wrote:
>
>
> Sorry - solved my own problem - it was the way I was creating my
> dictionary and a
g?
On 10/2/07, Kent Johnson <[EMAIL PROTECTED]> wrote:
>
> GTXY20 wrote:
> >
> > This seemed to work:
> >
> > def transFn(c):
> > transfile = open('translate.txt', 'r')
> > records = transfile.read()
> > tran
Here's an interesting question:
Can I use the transFn function to remove items in the value list.
Can this be done by simple assigning the current value a value of null
in the translate file?
M.
On 10/2/07, GTXY20 <[EMAIL PROTECTED]> wrote:
> I adjusted so that I get the follow
;, 'c'], '3': ['1', '2', 'c'], '2': ['1', '2', 'c'],
'4': ['1', 'c']}
I was expecting:
{'1': ['1', '2'], '3': ['1', '2'], &
hanks.
GTXY20
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
much to post? I do not have a website
to post code to - just don't want to post too much for the group and annoy
anyone.
Thanks for your comments and let me know.
GTXY20
On Jan 3, 2008 6:08 PM, wesley chun <[EMAIL PROTECTED]> wrote:
> > Is there a forum or group where I can
normalized to a
single unique value.
Sorry for the lengthly code response - all commenst are appreciated - as
mentioned I am quite new with Python - it is doing what I need it to do but
I think that it is a mess and needs to be cleaned up a little.
Thanks for any comments.
GTXY20
import sys
import
thanks for the feedback - i will go through your comments line by line
adjust and test and will re-post when complete.
GTXY20
On Jan 4, 2008 9:29 PM, Kent Johnson <[EMAIL PROTECTED]> wrote:
> Tiger12506 wrote:
>
> > Ouch. Usually in OOP, one never puts any user intera
arguments and python will run on the
server and return the results within another PHP page.
Once again thanks.
GTXY20.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Hello all,
Sadly I need to convert a great python application into C# .Net. I have been
pretty successful so far but I was wondering if anyone knew of something
similar to a python defaultdict(int) in C#. In python I am doing:
g = {} (where the value in the key value pair is a tuple of values)
f
s of values within the value list like so:
{'1': {'220' : 3}, '2': {'220' : 1}, 2: {238 : 4}, '3': {'220' : 1}, 3: {
'238' : 1}, '4': {220 : 2}, '5': {'220: 2},
in b:
h[j]+=1
print ('%s, %s' % (f, h))
However, not exactly happy with the printed output as soon as I complete I
will repost what I come up with.
Thanks so much.
M.
On Tue, Apr 15, 2008 at 10:17 PM, Kent Johnson <[EMAIL PROTECTED]> wrote:
> GTXY20 wrote:
>
>
#x27;238', '238'], '7': ['220']}
for f, b in d.items():
h = defaultdict(int)
for j in b:
h[j]+=1
for k,v in sorted (h.items()):
print ('%s, (%s:%s)' % (f, k, v))
M.
On Tue, Apr 15, 2008 at 10:19 PM, John Fouhy <[EMAIL PR
Hello all,
I have dictionary like the following:
d={(1,23A):[a,b,c,d], (1,24A):[b,c,d], (2,23A):[a,b], (2,24A):[a,b,c,d]}
I would like to iterate through the dictionary such that if it finds
the value 'a' in the values of the key that it would remove the value
'b' from the values list. In addit
aving said that, Kent I am not 100 percent sure of what you menat when you
mention a two-level dict. Can you give me a very brief example?
Thank you so much for your feedback.
G.
On Thu, May 15, 2008 at 7:57 AM, Kent Johnson <[EMAIL PROTECTED]> wrote:
> On Thu, May 15, 2008 at 2:40 AM,
Hello all,
I will be dealing with an address list where I might have the following:
Name SSN
John 1
John 1
Jane 2
Jill 3
What I need to do is parse the address list and then create a unique random
unidentifiable value for the SSN field like so:
Name SSNrandomvalu
ROTECTED]> wrote:
> On Thu, May 22, 2008 at 12:14 PM, GTXY20 <[EMAIL PROTECTED]> wrote:
> > Hello all,
> >
> > I will be dealing with an address list where I might have the following:
> >
> > Name SSN
> > John 1
> > John 1
>
Hello all,
Thanks in advance for any thoughts, direction, and guidance.
Let's say I have a list like the following:
a = ['a1','a2','a3','a4','a5','a6']
and then I have dictionary like the following:
b = {'a1,a2,a3':'super'}
I need some direction and thoughts on how I might seach the list for
27 matches
Mail list logo