By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,362 Members | 1,285 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,362 IT Pros & Developers. It's quick & easy.

Mapping a series of Dates to an array of Numbers

P: n/a
Hello. Got a problem here.

Ive got a set of points tht id be plotting. Those points would contain
the date on which the work was done against its frequency. Supposedly
if i did something on the 28th of March one of the points would be
(28, respective freq). The next time i did my work on the 1st of
April. So my next point would (1,freq).

Now how could i map all the dates to another array so that when im
plotting them i can plot the points as (day 1, freq), (day2,freq),
(day4 , freq) and so on rather than having points like (28, freq),
(29,freq), (1,freq) and blah blah blah.

Id be needing some help on how to use the time class in python as
well. Thnx
Jun 27 '08 #1
Share this Question
Share on Google+
2 Replies

P: n/a
Btw dnt forget the solution should also cater to this problem:
Supposedly there is a day on which i did not do anything. Than that
particular spot in my graph should be left empty. Meaning that if i
did something on the 1st March and after it i did something on the 7th
March. Then essentially 1st march should be mapped to day1 and 7th
march to day 7(not day2)... :P
Jun 27 '08 #2

P: n/a
On Jun 17, 2:15*pm, J-Burns <arslanbur...@gmail.comwrote:
Hello. Got a problem here.

Ive got a set of points tht id be plotting. Those points would contain
the date on which the work was done against its frequency. Supposedly
if i did something on the 28th of March one of the points would be
(28, respective freq). The next time i did my work on the 1st of
April. So my next point would (1,freq).

Now how could i map all the dates to another array so that when im
plotting them i can plot the points as (day 1, freq), (day2,freq),
(day4 , freq) *and so on rather than having points like (28, freq),
(29,freq), (1,freq) and blah blah blah.

Id be needing some help on how to use the time class in python as
well. Thnx
For every day you could build a timestamp and frequency pair, hell,
you don't even need to use the time module if you're capturing data
manually. If you build your dataset as "(timestamp, frequency)" and
if frequency is nothing then use "None" when you extract data to plot
you could use a simple list comprehension to retrieve days that
actually had items "[(timestamp,frequency) for timestamp,frequency in
data_structure where frequency != None]". Now you have your own list
that is composed just of data pairs where there is a frequency.
Jun 27 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.