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