how get week numbers starting from sunday - excel

Date Day_name ****WeekNum****
1/1/2016 Fri 1
1/2/2016 Sat 1
1/3/2016 Sun 2
1/4/2016 Mon 2
1/5/2016 Tue 2
1/6/2016 Wed 2
1/7/2016 Thu 2
1/8/2016 Fri 2
1/9/2016 Sat 2
1/10/2016 Sun 3
1/11/2016 Mon 3
1/12/2016 Tue 3
1/13/2016 Wed 3
1/14/2016 Thu 3
1/15/2016 Fri 3
1/16/2016 Sat 3
1/17/2016 Sun 4
1/18/2016 Mon 4
1/19/2016 Tue 4
1/20/2016 Wed 4
1/21/2016 Thu 4
1/22/2016 Fri 4
1/23/2016 Sat 4
1/24/2016 Sun 5
1/25/2016 Mon 5
1/26/2016 Tue 5
1/27/2016 Wed 5
1/28/2016 Thu 5
1/29/2016 Fri 5
1/30/2016 Sat 5
1/31/2016 Sun 6
2/1/2016 Mon 6
2/2/2016 Tue 6
2/3/2016 Wed 6

Here Your starting week day should begin with sunday and the end day of week should be saturday

Assuming you have your date in A1 your B1 and C1 are as follows:
Day_name is =TEXT(A1,"ddd")
WeekNum starting on Sunday is =WEEKNUM(A1,1)

Related

How to get year also in the startup process when doing ps -ef

I am doing ps -ef | grep process.
I am getting an output in this format:
17297 1 12 Jan10 ? 02:53:26 /usr/java/jdk1.8.0_221-amd64/bin/java
Here instead of Jan10, I want Jan10 2021
Use the formatted output (-o option) of ps command and choose the format. For example:
$ ps -eo pid,ppid,lstart,cmd
PID PPID STARTED COMMAND
1 0 Mon Jan 11 12:26:03 2021 systemd
2 0 Mon Jan 11 12:26:03 2021 kthreadd
3 2 Mon Jan 11 12:26:03 2021 rcu_gp
4 2 Mon Jan 11 12:26:03 2021 rcu_par_gp
5 2 Mon Jan 11 12:26:03 2021 kworker/0:0-events
6 2 Mon Jan 11 12:26:03 2021 kworker/0:0H-kblockd
9 2 Mon Jan 11 12:26:03 2021 mm_percpu_wq
[...]
Available formats are described in the "STANDARD FORMAT SPECIFIERS" section of the manual.

How to return a matrix to a vector

Is there any way to return a matrix to a vector? I don't know the number of elements in the matrix, so let's say,matrix has n elements.
Below, it is an example of how I want to transform the table.
Any help, guidance, suggesting, recommendation will be very appreciated.
raw data.csv:
,January,February,March,April,May,June,July,August,September,October,November,December
2019,1,2,3,4,5,6,7,8,9,10,11,12
2018,13,14,15,16,17,18,19,20,21,22,23,24
2017,25,26,27,28,29,30,31,32,33,34,35,36
the link for csv files
raw=pd.read_csv('raw data.csv')
raw.head()
Unnamed: 0 January February March April May June July August September October November December
0 2019 1 2 3 4 5 6 7 8 9 10 11 12
1 2018 13 14 15 16 17 18 19 20 21 22 23 24
2 2017 25 26 27 28 29 30 31 32 33 34 35 36
final=pd.read_csv('Final.csv')
final.head(20)
Year&Month Value
0 2019 January 1
1 2019 February 2
2 2019 March 3
3 2019 April 4
4 2019 May 5
5 2019 June 6
6 2019 July 7
7 2019 August 8
8 2019 September 9
9 2019 October 10
10 2019 November 11
11 2019 December 12
12 2018 January 13
13 2018 February 14
14 2018 March 15
15 2018 April 16
16 2018 May 17
17 2018 June 18
18 2018 July 19
19 2018 August 20```
You can use pandas stack
df = pd.read_csv(r'raw data.csv')
df.set_index(df.columns[0]).stack().reset_index()
Out:
Unnamed: 0 level_1 0
0 2019 January 1
1 2019 February 2
2 2019 March 3
3 2019 April 4
4 2019 May 5
5 2019 June 6
6 2019 July 7
7 2019 August 8
8 2019 September 9
9 2019 October 10
10 2019 November 11
11 2019 December 12
12 2018 January 13
13 2018 February 14

Cron/Quartz Every N months

The cron expression:
0 0 0 L 8/7 ?
Is described by this site as:
"At 00:00:00am, on the last day of the month, every 7 months starting in August"
However, when I choose to see the next execution dates I get:
Thu Aug 31 00:00:00 UTC 2017
Fri Aug 31 00:00:00 UTC 2018
Sat Aug 31 00:00:00 UTC 2019
Mon Aug 31 00:00:00 UTC 2020
Tue Aug 31 00:00:00 UTC 2021
Wed Aug 31 00:00:00 UTC 2022
Thu Aug 31 00:00:00 UTC 2023
Sat Aug 31 00:00:00 UTC 2024
Which really is "every 12 months starting in August". I was expecting to get a 7-month period, but I suspect everything resets when you cross the January threshold.
Is there any way I can actually get periodic values such as every n months or every n weeks or is that not really possible out of the box with cron?

Grails get day of current week and last three weeks

I got a domain work with id, day
Day shows value from Match to current.
I need to find the list of current week and last two weeks
Ex: today is Monday (04/22) then what I need is:
Week1: 06-12 April
Week2: 13-19 April
Current week: 20-26 April.
Please helps, thanks.
Posted here for posterity:
def current = new Date().clearTime()
int currentDay = Calendar.instance.with {
time = current
get( Calendar.DAY_OF_WEEK )
}
def listOfDays = (current - 13 - currentDay)..(current + 7 - currentDay)
listOfDays.each {
println it
}
Prints:
Sun Apr 06 00:00:00 BST 2014
Mon Apr 07 00:00:00 BST 2014
Tue Apr 08 00:00:00 BST 2014
Wed Apr 09 00:00:00 BST 2014
Thu Apr 10 00:00:00 BST 2014
Fri Apr 11 00:00:00 BST 2014
Sat Apr 12 00:00:00 BST 2014
Sun Apr 13 00:00:00 BST 2014
Mon Apr 14 00:00:00 BST 2014
Tue Apr 15 00:00:00 BST 2014
Wed Apr 16 00:00:00 BST 2014
Thu Apr 17 00:00:00 BST 2014
Fri Apr 18 00:00:00 BST 2014
Sat Apr 19 00:00:00 BST 2014
Sun Apr 20 00:00:00 BST 2014
Mon Apr 21 00:00:00 BST 2014
Tue Apr 22 00:00:00 BST 2014
Wed Apr 23 00:00:00 BST 2014
Thu Apr 24 00:00:00 BST 2014
Fri Apr 25 00:00:00 BST 2014
Sat Apr 26 00:00:00 BST 2014

Groovy, get list of current week and last 2 weeks

I got a domain work with id, day, list day from January to now.
I get the current time by code:
def current = new Date()
So, I'd like to get list day from last 2 weeks, included this week, then I used the following code but it doesn't work.
def getWeek = current.Time - 13 (13 is 2 week + today)
Please help me solve it.
Not 100% sure I understand, but you should be able to use a Range:
def current = new Date().clearTime()
def listOfDays = (current - 13)..current
listOfDays.each { println it }
That prints:
Wed Apr 09 00:00:00 BST 2014
Thu Apr 10 00:00:00 BST 2014
Fri Apr 11 00:00:00 BST 2014
Sat Apr 12 00:00:00 BST 2014
Sun Apr 13 00:00:00 BST 2014
Mon Apr 14 00:00:00 BST 2014
Tue Apr 15 00:00:00 BST 2014
Wed Apr 16 00:00:00 BST 2014
Thu Apr 17 00:00:00 BST 2014
Fri Apr 18 00:00:00 BST 2014
Sat Apr 19 00:00:00 BST 2014
Sun Apr 20 00:00:00 BST 2014
Mon Apr 21 00:00:00 BST 2014
Tue Apr 22 00:00:00 BST 2014
If you mean you want the entire 2 weeks before the current week AND the current week, you could do:
def current = new Date().clearTime()
int currentDay = Calendar.instance.with {
time = current
get( Calendar.DAY_OF_WEEK )
}
def listOfDays = (current - 13 - currentDay)..(current + 7 - currentDay)
listOfDays.each {
println it
}
Which prints:
Sun Apr 06 00:00:00 BST 2014
Mon Apr 07 00:00:00 BST 2014
Tue Apr 08 00:00:00 BST 2014
Wed Apr 09 00:00:00 BST 2014
Thu Apr 10 00:00:00 BST 2014
Fri Apr 11 00:00:00 BST 2014
Sat Apr 12 00:00:00 BST 2014
Sun Apr 13 00:00:00 BST 2014
Mon Apr 14 00:00:00 BST 2014
Tue Apr 15 00:00:00 BST 2014
Wed Apr 16 00:00:00 BST 2014
Thu Apr 17 00:00:00 BST 2014
Fri Apr 18 00:00:00 BST 2014
Sat Apr 19 00:00:00 BST 2014
Sun Apr 20 00:00:00 BST 2014
Mon Apr 21 00:00:00 BST 2014
Tue Apr 22 00:00:00 BST 2014
Wed Apr 23 00:00:00 BST 2014
Thu Apr 24 00:00:00 BST 2014
Fri Apr 25 00:00:00 BST 2014
Sat Apr 26 00:00:00 BST 2014

Resources