回答編集履歴
2
edit
test
CHANGED
@@ -22,13 +22,25 @@
|
|
22
22
|
|
23
23
|
s = """
|
24
24
|
|
25
|
-
xxxx
|
25
|
+
xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx
|
26
|
+
|
27
|
+
0 xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx
|
28
|
+
|
29
|
+
1 xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx
|
30
|
+
|
31
|
+
2 xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx
|
32
|
+
|
33
|
+
3 xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx
|
34
|
+
|
35
|
+
4 xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx
|
36
|
+
|
37
|
+
5 xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx
|
26
38
|
|
27
39
|
"""
|
28
40
|
|
29
41
|
def SelectFFT():
|
30
42
|
|
31
|
-
df =
|
43
|
+
df = pd.read_csv( StringIO(s), sep=" ", skipinitialspace=True)
|
32
44
|
|
33
45
|
#print(df)
|
34
46
|
|
1
edit
test
CHANGED
@@ -1 +1,75 @@
|
|
1
1
|
入力したデータが文字列になっているためではないでしょうか。
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
---
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
一部https://teratail.com/questions/101388のcan110さんのコードを拝借して、input()関数を使ってみましたが、正しく出力されるようです。
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
```python
|
14
|
+
|
15
|
+
import numpy as np
|
16
|
+
|
17
|
+
import pandas as pd
|
18
|
+
|
19
|
+
from io import StringIO
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
s = """
|
24
|
+
|
25
|
+
xxxx
|
26
|
+
|
27
|
+
"""
|
28
|
+
|
29
|
+
def SelectFFT():
|
30
|
+
|
31
|
+
df = df = pd.read_csv( StringIO(s), sep=" ", skipinitialspace=True)
|
32
|
+
|
33
|
+
#print(df)
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
inp_Date = input("date:")
|
38
|
+
|
39
|
+
inp_ClockTime = input("time:")
|
40
|
+
|
41
|
+
inp_mt = int(input("motion:"))
|
42
|
+
|
43
|
+
inp_ss = int(input("speed:"))
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
df_sel = df.loc[(df['Date']==inp_Date) & (df['ClockTime']==inp_ClockTime) & (df['motion_type']==inp_mt) & (df['speed_setting']==inp_ss)]
|
48
|
+
|
49
|
+
print(df_sel[['Date','ClockTime','motion_type','speed_setting']])
|
50
|
+
|
51
|
+
#############################################
|
52
|
+
|
53
|
+
SelectFFT() #関数呼び出し
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
'''
|
58
|
+
|
59
|
+
date:2017/8/24
|
60
|
+
|
61
|
+
time:00:00.0
|
62
|
+
|
63
|
+
motion:0
|
64
|
+
|
65
|
+
speed:0
|
66
|
+
|
67
|
+
Date ClockTime motion_type speed_setting
|
68
|
+
|
69
|
+
0 2017/8/24 00:00.0 0 0
|
70
|
+
|
71
|
+
1 2017/8/24 00:00.0 0 0
|
72
|
+
|
73
|
+
'''
|
74
|
+
|
75
|
+
```
|