小编Poo*_*oya的帖子

朱莉娅:阵列中的作业

为数组索引多个级别时,它可以正常工作.但是当我用它来分配值时,却没有.有谁知道为什么A不在下面改变?

In  [4]: A = rand(6)

Out [4]: 6-element Array{Float64,1}:
 0.111552
 0.155126
 0.78485 
 0.147477
 0.362078
 0.959022

In  [5]: A[3:5][[true,false,true]]

Out [5]: 2-element Array{Float64,1}:
 0.78485 
 0.362078

In  [6]: A[3:5][[true,false,true]] = [99, 999]

Out [6]: 2-element Array{Int64,1}:
  99
 999

In  [7]: A

Out [7]: 6-element Array{Float64,1}:
 0.111552
 0.155126
 0.78485 
 0.147477
 0.362078
 0.959022
Run Code Online (Sandbox Code Playgroud)

variable-assignment multidimensional-array julia

6
推荐指数
1
解决办法
839
查看次数

Julia:在DataFrame中将列类型从Integer转换为Float64

I am trying to change type of numbers in a column of a DataFrame from integer to floating point. It should be straightforward to do this, but it's not working. The data type remains to be integer. What am I missing?

In  [2]: using DataFrames
df = DataFrame(A = 1:4, B = ["M", "F", "F", "M"])

Out [2]: 4x2 DataFrame
| Row | A | B   |
|-----|---|-----|
| 1   | 1 | "M" |
| 2   | 2 | …
Run Code Online (Sandbox Code Playgroud)

dataframe julia

4
推荐指数
1
解决办法
4253
查看次数