julia

Create lag / lead time series with by groups in Julia?

半城伤御伤魂 提交于 2021-01-02 18:17:56
问题 I am wondering if there is an easy way to create a lag (or lead) of a time series variable in Julia according to a by group or condition? For example: I have a dataset of the following form julia> df1 = DataFrame(var1=["a","a","a","a","b","b","b","b"], var2=[0,1,2,3,0,1,2,3]) 8×2 DataFrame │ Row │ var1 │ var2 │ │ │ String │ Int64 │ ├─────┼────────┼───────┤ │ 1 │ a │ 0 │ │ 2 │ a │ 1 │ │ 3 │ a │ 2 │ │ 4 │ a │ 3 │ │ 5 │ b │ 0 │ │ 6 │ b │ 1 │ │ 7 │ b │ 2 │ │ 8 │ b │ 3 │ And I want to create a

Create lag / lead time series with by groups in Julia?

不想你离开。 提交于 2021-01-02 18:14:02
问题 I am wondering if there is an easy way to create a lag (or lead) of a time series variable in Julia according to a by group or condition? For example: I have a dataset of the following form julia> df1 = DataFrame(var1=["a","a","a","a","b","b","b","b"], var2=[0,1,2,3,0,1,2,3]) 8×2 DataFrame │ Row │ var1 │ var2 │ │ │ String │ Int64 │ ├─────┼────────┼───────┤ │ 1 │ a │ 0 │ │ 2 │ a │ 1 │ │ 3 │ a │ 2 │ │ 4 │ a │ 3 │ │ 5 │ b │ 0 │ │ 6 │ b │ 1 │ │ 7 │ b │ 2 │ │ 8 │ b │ 3 │ And I want to create a

Create lag / lead time series with by groups in Julia?

血红的双手。 提交于 2021-01-02 18:12:25
问题 I am wondering if there is an easy way to create a lag (or lead) of a time series variable in Julia according to a by group or condition? For example: I have a dataset of the following form julia> df1 = DataFrame(var1=["a","a","a","a","b","b","b","b"], var2=[0,1,2,3,0,1,2,3]) 8×2 DataFrame │ Row │ var1 │ var2 │ │ │ String │ Int64 │ ├─────┼────────┼───────┤ │ 1 │ a │ 0 │ │ 2 │ a │ 1 │ │ 3 │ a │ 2 │ │ 4 │ a │ 3 │ │ 5 │ b │ 0 │ │ 6 │ b │ 1 │ │ 7 │ b │ 2 │ │ 8 │ b │ 3 │ And I want to create a

Create lag / lead time series with by groups in Julia?

喜夏-厌秋 提交于 2021-01-02 18:12:23
问题 I am wondering if there is an easy way to create a lag (or lead) of a time series variable in Julia according to a by group or condition? For example: I have a dataset of the following form julia> df1 = DataFrame(var1=["a","a","a","a","b","b","b","b"], var2=[0,1,2,3,0,1,2,3]) 8×2 DataFrame │ Row │ var1 │ var2 │ │ │ String │ Int64 │ ├─────┼────────┼───────┤ │ 1 │ a │ 0 │ │ 2 │ a │ 1 │ │ 3 │ a │ 2 │ │ 4 │ a │ 3 │ │ 5 │ b │ 0 │ │ 6 │ b │ 1 │ │ 7 │ b │ 2 │ │ 8 │ b │ 3 │ And I want to create a

Create lag / lead time series with by groups in Julia?

南笙酒味 提交于 2021-01-02 18:11:29
问题 I am wondering if there is an easy way to create a lag (or lead) of a time series variable in Julia according to a by group or condition? For example: I have a dataset of the following form julia> df1 = DataFrame(var1=["a","a","a","a","b","b","b","b"], var2=[0,1,2,3,0,1,2,3]) 8×2 DataFrame │ Row │ var1 │ var2 │ │ │ String │ Int64 │ ├─────┼────────┼───────┤ │ 1 │ a │ 0 │ │ 2 │ a │ 1 │ │ 3 │ a │ 2 │ │ 4 │ a │ 3 │ │ 5 │ b │ 0 │ │ 6 │ b │ 1 │ │ 7 │ b │ 2 │ │ 8 │ b │ 3 │ And I want to create a

How to call a julia method defined in an imported package from c++?

两盒软妹~` 提交于 2021-01-02 06:51:19
问题 I need a c++ library to compute the polygamma function for complex arguments. After some googling that brought me to this https://scicomp.stackexchange.com/questions/23194/i-am-searching-for-c-code-of-the-complex-polygamma-function/23195/ I decided to try to call the julia library from c++. In order to embedd julia in c++ I followed the example at julia-lang embedding into c. where julia is used to calculate the sqrt(2) . This works fine... how can I generalize the example to work for my case

What is Julia equivalent of numpy's where function?

£可爱£侵袭症+ 提交于 2021-01-02 06:35:51
问题 In python, where in numpy choose elements in array based on given condition. >>> a = np.arange(10) >>> a array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) >>> np.where(a < 5, a, 10*a) array([ 0, 1, 2, 3, 4, 50, 60, 70, 80, 90]) What about in Julia? filter would be used as selecting elements but it drops other elements if if expression not being used. However, I don't want to use if . Do I need to write more sophisticated function for filter (without if ) or any other alternatives? EDIT : I found the

Array ordering in Julia

旧巷老猫 提交于 2020-12-31 04:15:07
问题 Is there a way to work with C-ordered or non-contiguous arrays natively in Julia? For example, when using NumPy, C-ordered arrays are the default, but I can initialize a Fortran ordered array and do computations with that as well. One easy way to do this was to take the Transpose of a matrix. I can also work with non-contiguous arrays that are made via slicing. I have looked through the documentation, etc. and can't find a way to make, declare, or work with a C-ordered array in Julia. The

Array ordering in Julia

徘徊边缘 提交于 2020-12-31 04:14:33
问题 Is there a way to work with C-ordered or non-contiguous arrays natively in Julia? For example, when using NumPy, C-ordered arrays are the default, but I can initialize a Fortran ordered array and do computations with that as well. One easy way to do this was to take the Transpose of a matrix. I can also work with non-contiguous arrays that are made via slicing. I have looked through the documentation, etc. and can't find a way to make, declare, or work with a C-ordered array in Julia. The

Array ordering in Julia

∥☆過路亽.° 提交于 2020-12-31 04:12:46
问题 Is there a way to work with C-ordered or non-contiguous arrays natively in Julia? For example, when using NumPy, C-ordered arrays are the default, but I can initialize a Fortran ordered array and do computations with that as well. One easy way to do this was to take the Transpose of a matrix. I can also work with non-contiguous arrays that are made via slicing. I have looked through the documentation, etc. and can't find a way to make, declare, or work with a C-ordered array in Julia. The