a1 = [row[:-1] for index,row in house1.总价.iteritems()] a2 = [row[:-2] for index,row in house1.建筑面积.iteritems()]
时间: 2024-03-22 11:26:47 浏览: 104
楼房总建筑面积计算公式1
These lines of code are using list comprehension to extract certain values from a pandas dataframe called "house1".
The first line of code is creating a list called "a1" that contains the "总价" column from the "house1" dataframe. However, it is only taking the values up to the second to last character in each row (using the "[:-1]" slice notation).
The second line of code is creating a list called "a2" that contains the "建筑面积" column from the "house1" dataframe. However, it is only taking the values up to the third to last character in each row (using the "[:-2]" slice notation).
阅读全文