回答編集履歴
1
追加の質問の回答
test
CHANGED
@@ -55,3 +55,55 @@
|
|
55
55
|
print(ndary) # [0.032158 0.025618 0.022093 0.020022 0.018834 0.018117 0.017508]
|
56
56
|
|
57
57
|
```
|
58
|
+
|
59
|
+
**追加の質問の回答です。**(2021/11/14 追記)
|
60
|
+
|
61
|
+
> 例えばtheta10 , phi0のような1つ下の行を抽出したいときはどの値を変えればよいのでしょうか。
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
skiprows に指定する lambda 式を変更します。
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
```Python
|
70
|
+
|
71
|
+
import numpy as np
|
72
|
+
|
73
|
+
import pandas as pd
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
df = pd.read_csv('filename', header=None, names=['LAI'], skiprows=lambda x: x%14 not in [0])
|
78
|
+
|
79
|
+
df1 = pd.read_csv('filename', sep='\s+', usecols=[0,1,2], skiprows=lambda x: (3 if x==1 else x%14) not in [3])
|
80
|
+
|
81
|
+
df2 = df1.set_index(df['LAI']).reset_index()
|
82
|
+
|
83
|
+
print(df2)
|
84
|
+
|
85
|
+
"""
|
86
|
+
|
87
|
+
LAI Theta Phi BRF(TOC)
|
88
|
+
|
89
|
+
0 LAI=1.0 10.0 0.0 0.034337
|
90
|
+
|
91
|
+
1 LAI=2.0 10.0 0.0 0.029666
|
92
|
+
|
93
|
+
2 LAI=3.0 10.0 0.0 0.027418
|
94
|
+
|
95
|
+
3 LAI=4.0 10.0 0.0 0.026134
|
96
|
+
|
97
|
+
4 LAI=5.0 10.0 0.0 0.025710
|
98
|
+
|
99
|
+
5 LAI=6.0 10.0 0.0 0.025634
|
100
|
+
|
101
|
+
6 LAI=7.0 10.0 0.0 0.025446
|
102
|
+
|
103
|
+
"""
|
104
|
+
|
105
|
+
ndary = np.array(df2['BRF(TOC)'])
|
106
|
+
|
107
|
+
print(ndary) # [0.034337 0.029666 0.027418 0.026134 0.02571 0.025634 0.025446]
|
108
|
+
|
109
|
+
```
|