On 01/12/2017 02:26 AM, Deborah Swanson wrote:
> It's true, I've only been on this list a few weeks, although I've seen
> and been on the receiving end of the kind of "help" that feels more like
> being sneered at than help. Not on this list, but on Linux and similar
> lists. There does seem to be
On Thu, Jan 12, 2017 at 9:27 PM, Marko Rauhamaa wrote:
> An instructive anecdote: somebody I know told me he once needed the
> definitive list of some websites. He posted a question on the relevant
> online forum, but it fell on deaf ears. After some days, he replied to
> his own posting saying he
"Deborah Swanson" :
> I've only been on this list a few weeks, although I've seen and been
> on the receiving end of the kind of "help" that feels more like being
> sneered at than help. Not on this list, but on Linux and similar
> lists. There does seem to be a "tough love" approach to "helping"
Antoon Pardon wrote, on January 12, 2017 12:49 AM
>
> Op 11-01-17 om 23:57 schreef Deborah Swanson:
> >
> >> What are we supposed to do when somebody asks a question based on
an
> >> obvious mistake? Assume that they're a quick learner who has
probably
> >> already worked out their mistake and d
Op 11-01-17 om 23:57 schreef Deborah Swanson:
>
>> What are we supposed to do when somebody asks a question based on an
>> obvious mistake? Assume that they're a quick learner who has probably
>> already worked out their mistake and doesn't need an answer? That
>> would certainly make our life ea
Steven D'Aprano wrote, on January 10, 2017 6:19 PM
>
> On Tuesday 10 January 2017 18:14, Deborah Swanson wrote:
>
> > I'm guessing that you (and those who see things like you do) might
> > not be used to working with quick learners who make mistakes at
> > first but catch up with them real fast
On 11/01/2017 02:18, Steven D'Aprano wrote:
On Tuesday 10 January 2017 18:14, Deborah Swanson wrote:
I'm guessing that you (and those who
see things like you do) might not be used to working with quick learners
who make mistakes at first but catch up with them real fast, or you're
very judgemen
On Tuesday 10 January 2017 18:14, Deborah Swanson wrote:
> I'm guessing that you (and those who
> see things like you do) might not be used to working with quick learners
> who make mistakes at first but catch up with them real fast, or you're
> very judgemental about people who make mistakes, per
On 01/09/2017 11:14 PM, Deborah Swanson wrote:
So I guess you should just do your thing and I'll do mine.
As you say.
Takes all kinds, and I think in the end what will count is the quality of my
finished work (which has always been excellent), and not the messy
process to get there.
Agreed
Ethan Furman wrote, on January 09, 2017 10:06 PM
>
> On 01/09/2017 08:51 PM, Deborah Swanson wrote:
> > Ethan Furman wrote, on January 09, 2017 8:01 PM
>
> >> As I said earlier, I admire your persistence -- but take some time
> >> and learn the basic vocabulary as that will make it much easier f
On 01/09/2017 08:51 PM, Deborah Swanson wrote:
Ethan Furman wrote, on January 09, 2017 8:01 PM
As I said earlier, I admire your persistence -- but take some
time and learn the basic vocabulary as that will make it much
easier for you to ask questions, and for us to give you
meaningful answers.
Erik wrote, on January 09, 2017 8:06 PM
>
> On 10/01/17 03:02, Deborah Swanson wrote:
> > Erik wrote, on January 09, 2017 5:47 PM
> >> IIRC, you create it using a list comprehension which creates the
> >> records. A list comprehension always creates a list.
> >
> > Well no. The list is created wi
Ethan Furman wrote, on January 09, 2017 8:01 PM
>
> On 01/09/2017 07:02 PM, Deborah Swanson wrote:
> > Erik wrote, on January 09, 2017 5:47 PM
>
> >> As people keep saying, the object you have called 'records' is a
> >> *list* of namedtuple objects. It is not a namedtuple.
> >>
> >> IIRC, you cr
MRAB wrote, on January 09, 2017 7:37 PM
>
> On 2017-01-10 03:02, Deborah Swanson wrote:
> > Erik wrote, on January 09, 2017 5:47 PM
> >> As people keep saying, the object you have called 'records' is a
> >> *list* of namedtuple objects. It is not a namedtuple.
> >>
> >> IIRC, you create it using
On 10/01/17 03:02, Deborah Swanson wrote:
Erik wrote, on January 09, 2017 5:47 PM
IIRC, you create it using a list comprehension which creates the
records. A list comprehension always creates a list.
Well no. The list is created with:
records.extend(Record._make(row) for row in rows)
No, th
On 01/09/2017 07:02 PM, Deborah Swanson wrote:
Erik wrote, on January 09, 2017 5:47 PM
As people keep saying, the object you have called 'records'
is a *list*
of namedtuple objects. It is not a namedtuple.
IIRC, you create it using a list comprehension which creates the
records. A list compre
On 2017-01-10 03:02, Deborah Swanson wrote:
Erik wrote, on January 09, 2017 5:47 PM
As people keep saying, the object you have called 'records'
is a *list*
of namedtuple objects. It is not a namedtuple.
IIRC, you create it using a list comprehension which creates the
records. A list comprehensi
Erik wrote, on January 09, 2017 5:47 PM
> As people keep saying, the object you have called 'records'
> is a *list*
> of namedtuple objects. It is not a namedtuple.
>
> IIRC, you create it using a list comprehension which creates the
> records. A list comprehension always creates a list.
Well
On 10/01/17 00:54, Deborah Swanson wrote:
Since I won't change the order of the records again after the sort, I'm
using
records.sort(key=operator.attrgetter("Description", "Date"))
once, which also works perfectly.
So both sorted() and sort() can be used to sort namedtuples. Good to
know!
A
Peter Otten wrote, on January 09, 2017 3:27 PM
>
> While stable sort is nice in this case you can just say
>
> key=operator.attrgetter("Description", "Date")
>
> Personally I'd only use sorted() once and then switch to the
> sort() method.
This works perfectly, thank you.
As I read the docs,
breamore...@gmail.com wrote:
> On Monday, January 9, 2017 at 5:34:12 PM UTC, Tim Chase wrote:
>> On 2017-01-09 08:31, breamoreboy wrote:
>> > On Monday, January 9, 2017 at 2:22:19 PM UTC, Tim Chase wrote:
>> > > I usually wrap the iterable in something like
>> > >
>> > > def pairwise(it):
>> >
On Monday, January 9, 2017 at 5:34:12 PM UTC, Tim Chase wrote:
> On 2017-01-09 08:31, breamoreboy wrote:
> > On Monday, January 9, 2017 at 2:22:19 PM UTC, Tim Chase wrote:
> > > I usually wrap the iterable in something like
> > >
> > > def pairwise(it):
> > > prev = next(it)
> > > for th
Rhodri James wrote:
> On 09/01/17 21:40, Deborah Swanson wrote:
>> Peter Otten wrote, on January 09, 2017 6:51 AM
>>>
>>> records = sorted(
>>> set(records),
>>> key=operator.attrgetter("Description")
>>> )
>>
>> Good, this is confirmation that 'sorted()' is the way to go. I want a 2
>> ke
On 09/01/17 21:40, Deborah Swanson wrote:
Peter Otten wrote, on January 09, 2017 6:51 AM
records = sorted(
set(records),
key=operator.attrgetter("Description")
)
Good, this is confirmation that 'sorted()' is the way to go. I want a 2
key sort, Description and Date, but I think I can f
breamore...@gmail.com wrote, on January 09, 2017 8:32 AM
>
> On Monday, January 9, 2017 at 2:22:19 PM UTC, Tim Chase wrote:
> > On 2017-01-08 22:58, Deborah Swanson wrote:
> > > 1) I have a section that loops through the sorted data, compares
two
> > > adjacent rows at a time, and marks one of th
Tim Chase wrote, on January 09, 2017 6:22 AM
>
> On 2017-01-08 22:58, Deborah Swanson wrote:
> > 1) I have a section that loops through the sorted data, compares two
> > adjacent rows at a time, and marks one of them for deletion if the
> > rows are identical.
> > and my question is whether ther
Peter Otten wrote, on January 09, 2017 6:51 AM
>
> Deborah Swanson wrote:
>
> > Even better, to get hold of all the records with the same
Description
> > as the current row, compare them all, mark all but the different
ones
> > for deletion, and then resume processing the records after the last
On Monday, January 9, 2017 at 2:22:19 PM UTC, Tim Chase wrote:
> On 2017-01-08 22:58, Deborah Swanson wrote:
> > 1) I have a section that loops through the sorted data, compares two
> > adjacent rows at a time, and marks one of them for deletion if the
> > rows are identical.
> >
> > I'm using
>
Deborah Swanson wrote:
> Even better, to get hold of all the records with the same Description as
> the current row, compare them all, mark all but the different ones for
> deletion, and then resume processing the records after the last one?
When you look at all fields for deduplication anyway th
On 2017-01-08 22:58, Deborah Swanson wrote:
> 1) I have a section that loops through the sorted data, compares two
> adjacent rows at a time, and marks one of them for deletion if the
> rows are identical.
>
> I'm using
>
> for i in range(len(records)-1):
> r1 = records[i]
> r2 = records
Steve D'Aprano wrote, on January 09, 2017 3:40 AM
>
> On Mon, 9 Jan 2017 09:57 pm, Deborah Swanson wrote:
>
> [...]
> > I think you are replying to my question about sorting a
> namedtuple, in
> > this case it's called 'records'.
> >
> > I think your suggestion works for lists and tuples, and
On Mon, 9 Jan 2017 09:57 pm, Deborah Swanson wrote:
[...]
> I think you are replying to my question about sorting a namedtuple, in
> this case it's called 'records'.
>
> I think your suggestion works for lists and tuples, and probably
> dictionaries. But namedtuples doesn't have a sort function.
Antoon Pardon wrote, on January 09, 2017 2:35 AM
> If I understand correctly you want something like:
>
> records.sort(key = lamda rec: rec.xx)
>
> AKA
>
> from operator import attrgetter
> records.sort(key = attrgetter('xx'))
>
> or maybe:
>
> records.sort(key = lambda rec:
Antoon Pardon wrote, on January 09, 2017 2:14 AM
> > 1) I have a section that loops through the sorted data, compares two
> > adjacent rows at a time, and marks one of them for deletion if the
> > rows are identical.
> >
> > I'm using
> >
> > for i in range(len(records)-1):
> > r1 = records[
Op 09-01-17 om 07:58 schreef Deborah Swanson:
> Peter Otten wrote, on January 08, 2017 5:21 AM
>> Deborah Swanson wrote:
>>
>>> Peter Otten wrote, on January 08, 2017 3:01 AM
>>
>> Personally I would recommend against mixing data (an actual location)
> and
>> metadata (the column name,"Location"
Op 09-01-17 om 07:58 schreef Deborah Swanson:
> Peter Otten wrote, on January 08, 2017 5:21 AM
>> Deborah Swanson wrote:
>>
>>> Peter Otten wrote, on January 08, 2017 3:01 AM
>>
>> Personally I would recommend against mixing data (an actual location)
> and
>> metadata (the column name,"Location"
Steven D'Aprano wrote, on January 08, 2017 7:30 PM
>
> On Sunday 08 January 2017 20:53, Deborah Swanson wrote:
>
> > Steven D'Aprano wrote, on January 07, 2017 10:43 PM
>
> No, I'm pretty sure that's not the case. I don't have access
> to your CSV file,
> but I can simulate it:
>
> ls = [['Lo
Peter Otten wrote, on January 08, 2017 5:21 AM
>
> Deborah Swanson wrote:
>
> > Peter Otten wrote, on January 08, 2017 3:01 AM
>
> Personally I would recommend against mixing data (an actual location)
and
> metadata (the column name,"Location"), but if you wish my code can be
> adapted as fol
Steven D'Aprano wrote, on January 07, 2017 10:43 PM
>
> On Sunday 08 January 2017 16:39, Deborah Swanson wrote:
>
> The recommended way is with the _replace method:
>
> py> instance._replace(A=999)
> Record(A=999, B=20, C=30)
> py> instance._replace(A=999, C=888)
> Record(A=999, B=20, C=888)
>
On Sunday 08 January 2017 20:53, Deborah Swanson wrote:
> Steven D'Aprano wrote, on January 07, 2017 10:43 PM
>>
>> On Sunday 08 January 2017 16:39, Deborah Swanson wrote:
>>
>> > What I've done so far:
>> >
>> > with open('E:\\Coding projects\\Pycharm\\Moving\\Moving
>> 2017 in.csv',
>> > 'r')
Paul Rudin wrote, on January 08, 2017 6:49 AM
>
> "Deborah Swanson" writes:
>
> > Peter Otten wrote, on January 08, 2017 3:01 AM
> >>
> >> columnA = [record.A for record in records]
> >
> > This is very neat. Something like a list comprehension for named
> > tuples?
>
> Not something like - t
"Deborah Swanson" writes:
> Peter Otten wrote, on January 08, 2017 3:01 AM
>>
>> columnA = [record.A for record in records]
>
> This is very neat. Something like a list comprehension for named tuples?
Not something like - this *is* a list comprehension - it creates a list
of named tuples.
The
Peter Otten wrote, on January 08, 2017 5:21 AM
>
> Deborah Swanson wrote:
>
> > Peter Otten wrote, on January 08, 2017 3:01 AM
> >>
> >> Deborah Swanson wrote:
> >>
> >> > to do that is with .fget(). Believe me, I tried every > possible
> >> > way
> > to
> >> > use instance.A or instance[1] an
Deborah Swanson wrote:
> Peter Otten wrote, on January 08, 2017 3:01 AM
>>
>> Deborah Swanson wrote:
>>
>> > to do that is with .fget(). Believe me, I tried every > possible way
> to
>> > use instance.A or instance[1] and no way could I get ls[instance.A].
>>
>> Sorry, no.
>
> I quite agree, I
Peter Otten wrote, on January 08, 2017 3:01 AM
>
> Deborah Swanson wrote:
>
> > to do that is with .fget(). Believe me, I tried every > possible way
to
> > use instance.A or instance[1] and no way could I get ls[instance.A].
>
> Sorry, no.
I quite agree, I was describing the dead end I was in
Deborah Swanson wrote:
> to do that is with .fget(). Believe me, I tried every possible way to
> use instance.A or instance[1] and no way could I get ls[instance.A].
Sorry, no.
To get a list of namedtuple instances use:
rows = csv.reader(infile)
Record = namedtuple("Record", next(rows))
records
Steven D'Aprano wrote, on January 07, 2017 10:43 PM
>
> On Sunday 08 January 2017 16:39, Deborah Swanson wrote:
>
> > What I've done so far:
> >
> > with open('E:\\Coding projects\\Pycharm\\Moving\\Moving
> 2017 in.csv',
> > 'r') as infile:
> > ls = list(csv.reader(infile))
> > lst = na
On Sunday 08 January 2017 16:39, Deborah Swanson wrote:
> What I've done so far:
>
> with open('E:\\Coding projects\\Pycharm\\Moving\\Moving 2017 in.csv',
> 'r') as infile:
> ls = list(csv.reader(infile))
> lst = namedtuple('lst', ls[0])
>
> where 'ls[0]' is the header row of the csv, an
48 matches
Mail list logo