Monthly Masters #17
Labels
No labels
bug
dependencies
documentation
duplicate
enhancement
good first issue
help wanted
invalid
more info required
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
yulqen/datamaps#17
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hi @yulqen is it possible for datamaps Master classes to record the month for data. e.g. Jan 2021. This would be useful in addition to quarters. Thanks.
Sure - could do that. What is the requirement for the month attribute - the first month of the quarter? Do you need it as a
dateobject or text and if so - what format? We can discuss.On Mon, 19 Apr 2021, at 10:59 AM, Will Grant wrote:
This would be something separate to quarters. So you have the ability to specify a month (from a possible 12) and a year.
I'm asking because we are going to start using DMs for a quarterly reporting process.
Cheers.
Sorry to labour the point, but would you be able to provide an example - in code - of what you would like to see?
At present, you create a
Masterusing something like:m = project_data_from_master("master.xlsx", 1, 2021)This results in an object:
Master()object whose attributes you can query with, for example:Additionally, the
quarterobject here can then be queried for its financial year properties, e.g.:fy = quarter.fywhose properties are:
fy.q1(results in "2021-04-01", for example)You mention you want to be able to specify a month, so is it as simple as creating the month with the following?
And therefore, what do you need out of the resulting object?
The obvious attributes are
m.start_date,m.end_date,m.long_name("January"),m.short_name("Jan") - etc.Let me know if I'm on the right track.
Yes it is a simple as creating a month e.g.
project_data_from_master("master.xlsx", 7, 2021)(for July, for example)` as above.The
Master()object would then have the following attributes.From a user case perspective you'd need to specify a month or quarter. No need for both. The reason for this is, is it allows for quarterly or monthly reporting cycles. (The user will not be doing both at the same time.)
I'm finishing up the work on this - to be released in a new version of
datamaps this week.
There is a new function you will need to import:
datamaps.api.project_data_from_master_month. It is somewhattroublesome to try to use the current function for this
(
project_data_from_master) - the reason is related to the functionsignature and the unnecessary complexity of trying to detect whether the
caller is passing in a month or a quarter. Example, in the current API:
The signature of this function is
project_data_from_master(master, quarter, year). It would be nice to be able to use the same functionand instead of passing in a quarter integer here, pass in a month
integer, e.g.
project_data_from_master("master.xlsx", 12, 2021)but that exposes a little too much instability - you have to testwhether the caller means a quarter or a month here and opens up a bunch
of problems.
Instead, the new func added to the API goes like this:
I just need to fix a few bits related to leap years. This will be coming
out in datamaps
v1.1.6.@banillie
@yulqen thanks very much for this. I think this arrangement will work nicely. Having two different functions is not a problem. Cheers.
Implemented in
v1.1.6- now released on PyPI. Update withpip install -U datamaps.Use:
from datamaps.api import project_data_from_master_month.Report bugs!
Updated to
v1.1.7to fix bug inrepr().Hiya @yulqen sorry only just getting to this now, but going to try it out. cheers.
@yulqen I was able to integrate this into analysis_engine now problem. One of the reporting process now uses monthly masters. Cheers Man.