date

Order dates in ggplot by month

霸气de小男生 提交于 2020-04-30 07:49:37
问题 I have DF$Date in the as.Date format "yyyy-mm-dd" as shown below. Is there an easy way to get these grouped by month in ggplot? Date 2015-07-30 2015-08-01 2015-08-02 2015-08-06 2015-08-11 2015-08-12 I've added a column DF$Month as "year Monthname" (e.g. April 2015.) I'm doing this by DF$Month<-strftime(DF$Date,format="%B %Y") Is there a quick way to factor the month/years so that they are ordinal? I used a workaround by formatting using: DF$Month<-strftime(DF$Date,format="%Y-%m") so that the

Order dates in ggplot by month

拥有回忆 提交于 2020-04-30 07:49:20
问题 I have DF$Date in the as.Date format "yyyy-mm-dd" as shown below. Is there an easy way to get these grouped by month in ggplot? Date 2015-07-30 2015-08-01 2015-08-02 2015-08-06 2015-08-11 2015-08-12 I've added a column DF$Month as "year Monthname" (e.g. April 2015.) I'm doing this by DF$Month<-strftime(DF$Date,format="%B %Y") Is there a quick way to factor the month/years so that they are ordinal? I used a workaround by formatting using: DF$Month<-strftime(DF$Date,format="%Y-%m") so that the

python - scatter plot with dates and 3rd variable as color

我只是一个虾纸丫 提交于 2020-04-30 07:37:30
问题 I am trying to plot an x-y plot, with x or y as date variable, and using a 3rd variable to color the points. I managed to do it if none of the 3 variables are date, using: ax.scatter(df['x'],df['y'],s=20,c=df['z'], marker = 'o', cmap = cm.jet ) After searching, I find out that for normal plot, we have to use plot_date(). Unfortunately, I haven't been able to color the points. Can anybody help me? Here is a small example: import matplotlib, datetime import matplotlib.pyplot as plt import

PHP/SQL - How can I check if a date user input is in between an existing date range in my database?

99封情书 提交于 2020-04-30 07:37:18
问题 I am trying to create a search page that takes a check in and check out date to check if a room is available. if a room has an existing booking and its date range overlaps with the user input then it is not outputted. otherwise if it does not have a booking or its current bookings does not overlap with user input then it is outputted. A check in can exist on another booking's check out date My current SQL outputs all rooms based on the number of beds only. for some reason it does not check

python - scatter plot with dates and 3rd variable as color

风格不统一 提交于 2020-04-30 07:37:08
问题 I am trying to plot an x-y plot, with x or y as date variable, and using a 3rd variable to color the points. I managed to do it if none of the 3 variables are date, using: ax.scatter(df['x'],df['y'],s=20,c=df['z'], marker = 'o', cmap = cm.jet ) After searching, I find out that for normal plot, we have to use plot_date(). Unfortunately, I haven't been able to color the points. Can anybody help me? Here is a small example: import matplotlib, datetime import matplotlib.pyplot as plt import

Powershell Getting the nth day of the month

浪尽此生 提交于 2020-04-30 07:32:28
问题 I have this script which I found on the internet to calculate the third Tuesday of every month - but I need to modify it to simply give me the 7th day of the month, and the same but plus any number of days). $FindNthDay=3 $WeekDay='Tuesday' [datetime]$Today=[datetime]::NOW $todayM=$Today.Month.ToString() $todayY=$Today.Year.ToString() [datetime]$StrtMonth=$todayM+'/7/'+$todayY while ($StrtMonth.DayofWeek -ine $WeekDay ) { $StrtMonth=$StrtMonth.AddDays(1) } $StrtMonth.AddDays(7*($FindNthDay-1)

Powershell Getting the nth day of the month

余生颓废 提交于 2020-04-30 07:32:06
问题 I have this script which I found on the internet to calculate the third Tuesday of every month - but I need to modify it to simply give me the 7th day of the month, and the same but plus any number of days). $FindNthDay=3 $WeekDay='Tuesday' [datetime]$Today=[datetime]::NOW $todayM=$Today.Month.ToString() $todayY=$Today.Year.ToString() [datetime]$StrtMonth=$todayM+'/7/'+$todayY while ($StrtMonth.DayofWeek -ine $WeekDay ) { $StrtMonth=$StrtMonth.AddDays(1) } $StrtMonth.AddDays(7*($FindNthDay-1)

R subtracting 1 month from today's date gives NA

会有一股神秘感。 提交于 2020-04-27 06:03:12
问题 I have a script in which I subset my data according to some set time periods and wanted to subset all the records that had occurred in the last month. However if I try to subtract one month from today's date it yields an NA: > today <- Sys.Date() > today [1] "2017-03-29" > today - months(1) [1] NA I do have lubridate loaded but I think this calculation is being performed with base R. If I subtract 2 or more months it works fine: > today - months(2) [1] "2017-01-29" > today - months(3) [1]

R subtracting 1 month from today's date gives NA

狂风中的少年 提交于 2020-04-27 06:02:05
问题 I have a script in which I subset my data according to some set time periods and wanted to subset all the records that had occurred in the last month. However if I try to subtract one month from today's date it yields an NA: > today <- Sys.Date() > today [1] "2017-03-29" > today - months(1) [1] NA I do have lubridate loaded but I think this calculation is being performed with base R. If I subtract 2 or more months it works fine: > today - months(2) [1] "2017-01-29" > today - months(3) [1]

R subtracting 1 month from today's date gives NA

喜你入骨 提交于 2020-04-27 06:01:48
问题 I have a script in which I subset my data according to some set time periods and wanted to subset all the records that had occurred in the last month. However if I try to subtract one month from today's date it yields an NA: > today <- Sys.Date() > today [1] "2017-03-29" > today - months(1) [1] NA I do have lubridate loaded but I think this calculation is being performed with base R. If I subtract 2 or more months it works fine: > today - months(2) [1] "2017-01-29" > today - months(3) [1]