質問編集履歴

2

試したことの欄の更新

2023/04/29 06:02

投稿

sss2384
sss2384

スコア0

test CHANGED
File without changes
test CHANGED
@@ -75,7 +75,7 @@
75
75
  Z=df.iloc[1:,5:].T
76
76
  times=np.array(times)
77
77
 
78
- X,Y=np.meshgrid(times,heights.values)
78
+ X,Y=np.meshgrid(times,heights)
79
79
 
80
80
  fig = plt.figure()
81
81
  ax = fig.add_subplot(111)
@@ -93,7 +93,9 @@
93
93
  plt.show()
94
94
  ```
95
95
  ### 試したこと
96
+ 時間を表しているtimesをX軸に表示させようと思いX,Y=np.meshgrid(times,heights)
96
- np.arrayでnumpy配列に変換させた。
97
+ と設定したが上記のエラーメッセージがでてきのでtimesをnp.arrayでnumpy配列に変換させて問題解決を図っがまた同じエラーメッセージが出た
98
+ timeをtime= pd.date_range(start='2004/4/20 00:05:00', end='2004/4/21', freq='10min')としたときはエラーメッセージが出なくできたが年月日もX軸に表示されてしまう。年月日は表示させずに時間だけにしたい。
97
99
 
98
100
  ### 補足情報(FW/ツールのバージョンなど)
99
101
 

1

エラーメッセージの変更

2023/04/29 05:57

投稿

sss2384
sss2384

スコア0

test CHANGED
File without changes
test CHANGED
@@ -12,13 +12,38 @@
12
12
  unhashable type: 'numpy.ndarray'
13
13
  ```
14
14
  エラーメッセージ
15
+ ```Traceback (most recent call last):
16
+ File "c:\Users\name\Documents\c_program\.conda\my python\RSL22.py", line 42, in <module>
17
+ contour=ax[0].contourf(X, Y, Z,)
18
+ File "C:\Users\name\Documents\c_program\.conda\lib\site-packages\matplotlib\__init__.py", line 1423, in inner
19
+ return func(ax, *map(sanitize_sequence, args), **kwargs)
20
+ File "C:\Users\name\Documents\c_program\.conda\lib\site-packages\matplotlib\axes\_axes.py", line 6414, in contourf
21
+ contours = mcontour.QuadContourSet(self, *args, **kwargs)
22
+ File "C:\Users\name\Documents\c_program\.conda\lib\site-packages\matplotlib\contour.py", line 794, in __init__
23
+ kwargs = self._process_args(*args, **kwargs)
24
+ File "C:\Users\name\Documents\c_program\.conda\lib\site-packages\matplotlib\contour.py", line 1435, in _process_args
25
+ x, y, z = self._contour_args(args, kwargs)
26
+ File "C:\Users\name\Documents\c_program\.conda\lib\site-packages\matplotlib\contour.py", line 1473, in _contour_args
27
+ x, y, z = self._check_xyz(args[:3], kwargs)
28
+ File "C:\Users\name\Documents\c_program\.conda\lib\site-packages\matplotlib\contour.py", line 1494, in _check_xyz
29
+ x, y = self.axes._process_unit_info([("x", x), ("y", y)], kwargs)
30
+ File "C:\Users\name\Documents\c_program\.conda\lib\site-packages\matplotlib\axes\_base.py", line 2585, in _process_unit_info
31
+ axis.update_units(data)
32
+ File "C:\Users\name\Documents\c_program\.conda\lib\site-packages\matplotlib\axis.py", line 1608, in update_units
33
+ default = self.converter.default_units(data, self)
34
+ File "C:\Users\name\Documents\c_program\.conda\lib\site-packages\matplotlib\category.py", line 116, in default_units
35
+ axis.set_units(UnitData(data))
36
+ File "C:\Users\name\Documents\c_program\.conda\lib\site-packages\matplotlib\category.py", line 192, in __init__
37
+ self.update(data)
38
+ File "C:\Users\name\Documents\c_program\.conda\lib\site-packages\matplotlib\category.py", line 225, in update
39
+ for val in OrderedDict.fromkeys(data):
15
- ```unhashable type: 'numpy.ndarray'
40
+ TypeError: unhashable type: 'numpy.ndarray'
16
41
 
17
42
  ### 該当のソースコード
18
43
 
19
44
  ```python
20
- ソースコード
45
+
21
- ```
46
+
22
47
  import pandas as pd
23
48
  import matplotlib.pyplot as plt
24
49
  import numpy as np
@@ -66,6 +91,7 @@
66
91
  ax.set_title('200')
67
92
 
68
93
  plt.show()
94
+ ```
69
95
  ### 試したこと
70
96
  np.arrayでnumpy配列に変換させた。
71
97