Re: [Matplotlib-users] plot duration given format of '3:04:02.994000'

2011-07-18 Thread Daniel Mader
Hi,

why don't you just parse the returned string?

asdf = '3:04:02.994000'
asdf = asdf.split(':')
temp = asdf[-1].split('.')
print asdf
asdf.pop(-1)
print asdf
asdf.extend(temp)
print asdf
asdf = [int(i) for i in asdf]
print asdf
hrs,mins,secs,usecs = asdf

That should work, and you can always transform this into some common
unit, e.g. seconds etc.

Hope it helps,
Daniel

2011/7/17 C M cmpyt...@gmail.com:
 This a time duration in my database:  '3:04:02.994000' (i.e., 3 hrs, 4
 min, 2 sec and 994 microsec).  It's a string.

 Is there a way to allow Matplotlib to interpret that directly as a
 duration of time?

 Thank you.

--
AppSumo Presents a FREE Video for the SourceForge Community by Eric 
Ries, the creator of the Lean Startup Methodology on Lean Startup 
Secrets Revealed. This video shows you how to validate your ideas, 
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] plot duration given format of '3:04:02.994000'

2011-07-18 Thread C M
On Mon, Jul 18, 2011 at 10:58 AM, Daniel Mader
danielstefanma...@googlemail.com wrote:
 Hi,

 why don't you just parse the returned string?

 asdf = '3:04:02.994000'
 asdf = asdf.split(':')
 temp = asdf[-1].split('.')
 print asdf
 asdf.pop(-1)
 print asdf
 asdf.extend(temp)
 print asdf
 asdf = [int(i) for i in asdf]
 print asdf
 hrs,mins,secs,usecs = asdf

 That should work, and you can always transform this into some common
 unit, e.g. seconds etc.

Thanks.  The issue, though is that I don't want to display a graph
with seconds, but with whatever units is most suitable, since my data
is going to range from seconds to hours.  If most datapoints are
hours, I don't want things expressed in terms of 5000 seconds.

I thought there might be a way to use a DateLocator or DateFormatter
with this kind of data so that it could pick the most suitable units
based on a standardized time duration string.

So do people think I have to create my own custom locator or formatter
to do this?

Thanks,
Che

--
Storage Efficiency Calculator
This modeling tool is based on patent-pending intellectual property that
has been used successfully in hundreds of IBM storage optimization engage-
ments, worldwide.  Store less, Store more with what you own, Move data to 
the right place. Try It Now! http://www.accelacomm.com/jaw/sfnl/114/51427378/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] plot duration given format of '3:04:02.994000'

2011-07-16 Thread C M
This a time duration in my database:  '3:04:02.994000' (i.e., 3 hrs, 4
min, 2 sec and 994 microsec).  It's a string.

Is there a way to allow Matplotlib to interpret that directly as a
duration of time?

Thank you.

--
AppSumo Presents a FREE Video for the SourceForge Community by Eric 
Ries, the creator of the Lean Startup Methodology on Lean Startup 
Secrets Revealed. This video shows you how to validate your ideas, 
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users