zoo

docker一键部署zookeeper

匿名 (未验证) 提交于 2019-12-02 23:41:02
version: '3.1' services: zoo1: image: zookeeper:3.4.11 restart: always hostname: zoo1 container_name: zookeeper_1 #domainname: ports: - 2181:2181 environment: ZOO_MY_ID: 1 ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888 zoo2: image: zookeeper:3.4.11 restart: always hostname: zoo2 container_name: zookeeper_2 ports: - 2182:2181 environment: ZOO_MY_ID: 2 ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888 zoo3: image: zookeeper:3.4.11 restart: always hostname: zoo3 container_name: zookeeper_3 ports: - 2183:2181 environment: ZOO

python基础知识:数据结构的学习

匿名 (未验证) 提交于 2019-12-02 22:56:40
python的数据结构有:列表、元组、字典 列表: 作用:处理 有序 项目的数据结构 list=["a",‘b‘,‘v‘,‘d‘] # 打印长度 print(len(list)) # 循环打印 for i in list: print i # 在序列最后插入数据 list.append("5") for i in list: print i print(list[0]) # 删除序列中的某个元素 del list[0] print(list[0]) # 对列表进行排序 list.sort() print(list) 元组 作用:同列表类似 区别:元组不可变,不可被修改 # 使用元组 zoo = (‘wolf‘, ‘elephant‘, ‘penguin‘) print ‘Number of animals in the zoo is‘, len(zoo) new_zoo = (‘monkey‘, ‘dolphin‘, zoo) print ‘Number of animals in the new zoo is‘, len(new_zoo) print ‘All animals in new zoo are‘, new_zoo print ‘Animals brought from old zoo are‘, new_zoo[2] print ‘Last animal

Rollapply for time series

爱⌒轻易说出口 提交于 2019-12-02 22:39:17
I am trying to calculate the rolling 20 period historical volatility. I take the daily returns: ret<-ROC(data1) And then I use rollapply to get the 20 day HV for each column: vol<-rollapply(ret,20,sd,by.column=T,fill=NA) The problem is that observations in vol starts appearing after ten days which is wrong as I specified 20. For demonstration here is sample of the data: 0.000000000, 0.005277045, 0.023622047, 0.002564103,-0.002557545, -0.020512821, 0.007853403,-0.012987013, 0.007894737, 0.015665796, 0.000000000, -0.002570694, 0.002577320, -0.015424165, 0.002610966, 0.010416667, 0.002577320, 0

linux下zookeeper集群搭建

半世苍凉 提交于 2019-12-02 08:41:45
目录 1.前提 2.配置主机名到IP地址的映射 3.修改zoo.cfg配置 4.新建myid文件并写入集群标识 5.在另外两台机器进行相同操作 6.查看集群状态配置结束 接着上一篇博客linux下zookeeper单机搭建,本篇进阶一下,利用三台机器进行集群操作。保证高可用。 1.前提 作者默认读者已经准备好了三台不同ip的机器或者虚拟机,并且都已经安装好jdk,linux 下zookeeper安装教程可以参考我的另一篇博客。 https://blog.csdn.net/u010199866/article/details/81742866 以下是zookeeper真集群配置教程 我们准备的三台机器ip分别为 xx.xx.xx.1 xx.xx.xx.2 xx.xx.xx.3 2.配置主机名到IP地址的映射 (此步骤不是必须的,我们可以直接在zk的配置文件中填写IP地址),这样配置的好处是如果某个IP地址发生了变化,我们不需要重启zookeeper,直接修改主机对应的IP地址即可。 直接修改/etc/hosts文件,设置主机zoo-1映射到x.x.x.1,设置主机zoo-2映射到x.x.x.2,设置主机zoo-3映射到x.x.x.3 三台机器都需要相同的hosts配置 vim /etc/hosts x.x.x.1 zoo-1 x.x.x.2 zoo-2 x.x.x.3 zoo-3 3

missing yearmon labels using ggplot scale_x_yearmon

我怕爱的太早我们不能终老 提交于 2019-12-02 07:48:06
问题 I have grouped some data by month and year, converted to yearmon using zoo and am now plotting it in ggplot. Does anyone know why one of the ticklabels are missing and there is one for 2018-07, when there is no data for that month? Example data: df <- data.frame(dates = c("2019-01", "2019-02", "2018-08", "2018-09", "2018-10", "2018-11", "2018-12"), values= c(0,1,2,3,4,5,6)) df$dates <- as.yearmon(df$dates) ggplot(df, aes(x = dates, y = values)) + geom_bar(position="dodge", stat="identity") +

Maximum slope for a given interval each day

巧了我就是萌 提交于 2019-12-02 07:25:34
问题 I have a set of time series data with ground surface temperatures measured every 10 minutes over multiple days (actually 2 years of data) from three different locations. What I am interested in calculating is the maximum slope (rate of temperature increase) for any 60 minute interval for each day for each site. So essentially I would like to work through each day, 10 minutes at a time, with a 60 minute window and calculate the slope for each window, and then determine the maximum slope and

R remove groups with only NAs

允我心安 提交于 2019-12-02 06:43:57
I have a dataframe similar to the one generated by the following structure: library(dplyr) df1 <- expand.grid(region = c("USA", "EUR", "World"), time = c(2000, 2005, 2010, 2015, 2020), scenario = c("policy1", "policy2"), variable = c("foo", "bar")) df2 <- expand.grid(region = c("USA", "EUR", "World"), time = seq(2000, 2020, 1), scenario = c("policy1", "policy2"), variable = c("foo", "bar")) df2 <- filter(df2, !(time %in% c(2000, 2005, 2010, 2015, 2020))) df1$value <- rnorm(dim(df1)[1], 1.5, 1) df1[df1 < 0] <- NA df2$value <- NA df1[df1$region == "World" & df1$variable == "foo", "value"] <- NA

Wrong week-ending date using 'to.weekly' function in 'xts' package

大兔子大兔子 提交于 2019-12-02 04:20:00
问题 I have a really odd issue... I am using the to.weekly and to.period function to convert a daily xts object to weekly data. In most instances, I get the week-ending date as a Friday ( day.of.week function will return 5) (e.g. "2010-01-08" , "2011-02-11" ), but there are a few cases where I get something other than Friday (Saturday/Sunday/Thursday/etc.) I have tried to.weekly and to.period(x, period = 'weeks') and both return the same problem. Why is this happening? Is there a work-around for

Time Series Interpolation

妖精的绣舞 提交于 2019-12-02 03:22:17
问题 I have two series of data (calibration and sample) and am trying to interpolate the calibration data from monthly to the frequency of the sample which randomly changes between minutely to secondly. I tried this (Interpolating timeseries) and here's my code: require(zoo) zc <- zoo(calib$MW2, calib$Date) zs <- zoo(sample$MW.2, sample$DateMW.2) z <- merge(zc, zs) zc <- zoo(calib$MW2, calib$Date) zs <- zoo(sample$MW.2, sample$DateMW.2) # "merge" gets data frames only zc <- data.frame(zc) zs <-

Different dates formats in zoo

五迷三道 提交于 2019-12-02 01:12:36
I am finding differences in behavior between two environments running R 2.12.1. In the first one zoo behaves as expected. > library(zoo) > x.date <- as.Date(paste(2003, 2, c(1, 3, 7, 9, 14), sep = "-")) > x <- zoo(rnorm(5), x.date) > index(x) [1] "2003-02-01" "2003-02-03" "2003-02-07" "2003-02-09" "2003-02-14" > as.Date(index(x)) [1] "2003-02-01" "2003-02-03" "2003-02-07" "2003-02-09" "2003-02-14" > sessionInfo() R version 2.12.1 (2010-12-16) Platform: x86_64-unknown-linux-gnu (64-bit) locale: [1] C attached base packages: [1] grid stats graphics grDevices utils datasets methods base other