F列(青色)の行に#があるときはいつでも、D列(黄色)から文字列を抽出する必要があります。私は初心者で、この仕事のためにパンダとopenpyxlを試していたが運がなかった。これはどちらが良いでしょうか?
保存しておきたいので、後でアクセスできます。
また、H列(緑色)から数値を抽出するのは正規表現で最も簡単でしょうか? Link to onedrive with the excel Python:別の列の値に基づいてセル値を抽出する
1
A
答えて
1
前に「=」記号を持って、その列を想定します
print (df.loc[df.Unit == '#', 'KPI name'])
0 UE-triggered ERAB Setup Attempts
1 UE-triggered ERAB Setup Successes
4 MME-initiated ERAB Setup Attempts
5 MME-initiated ERAB Setup Successes
8 eNodeB-initiated ERAB Release Attempts
9 eNodeB-initiated ERAB Drops
11 MME-initiated ERAB Release Attempts
12 MME-initiated ERAB Drops
14 ERAB Modification Attempts
15 ERAB Modification Successes
18 HO Preparation Attempts
19 HO Preparation Successes
22 HO Resource Allocation Attempts
23 HO Resource Allocation Successes
26 Handover Attempts
27 Handover Successes
33 EPS Attach Attempts
34 EPS Attach Successes
37 EPS Detach Attempts
38 EPS Detach Successes
40 EPS Authentication Attempts
41 EPS Authentication Successes
43 EPS Security Setup Attempts
44 EPS Security Setup Successes
46 EMM Identification Attepmt
47 EMM Identification Successes
49 EPS Service Request Attemptss
50 EPS Service Request Successes
52 Tracking Area Update Attempts
53 Tracking Area Update Successes
117 S6a Delete Subscriber Data Attempts
118 S6a Delete Subscriber Data Successes
120 S6a Notification Attempts
121 S6a Notification Successes
126 S11 Create Session Attempts
127 S11 Create Session Successes
130 S11 Create Bearer Attempts
131 S11 Create Bearer Successes
134 S11 Update Bearer Attempts
135 S11 Update Bearer Successes
138 Modify Access Bearer Attempts
139 Modify Access Bearer Successes
141 Release Access Bearer Attempts
142 Release Access Bearer Successes
144 Downlink Data Notification Attempts
145 Downlink Data Notification Successes
147 S11 Delete Session Attempts
148 S11 Delete Session Successes
150 S11 Delete Bearer Attempts
151 S11 Delete Bearer Successes
154 Suspend Attempts
155 Suspend Successes
157 Resume Attempts
158 Resume Successes
162 ME Identity Check Attempts
163 ME Identity Check Successes
168 Credit Control Initial Attempts
169 Credit Control Initial Successes
171 Credit Control Termination Attempts
172 Credit Control Termination Successes
Name: KPI name, dtype: object
:
boolean indexing
と
+0
これは完璧に動作します、ありがとう –
1
次のコードを使用して、列Fから必要な値を選択できます。 loc
で選択し
df = pd.read_excel('LTE_KPIs_up.xlsx', skiprows=7)
#print (df)
そして:また、私はHは、私はあなたがread_excel
最初が必要だと思うし、それが最初7
行はスキップする必要があると思われる数
import csv
import pandas as pd
from io import StringIO
Excelfile = "file.xlsx"
df = pd.read_excel(open(Excelfile,'rb'), sheetname='Sheet1')
selectstring = df['ColumnD'].where(df['ColumnF'] == '#')
print selectstring
print df['Columnh'].str.split('=')[1]
関連する問題
- 1. 別の列に基づいて列の値を抽出するpandasデータフレーム
- 2. パンダの行を列の値に基づいて抽出する
- 3. Excel:別のセルの値に基づいて値を返す式
- 4. VBAなしのセルの値に基づいてすべての行を抽出
- 5. Pythonの - 別の列の値に基づいてアクセス列
- 6. 別の列の値に基づいて値を取得する
- 7. 別のセル値に基づいて特定のセル値を取得
- 8. 別のセルの値に基づいてカスタムセルの値を変更する
- 9. データフレーム列の値を他の列に基づいて抽出しますか?
- 10. 別の列の値に基づいて行をピボットする列
- 11. Rプログラミング:条件に基づいて前の列の値を抽出する
- 12. 別のセルの値に基づいて列幅を変更します
- 13. セルの値に基づいて、対象シートの行をセルの値に基づいてコピーします。
- 14. 他のセルの値に基づいてセルをロックする
- 15. mysqlの別の列の値に基づいて列に値を設定する
- 16. セルの値に基づいてサブを呼び出す
- 17. セルに基づいて複数の値を比較する値
- 18. 値に基づいてGridviewセルの値を編集する(VB.NET)
- 19. 別の列に基づいて列値を取得する
- 20. EXCEL - セルの値に基づく配列
- 21. 別のセルの値に基づいてセルの色を変更します
- 22. 別の列の値に基づいて列に値を設定する(SQL)
- 23. 別の列の値に基づいて列の値をコピーする
- 24. 別の列の値に基づいて列の値を取得する
- 25. セルの値に基づいてセルを結合する
- 26. Jquery別のセルの状態に基づいてセル値を取得します。
- 27. 別の列、Matlabテーブルの値に基づいて列の値にアクセスする
- 28. 値に基づいてセルを移動
- 29. Google Apps Scriptのセル値に基づいて列をループし、別の列の値を変更します
- 30. セル値に基づいてシート配列を設定する
あなたのデータを処理する機会を与えるためのテキストではありません。 –
@NickilMaveliはブックへのリンクを追加しました。ヘッドアップのおかげで –