One way to go is using Pandas as it was mentioned before and Seaborn for
plotting (built on top of matplotlib)
I would approach this prototyping first with a single file and not with
the 1000 files that you have.
Using the code that you have for parsing, add the values to a Pandas
DataFrame
I agree with dn. While you could scrape the text files each time you want
to display a user from a design perspective it makes more sense to use a
database to store the data. This doesn't mean that you need to get rid of
the text files or change the format that they are written to but instead
that
On 27/05/2021 21.28, Loris Bennett wrote:
> Hi,
>
> I currently a have around 3 years' worth of files like
>
> home.20210527
> home.20210526
> home.20210525
> ...
>
> so around 1000 files, each of which contains information about data
> usage in lines like
>
> namekb
> alice 1
On 2021-05-27 11:28:11 +0200, Loris Bennett wrote:
> I currently a have around 3 years' worth of files like
>
> home.20210527
> home.20210526
> home.20210525
> ...
>
> so around 1000 files, each of which contains information about data
> usage in lines like
>
> namekb
> alice 1
Il giorno giovedì 27 maggio 2021 alle 11:28:31 UTC+2 Loris Bennett ha scritto:
> Hi,
>
> I currently a have around 3 years' worth of files like
>
> home.20210527
> home.20210526
> home.20210525
> ...
>
> so around 1000 files, each of which contains information about data
> usage in lines
On Sun, 28 Jan 2018 14:48:02 -0800, qrious wrote:
> First list = { 1, 2, 3}
> Second list = { 4, 5, 6}
> Third list = { 7, 8, 9}
>
> If I pass 9 as the argument, the return value of the function would be
> {7, 8}.
subsets = [{1, 2, 3}, {4, 5, 6}, {7, 8, 9}]
data = {}
for subset in subsets:
On Sunday, January 28, 2018 at 7:00:38 AM UTC-8, Steven D'Aprano wrote:
>
> Since you specified that there are no lists with shared members, why
> bother returning a list of lists? There will only ever be a single
> matching list.
>
That's correct. It will be a single list. My mistake in typi
On Sat, 27 Jan 2018 10:01:47 -0800, qrious wrote:
> I need a data structure and a corresponding (hopefully fast) mechanism
> associated with it to do the following. While I am looking for the
> concept first, my preference for implementation of this will be in
> Python.
>
> [c1, c2,..., cn] is a
On 2018-01-27 18:01, qrious wrote:
I need a data structure and a corresponding (hopefully fast) mechanism
associated with it to do the following. While I am looking for the concept
first, my preference for implementation of this will be in Python.
[c1, c2,..., cn] is a list of strings (for m
It's possible, but not common, to do association lists in Python.
They're pretty inefficient in just about any language.
I'm not totally clear on what you need, but it might be a good thing
to do a list of sets - if you're looking for an in-memory solution.
On Sat, Jan 27, 2018 at 10:33 AM, Denni
Paul
Thank you. In my case all "members" of a data structure are classes
(except of the id). I showed the classes to highlight the requirement to
access their methods as vs simple data types.
I think dict of lists should work.
Ideally , I hoped to access by name ( vs index), but list will do for n
Hi Andrew.
You start by talking about a data structure, then show code that uses
"class". Not everything in Python needs to be in a class.
I'd look at using a simple Dictionary of lists, indexed on your ID. A list
can contain anything, so you can add your objects in there dynamically as
needed.
"Andrew Zyman" wrote in message
news:caprckxktozonlak8asizonkypd9y_p25fr2rkfkozxoa4bc...@mail.gmail.com...
Hello,
i wonder what would be a proper data structure for something with the
following characteristics:
id - number,
obj[a..c] - objects of various classes
the idea is to be able to upd
> How about two dictionaries, each containing the same tuples for
> values? If you create a tuple first, then add it to both dicts, you
> won't have any space-wasting duplicates.
Thanks guys.
--
https://mail.python.org/mailman/listinfo/python-list
On Mon, 18 Nov 2013 02:03:38 +, "Joseph L. Casale"
wrote:
I have a need for a script to hold several tuples with three
values, two text
strings and a lambda. I need to index the tuple based on either of
the two
strings. Normally a database would be ideal but for a
self-contained script
> Not entirely sure I understand you, can you post an example?
>
> If what you mean is that you need to locate the function (lambda) when
> you know its corresponding strings, a dict will suit you just fine.
> Either maintain two dicts for the two separate strings (eg if they're
> "name" and "loca
On Sunday, November 17, 2013 9:03:38 PM UTC-5, Joseph L. Casale wrote:
> I have a need for a script to hold several tuples with three values, two text
> strings and a lambda. I need to index the tuple based on either of the two
> strings. Normally a database would be ideal but for a self-contained
On Mon, Nov 18, 2013 at 1:03 PM, Joseph L. Casale
wrote:
> I have a need for a script to hold several tuples with three values, two text
> strings and a lambda. I need to index the tuple based on either of the two
> strings. Normally a database would be ideal but for a self-contained script
> that
On 2013-11-18 02:03, Joseph L. Casale wrote:
> I have a need for a script to hold several tuples with three
> values, two text strings and a lambda. I need to index the tuple
> based on either of the two strings. Normally a database would be
> ideal but for a self-contained script that's a bit much
2010/9/19 Dennis Lee Bieber :
> On Sat, 18 Sep 2010 23:00:25 +0200, Vlastimil Brom
> declaimed the following in
> gmane.comp.python.general:
>
>> Thank you very much for detailed hints, I see, I should have mention
>> the specification with my initial post...
>> It is true, that nested tags of the
2010/9/18 Dennis Lee Bieber :
> On Sat, 18 Sep 2010 10:48:44 +0200, Vlastimil Brom
> declaimed the following in
> gmane.comp.python.general:
>
>>
>> http://mail.python.org/pipermail/python-list/2008-May/540773.html
>>
> Ah, based on that listing you are not worried about embedded tags;
> yo
2010/9/18 Dennis Lee Bieber :
> On Fri, 17 Sep 2010 10:44:43 +0200, Vlastimil Brom
> declaimed the following in
> gmane.comp.python.general:
>
>
>> Ok, thanks for confirming my suspicion :-),
>> Now I have to decide whether I shall use my custom data structure,
>> where I am on my own, or whether
2010/9/17 MRAB :
> On 17/09/2010 00:56, Vlastimil Brom wrote:
>>
>> 2010/9/17 MRAB:
>>>
>>> On 16/09/2010 23:11, Vlastimil Brom wrote:
...
I put together some code, which works as expected, but I suspect
somehow, that there must be better ways of doing it.
Two things I
On 17/09/2010 00:56, Vlastimil Brom wrote:
2010/9/17 MRAB:
On 16/09/2010 23:11, Vlastimil Brom wrote:
...
I put together some code, which works as expected, but I suspect
somehow, that there must be better ways of doing it.
Two things I am not quite clear about are using the placeholders for
2010/9/17 MRAB :
> On 16/09/2010 23:11, Vlastimil Brom wrote:
>>
>>...
>> I put together some code, which works as expected, but I suspect
>> somehow, that there must be better ways of doing it.
>>
>> Two things I am not quite clear about are using the placeholders for
>> the data identifiers and "
On 16/09/2010 23:11, Vlastimil Brom wrote:
Hi all,
I'd like to ask for suggestions regarding suitable datastracture for
storing textual metadata along with a plain text string.
The input format I have is simply text with custom tags like; I'd prefer to have this human readable format the original
Jochen Schulz:
> Could you please send me an email with an existing From: address? I
> tried to reply to you but apparently your From: is forged.
Sorry for the delay, I'll send you an email.
In the meantime I have created a fast BK-tree implementation for
Psyco, on my PC it's about 26+ times faste
* [EMAIL PROTECTED]:
>
> Please plug such good things. It seems the Python community is an
> endless source of interesting modules I didn't know about. Your
> (single) module looks very nice. I'll take a better look later.
Could you please send me an email with an existing From: address? I
tried
"Steven Clark" <[EMAIL PROTECTED]> wrote:
>
>Thanks for the reply. Can you explain how I could be bitten by
>floating point precision here?
>I'm familiar with how&why 1.3*3 != 3.9, etc., but I'm not sure how it
>applies here, or what you are gaining by converting to int.
Well, it depends on how yo
> > I believe the best way to implement this would be a binary search
> > (bisect?) on the actual times, which would be O(log N). Though since
> > they are timestamps they should be monotonically increasing, in which
> > case at least you don't have to go to the expense of sorting them.
> >
> > "So
More bits from your code:
neighbours = list()
==>
neighbours = []
If you have a recent enough version of Python you can use:
candidate_is_neighbour = any(distance < n[1] for n in neighbours)
Instead of:
candidate_is_neighbour = bool([1 for n in neighbours if distance <
n[1]])
It's shorter & simp
Few more notes on the code:
You may use the @property in such situations (or you may just use
attributes, dropping the property). Note that Python doesn't inline
functions calls like Java HotSpot does quite often.
def __children(self):
raise NotImplementedError()
children = propert
Jochen Schulz:
> This solution may be more than you actually need, but I implemented two
> metric space indexes which would do what you want (and I wanted to plug
> it anyway :)):
Please plug such good things. It seems the Python community is an
endless source of interesting modules I didn't know
> bisect is definitely the way to go. You should take care with
> floating point precision, though. One way to do this is to choose a
> number of digits of precision that you want, and then internally to
> your class, multiply the keys by 10**precision and truncate, so that
> you are working
* Steven Clark:
> Hi all-
>
> I'm looking for a data structure that is a bit like a dictionary or a
> hash map. In particular, I want a mapping of floats to objects.
> However, I want to map a RANGE of floats to an object.
This solution may be more than you actually need, but I implemented two
me
On Apr 7, 3:58 pm, Steve Holden <[EMAIL PROTECTED]> wrote:
>
> I believe the best way to implement this would be a binary search
> (bisect?) on the actual times, which would be O(log N).
bisect is definitely the way to go. You should take care with
floating point precision, though. One way to do
If you can imply a partial order on your ranges then you can get O(n lg n)
random access using a heap data structure.
You'll have to implement your own heap, but heap search is easy to implement
(it's Heapify that might require a little thinking).
This will only work, of course, if your ranges ar
Steven Clark wrote:
> Hi all-
>
> I'm looking for a data structure that is a bit like a dictionary or a
> hash map. In particular, I want a mapping of floats to objects.
> However, I want to map a RANGE of floats to an object.
>
> This will be used for timestamped storage / lookup, where the floa
> I know that foo.get() will be called many times for each foo.put(). Is
> there any way to achieve O(1) performance for foo.get(), maybe via
> some kind of hash function? Or is the best thing to use some kind of
> binary search?
If you know something about the density of the input values, O(1) is
On Jan 29, 10:15 pm, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote:
> The instructor learned his lesson: no more assignments
> done in "any language I can understand"
Without naming names, there was a person at my university who gained a
certain amount of notoriety by implementing a file system fo
On Jan 29, 1:50 pm, "azrael" <[EMAIL PROTECTED]> wrote:
> thanks guys. i see that there is no way then to go back to C to
> satisfy my prof and get a grade
Seconding what Dennis says below, it is totally possible to use Python
for this.
I didn't mean to discourage you from using Python--I just w
thanks guys. i see that there is no way then to go back to C to
satisfy my prof and get a grade
--
http://mail.python.org/mailman/listinfo/python-list
On Jan 28, 2:56 pm, "azrael" <[EMAIL PROTECTED]> wrote:
> class Node:
> def __init__(self, cargo=None, next=None):
> self.cargo = cargo
> self.next = next
This is OK for the node itself, but maybe you should try writing a
LinkedList class that you use:
class LinkedList(object):
de
Terry Reedy wrote:
> "azrael" <[EMAIL PROTECTED]> wrote in message
[...]
> |
> | but this was not dinamicly enough for me (or my prof.) so
>
> dynamic? I have no idea what you mean by 'not dynamic enough'.
>
> Python is not C or C++. It does not have pointers. Trying to program in C
> in Pyt
azrael schrieb:
> i'd like to get more control like in c with pointers. I want to loose
> the data after disabling:
>
list=[]
list.append(Node(1))
list.append(Node(2))
list[0].next=list[1]
>
>
> 1, 2
>
>
list.append(Node(3))
list[1].next=list[2]
>
>
> 1,2
"azrael" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
| Hy, i am a student and in 2 days I am writing a test in data
| structures and algorithms. I've done my homework and understood all
| the implementations and structures. My profesor was so kind to allow
| us to use any programi
i'd like to get more control like in c with pointers. I want to loose
the data after disabling:
>>> list=[]
>>> list.append(Node(1))
>>> list.append(Node(2))
>>> list[0].next=list[1]
1, 2
>>> list.append(Node(3))
>>> list[1].next=list[2]
1,2,3
>>> list[0].next=list[2]
1,3
What are you trying to make in the first place? A singly linked list? If so
google is littered with examples of linked lists done in python. A simple
search for 'python linked list' brings up many results.
Btw, for future reference, no need for apologetics (the second post).
- Jonathan
--
http
I'm not a kid who heard that Python is simple, so he wants to use it
and throw it away. I discovered it about 2 months ago, and I learnt it
better then c in 2 years.
I want to use python for this test because i love it. I am amazed
about what i can do i such little time. My god, I even printed
robert wrote:
>>> how many rectangles do you plan to store in this structure?
>
>> Around 150 max
>
> And seeking/change frequency? fix dimensions? Probably for a GUI/mouse thing.
> =>Not worth worring about a 2D-tree structure. A Python list ? :-)
> Insert/change coordinates at no costs and s
[EMAIL PROTECTED] wrote:
> Fredrik Lundh wrote:
>> [EMAIL PROTECTED] wrote:
>>
>>> I am looking for a data structure to hold rectangles in a 2d space.
>>> Please point me to any module which does these operations:
>>> Insert a rectangle into a particular co-ordinate.
>>> Get the rectangle/s righ
Hendrik van Rooyen wrote:
> "Fredrik Lundh" <[EMAIL PROTECTED]> wrote:
>
>
>> [EMAIL PROTECTED] wrote:
>>
>> > unless this is homework because the pil people will not let
>>> you distribute pils.
>> I'm not sure I can parse this sentence fragment. What do you mean?
>
> oh come on! - you of all
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
>
> > unless this is homework because the pil people will not let
> > you distribute pils.
>
> I'm not sure I can parse this sentence fragment. What do you mean?
oh come on! - you of all people should know that "pils" mean
Fredrik Lundh wrote:
> [EMAIL PROTECTED] wrote:
>
> > I am looking for a data structure to hold rectangles in a 2d space.
> > Please point me to any module which does these operations:
> > Insert a rectangle into a particular co-ordinate.
> > Get the rectangle/s right/left/above/below side to a
[EMAIL PROTECTED] wrote:
> I am looking for a data structure to hold rectangles in a 2d space.
> Please point me to any module which does these operations:
> Insert a rectangle into a particular co-ordinate.
> Get the rectangle/s right/left/above/below side to a particular
> rectangle.
> Get a
[EMAIL PROTECTED] wrote:
> unless this is homework because the pil people will not let
> you distribute pils.
I'm not sure I can parse this sentence fragment. What do you mean?
--
http://mail.python.org/mailman/listinfo/python-list
There are probily better ways to do this. The pil library has a
rectangle drawing feature, I would check through the docs of wxwindows
and tkinter unless this is homework because the pil people will not let
you distribute pils. I am going to be looking for the same think let
me know if you get a
noro wrote:
> Hello again.
>
> I have a task i need to do and i can't seem to find an elegent
> solution.
> i need to make a tree like data structure (not necessry a binary tree).
>
>
> i would like each node to access his sons in a dicionary kind of why,
> for example: if ROOT node has the name '
Matt Keyes wrote:
> Is there a data structure in Python that is akin to the STL stack
> object in C++?
>>> import collections
>>> help(collections.deque)
...
class deque(__builtin__.object)
| deque(iterable) --> deque object
|
| Build an ordered collection accessible from endpoints only.
I didn't know the list has a pop function - that is what I was looking for.
Thanks for the help![EMAIL PROTECTED] wrote:
What property of the STL stack is important to you?You can use a Python list as a stack. It has methods append() andpop() which run in amortized-constant-time. It can be tested
What property of the STL stack is important to you?
You can use a Python list as a stack. It has methods append() and
pop() which run in amortized-constant-time. It can be tested for
empty/nonempty in constant time too (if st: # stack is not empty).
Jeff
pgpU1CCrfIPhk.pgp
Description: PGP sig
61 matches
Mail list logo