teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

修正したコードと実行結果です

2022/01/06 09:57

投稿

YuLin
YuLin

スコア2

title CHANGED
File without changes
body CHANGED
@@ -22,6 +22,49 @@
22
22
 
23
23
  for point in keycode:
24
24
  lat_c, lon_c = ju.to_meshpoint(keycode, 0.5, 0.5)
25
+
26
+
27
+
28
+
29
+ [追記]
30
+ import jismesh.utils as ju
31
+ import pandas as pd
32
+
33
+ df = pd.read_excel("C:/Users/user/Desktop/excel/Key.xlsx")
34
+
35
+ print(df)
36
+
37
+ df['lat'], df['lon'] = ju.to_meshpoint(df, lat_multiplier=0.5, lon_multiplier=0.5)
38
+
39
+ print(df)
40
+
41
+ [実行結果]
42
+
43
+ 52350149
44
+ 0 52350149
45
+ 1 52350159
46
+ 2 52350159
47
+ 3 52350169
48
+ 4 52350169
49
+ .. ...
50
+ 743 52351020
51
+ 744 52351021
52
+ 745 52351023
53
+ 746 52351024
54
+ 747 52351030
55
+
56
+ [748 rows x 1 columns]
57
+ Traceback (most recent call last):
58
+ File "c:\Users\user\Desktop\Python\3mesh.py", line 8, in
59
+ <module>
60
+ df['lat'], df['lon'] = ju.to_meshpoint(df, lat_multiplier=0.5,
61
+ lon_multiplier=0.5)
62
+ File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\jismesh\utils\__init__.py", line 46, in to_meshpoint return to_meshpoint(meshcode, lat_multiplier, lon_multiplier)
63
+ File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\jismesh\utils\_vector.py", line 493, in to_meshpoint lat += unit_lat(level)*lat_multiplier
64
+ File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\jismesh\utils\_vector.py", line 57, in unit_lat
65
+ lat[level==1] = _unit_lat_lv1()
66
+ IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed
67
+
25
68
  ```
26
69
 
27
70
  ### 試したこと