Loop through 2 dates and execute a condition each 12 days, 2 days, 12 days, 2 days, etc
Tag : php , By : Gilmar Souza Jr.
Date : March 29 2020, 07:55 AM
may help you . You can consider a period to be 14 days long, which could be split in two subperiods - first of 12 days and the second of 2 days. So each step of your loop could process 14 days: $periodStartAt = 0;
while(true) {
$periodStartAt += 12; // first sub-period
if ($periodStartAt > $endAt) break;
//do something when first sub-period reached
$periodStartAt += 2; //second sub-period
if ($periodStartAt > $endAt) break;
//do something when second sub-period reached
}
|
Produce Histogram of days - including days with zero counts
Tag : python , By : codelurker
Date : March 29 2020, 07:55 AM
seems to work fine I'm trying to produce a histogram of sale counts per day. Some days have no records against them, but I don't want them missed out of my figure , It seems you need: #if dont want omit NaNs
df.resample('D', on='Created at').size().plot.bar()
#if want omit NaNs
df.resample('D', on='Created at').count().plot.bar()
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
s = df.resample('D', on='Created at').size()
ax = s.plot.bar()
ticklabels = s.index.strftime('%Y-%m-%d')
ax.xaxis.set_major_formatter(ticker.FixedFormatter(ticklabels))
plt.show()
|
How to generate a count of data for a particular dept for a specific days (3days, 4-7 days, 15 - 30 days) by using excel
Date : December 27 2020, 03:51 PM
should help you out If I understand you correctly, you want to return a period name (e.g. <3 Days, 4-7 Days, or 8-14 Days, etc.) in Column D based on the Days Count. If so, you can use the approximate match of VLOOKUP to achieve that, but you will need to create a look up table first. See below screen-shot for details. Please note I have named the look up table as Tbl_Period in my solution.
|
Formula that counts days worked while excluding overlapping or partial overlapping days in Google Sheets
Date : March 29 2020, 07:55 AM
it should still fix some issue I'm attempting to create a schedule that counts the number of days an employee has worked while ignoring the days that overlap. I have a spreadsheet with all employee activities that gets populated dynamically. Some of these activities overlap, some of them partially overlap. It seems like everything I tried today by searching through forums doesn't account for =ARRAYFORMULA(QUERY(UNIQUE(QUERY(SPLIT(TRANSPOSE(SPLIT(
QUERY(TRANSPOSE(QUERY(TRANSPOSE("♠"&INDIRECT("A2:A"&COUNTA(B2:B)+1)&"♦"&
SPLIT(REPT(INDIRECT("B2:B"&COUNTA(B2:B)+1)&"♣",
DAYS(INDIRECT("C2:C"&COUNTA(B2:B)+1), INDIRECT("B2:B"&COUNTA(B2:B)+1))+1), "♣")+
TRANSPOSE(ROW(INDIRECT("A1:A"&MAX(DAYS(C2:C, B2:B)+1)))-1))
,,999^99)),,999^99), "♠")), "♦"), "where Col2 > 4000", 0)),
"select Col1,count(Col2) group by Col1 label count(Col2)''"))
|
How to perform sort operation on a list having string and integer combination data like 1094 days, 1092 days, 994 days,
Date : September 27 2020, 01:00 AM
it fixes the issue You can use Comparator.comparingInt which required a function to extract an int from your object, in this case a String: list.sort(Comparator.comparingInt(s -> Integer.valueOf(s.split(" ")[0])));
|