Я новичок в Pandas. Я хочу управлять файлом Excel и подсчитывать метры строительного объекта (RR) с размером (D) = 160 мм.
Как я могу получить значение в столбце «IsoOf» из ячейки в ряд for-slice? df.loc[filt, 'IsoOf'].isnull().values.any() == True
Пример
Строка с 'RR' '160' = Индекс 10,12,15,65,70 .... df.loc[filt, 'IsoOf'].isnull().values.any() == True
проверяет каждый раз, когда строка 0 имеет нет ссылки на Slice
где я могу установить элемент «row» (i) для проверки правильного индекса? Как df.loc[filt, 'IsoOf'].isnull(row).values.any() == True
import pandas as pd
#Open file
df = pd.read_excel('Bauteilliste.xlsx')
#edit the display option on jupyter
pd.set_option('display.max_columns', 75)
#Filter
# 1. All Elements with the ID R-R and the dimension 160mm
filt = (df['KZ'] == 'R-R') & (df['D'] == 160)
#Calculate all the Elements
counter_lenght = 0 #Without Isaltion
counter_lenght_isolation = 0 #With Isaltion
#Get throut every row with the filt filter
for row in df.loc[filt, 'L']:
#PROBLEM: What todo taht .isnull get the same id from row??
#It only checks the value .isnull from the index 0 not from the filtered row
if df.loc[filt, 'IsoOf'].isnull().values.any() == True:
counter_lenght = counter_lenght + row
else:
counter_lenght_isolation = counter_lenght_isolation + row
print(counter_lenght)
print(counter_lenght_isolation)
Скриншот из Jupyter Notebook