回答編集履歴

2

修正

2020/03/29 00:52

投稿

8524ba23
8524ba23

スコア38341

test CHANGED
@@ -66,19 +66,19 @@
66
66
 
67
67
 
68
68
 
69
- X = a[:,0]
69
+ y = a[:,0]
70
70
 
71
- y = a[:,1:]
71
+ X = a[:,1:]
72
72
 
73
73
 
74
74
 
75
- print(X)
75
+ print(y)
76
76
 
77
77
  # [1 4 7]
78
78
 
79
79
 
80
80
 
81
- print(y)
81
+ print(X)
82
82
 
83
83
  #[[2 3]
84
84
 

1

追記

2020/03/29 00:52

投稿

8524ba23
8524ba23

スコア38341

test CHANGED
@@ -33,3 +33,57 @@
33
33
  print(X)# [10 2]
34
34
 
35
35
  ```
36
+
37
+
38
+
39
+ 追記
40
+
41
+ -----
42
+
43
+ ```Python
44
+
45
+ import pandas as pd
46
+
47
+ from io import StringIO
48
+
49
+
50
+
51
+ # テストデータ
52
+
53
+ df = pd.read_csv(StringIO('1,2,3\n4,5,6\n7,8,9'),header=None)
54
+
55
+
56
+
57
+ a = df.values
58
+
59
+ print(a)
60
+
61
+ #[[1 2 3]
62
+
63
+ # [4 5 6]
64
+
65
+ # [7 8 9]]
66
+
67
+
68
+
69
+ X = a[:,0]
70
+
71
+ y = a[:,1:]
72
+
73
+
74
+
75
+ print(X)
76
+
77
+ # [1 4 7]
78
+
79
+
80
+
81
+ print(y)
82
+
83
+ #[[2 3]
84
+
85
+ # [5 6]
86
+
87
+ # [8 9]]
88
+
89
+ ```