回答編集履歴

2

Update

2021/12/08 10:05

投稿

melian
melian

スコア20655

test CHANGED
@@ -24,7 +24,7 @@
24
24
 
25
25
  df = pd.read_csv("h2o_gaiaD_xmatch3arc.csv")
26
26
 
27
- dfx = pd.DataFrame(df.apply(polar2cart, axis=1))
27
+ dfx = df.apply(polar2cart, axis=1)
28
28
 
29
29
  dfx.columns = ['x', 'y', 'z']
30
30
 

1

Update

2021/12/08 10:05

投稿

melian
melian

スコア20655

test CHANGED
@@ -9,6 +9,8 @@
9
9
  def polar2cart(args):
10
10
 
11
11
  theta, phi, r = args
12
+
13
+ theta *= math.pi / 180; phi *= math.pi / 180
12
14
 
13
15
  return pd.Series([
14
16
 
@@ -34,10 +36,10 @@
34
36
 
35
37
  #
36
38
 
37
- x y z
39
+ x y z
38
40
 
39
- 0 591.763439 -313.570109 900.020690
41
+ 0 10.633326 -6.619487 1121.780075
40
42
 
41
- 1 197.419770 -233.091244 274.489666
43
+ 1 3.389362 4.965006 410.626998
42
44
 
43
45
  ```