質問編集履歴

2

コードを入力しました

2020/04/27 01:19

投稿

kamijou
kamijou

スコア0

test CHANGED
File without changes
test CHANGED
@@ -8,6 +8,72 @@
8
8
 
9
9
  ### エラーメッセージ
10
10
 
11
+ ```
12
+
13
+ C:\Users\comp1\Desktop\python_lesson>python Tc-Te_0005.py
14
+
15
+ sys:1: DtypeWarning: Columns (2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47) have mixed types.Specify dtype option on import or set low_memory=False.
16
+
17
+ sys:1: DtypeWarning: Columns (2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47) have mixed types.Specify dtype option on import or set low_memory=False.
18
+
19
+ <class 'str'>
20
+
21
+ Traceback (most recent call last):
22
+
23
+ File "C:\Users\comp1\AppData\Local\Programs\Python\Python37\lib\site-packages\matplotlib\axis.py", line 1573, in convert_units
24
+
25
+ ret = self.converter.convert(x, self.units, self)
26
+
27
+ File "C:\Users\comp1\AppData\Local\Programs\Python\Python37\lib\site-packages\matplotlib\category.py", line 61, in convert
28
+
29
+ unit.update(values)
30
+
31
+ File "C:\Users\comp1\AppData\Local\Programs\Python\Python37\lib\site-packages\matplotlib\category.py", line 212, in update
32
+
33
+ cbook._check_isinstance((str, bytes), value=val)
34
+
35
+ File "C:\Users\comp1\AppData\Local\Programs\Python\Python37\lib\site-packages\matplotlib\cbook\__init__.py", line 2128, in _check_isinstance
36
+
37
+ type_name(type(v))))
38
+
39
+ TypeError: 'value' must be an instance of str or bytes, not a float
40
+
41
+
42
+
43
+ The above exception was the direct cause of the following exception:
44
+
45
+
46
+
47
+ Traceback (most recent call last):
48
+
49
+ File "Tc-Te_0005.py", line 40, in <module>
50
+
51
+ plt.scatter(data.iloc[8:, 40], data.iloc[8:, 42])
52
+
53
+ File "C:\Users\comp1\AppData\Local\Programs\Python\Python37\lib\site-packages\matplotlib\pyplot.py", line 2816, in scatter
54
+
55
+ None else {}), **kwargs)
56
+
57
+ File "C:\Users\comp1\AppData\Local\Programs\Python\Python37\lib\site-packages\matplotlib\__init__.py", line 1565, in inner
58
+
59
+ return func(ax, *map(sanitize_sequence, args), **kwargs)
60
+
61
+ File "C:\Users\comp1\AppData\Local\Programs\Python\Python37\lib\site-packages\matplotlib\cbook\deprecation.py", line 358, in wrapper
62
+
63
+ return func(*args, **kwargs)
64
+
65
+ File "C:\Users\comp1\AppData\Local\Programs\Python\Python37\lib\site-packages\matplotlib\axes\_axes.py", line 4372, in scatter
66
+
67
+ x = self.convert_xunits(x)
68
+
69
+ File "C:\Users\comp1\AppData\Local\Programs\Python\Python37\lib\site-packages\matplotlib\artist.py", line 178, in convert_xunits
70
+
71
+ return ax.xaxis.convert_units(x)
72
+
73
+ File "C:\Users\comp1\AppData\Local\Programs\Python\Python37\lib\site-packages\matplotlib\axis.py", line 1576, in convert_units
74
+
75
+ f'units: {x!r}') from e
76
+
11
77
  matplotlib.units.ConversionError: Failed to convert value(s) to axis units: 8 13.32512.34513.89513.32514.37613.81412.49612.6...
12
78
 
13
79
  9 13.32512.34513.89513.32514.37613.81412.49612.6...
@@ -32,9 +98,7 @@
32
98
 
33
99
  Name: c40, Length: 20976, dtype: object
34
100
 
35
- ```
101
+
36
-
37
- エラーメッセージ
38
102
 
39
103
  ```
40
104
 
@@ -42,6 +106,8 @@
42
106
 
43
107
  ### 該当のソースコード
44
108
 
109
+ ```
110
+
45
111
  import numpy as np
46
112
 
47
113
  import matplotlib.pyplot as plt
@@ -56,8 +122,6 @@
56
122
 
57
123
 
58
124
 
59
-
60
-
61
125
  sns.set()
62
126
 
63
127
  sns.set_style('whitegrid')
@@ -122,6 +186,8 @@
122
186
 
123
187
 
124
188
 
189
+ ```
190
+
125
191
 
126
192
 
127
193
  ### 試したこと

1

打ち込んでいるすべてのコードを入力しました。

2020/04/27 01:19

投稿

kamijou
kamijou

スコア0

test CHANGED
File without changes
test CHANGED
@@ -41,6 +41,54 @@
41
41
 
42
42
 
43
43
  ### 該当のソースコード
44
+
45
+ import numpy as np
46
+
47
+ import matplotlib.pyplot as plt
48
+
49
+ import seaborn as sns
50
+
51
+ import pandas as pd
52
+
53
+ import os
54
+
55
+ import glob
56
+
57
+
58
+
59
+
60
+
61
+ sns.set()
62
+
63
+ sns.set_style('whitegrid')
64
+
65
+ sns.set_palette('gray')
66
+
67
+
68
+
69
+
70
+
71
+ col_names = [ 'c{0:02d}'.format(i) for i in range(49) ]
72
+
73
+ list = glob.glob('C:/Users/comp1/Desktop/python_lesson/A000005_csv_daily/202003/*.csv')
74
+
75
+ count=0
76
+
77
+ for row in list:
78
+
79
+ file = pd.read_csv(row,encoding="shift_jis", names=col_names)
80
+
81
+ if(count==0):
82
+
83
+ data = file
84
+
85
+ count = 1
86
+
87
+ else:
88
+
89
+ data = data + file
90
+
91
+ data.describe()
44
92
 
45
93
 
46
94