質問編集履歴

1

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

2022/01/06 09:57

投稿

YuLin
YuLin

スコア2

test CHANGED
File without changes
test CHANGED
@@ -46,6 +46,92 @@
46
46
 
47
47
  lat_c, lon_c = ju.to_meshpoint(keycode, 0.5, 0.5)
48
48
 
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+ [追記]
58
+
59
+ import jismesh.utils as ju
60
+
61
+ import pandas as pd
62
+
63
+
64
+
65
+ df = pd.read_excel("C:/Users/user/Desktop/excel/Key.xlsx")
66
+
67
+
68
+
69
+ print(df)
70
+
71
+
72
+
73
+ df['lat'], df['lon'] = ju.to_meshpoint(df, lat_multiplier=0.5, lon_multiplier=0.5)
74
+
75
+
76
+
77
+ print(df)
78
+
79
+
80
+
81
+ [実行結果]
82
+
83
+
84
+
85
+ 52350149
86
+
87
+ 0 52350149
88
+
89
+ 1 52350159
90
+
91
+ 2 52350159
92
+
93
+ 3 52350169
94
+
95
+ 4 52350169
96
+
97
+ .. ...
98
+
99
+ 743 52351020
100
+
101
+ 744 52351021
102
+
103
+ 745 52351023
104
+
105
+ 746 52351024
106
+
107
+ 747 52351030
108
+
109
+
110
+
111
+ [748 rows x 1 columns]
112
+
113
+ Traceback (most recent call last):
114
+
115
+ File "c:\Users\user\Desktop\Python\3mesh.py", line 8, in
116
+
117
+ <module>
118
+
119
+ df['lat'], df['lon'] = ju.to_meshpoint(df, lat_multiplier=0.5,
120
+
121
+ lon_multiplier=0.5)
122
+
123
+ 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)
124
+
125
+ 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
126
+
127
+ File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\jismesh\utils\_vector.py", line 57, in unit_lat
128
+
129
+ lat[level==1] = _unit_lat_lv1()
130
+
131
+ IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed
132
+
133
+
134
+
49
135
  ```
50
136
 
51
137