Есть таблица в excel:
|Id |BSS |RP |BS_name |Project |BSC |TG |CELL |BS_number |RSITE |SW |Cell_ID |LAC |bsic |RBL2_1 |RBL2_2 |OETM_1 |OETM_2 |Reg |
|----- |--- |-- |------------ |------- |--- |-- |-------- |--------- |----- |-- |------- |----- |---- |------ |------ |------ |------ |--- |
|71274 |OK |OK |test0466-B |- |VLD321 |0 |test04661 |2628 |test0466 |- |04661 |52401 |30 |- |- |- |- |test |
|71275 |OK |OK |test0466-B |- |VLD321 |0 |test04662 |2628 |test0466 |- |04661 |52401 |30 |- |- |- |- |test |
|71276 | |OK |test0173-B-II |- | | |test01731 |0173 | | |1731 | |31 |- |- |- |- |test |
|71277 | |OK |test0173-B-II |- | | |test01732 |0173 | | |1731 | |31 |- |- |- |- |test |
|71278 | |OK |test0173-B-II |- | | |test01733 |0173 | | |1731 | |31 |- |- |- |- |test |
|71279 |OK |OK |test0466-B |- |VLD321 |0 |test04664 |2628 |test0466 |- |04661 |52401 |30 |- |- |- |- |test |
|71281 |OK |OK |test0466-B |- |VLD321 |0 |test04665 |2628 |test0466 |- |04661 |52401 |30 |- |- |- |- |test |
Мой код выводит таблицу с нужными мне для задачи столбцами:
| |BSS |Reg |BS_name |BSC |TG |CELL |RSITE |SW |LAC |RBL2_1 |RBL2_2 |OETM_1 |OETM_2 |
|-- |--- |---- |------------- |--- |--- |-------- |----- |--- |--- |----- |------ |------ |------ |
|25 |NaN |test |test0173-B-II |NaN |NaN |test01731 |NaN |NaN |NaN |NaN |NaN |NaN |NaN |
|26 |NaN |test |test0173-B-II |NaN |NaN |test01732 |NaN |NaN |NaN |NaN |NaN |NaN |NaN |
|27 |NaN |test |test0173-B-II |NaN |NaN |test01733 |NaN |NaN |NaN |NaN |NaN |NaN |NaN |
Но как мне реализовать таблицу со столбцами в следующем порядке и желательно без столбца BSS:
|Reg |BS_name |BSC |TG |RSITE |SW |LAC |RBL2_1 |RBL2_2 |OETM_1 |OETM_2 |CELL |
|---- |------------- |--- |--- |----- |--- |--- |------ |------ |------ |------ |--------- |
|test |test0173-B-II |NaN |NaN |NaN |NaN |NaN |NaN |NaN |NaN |NaN |test01731 |
|test |test0173-B-II |NaN |NaN |NaN |NaN |NaN |NaN |NaN |NaN |NaN |test01732 |
|test |test0173-B-II |NaN |NaN |NaN |NaN |NaN |NaN |NaN |NaN |NaN |test01733 |
Вот мой код:
import pandas as pd
#ces = pd.read_excel('Table\ Integrated\ Sites.xlsx')
cols = [2, 6, 8, 12, 13, 14, 16, 17, 20, 66, 67, 68, 69]
#print(ces.head())
ces = pd.read_excel('Table Integrated Sites.xlsx', skiprows=1, usecols=cols)
#print(ces)
table1 = ces[ces['BSS'].isna()]
print(table1)
filtercols = table1.reindex(columns=[0, 2, 1])
#print(filtercols)
в filtercols я пытался поменять местами столбец - не помогло.