eserver.com/files/ustk/coupon-o-sib/1c.pdf#1$180.00 **** 1st Entertainment - Katie.eserver.com/files/ustk/coupon-o-sib/1c.pdf#1$180.00 **** 1st Entertainment - Katie.eserver.com/files/ustk/coupon-o-sib/1c.pdf#1$180.00 **** 1st Entertainment - Katie *************** 1st Entertainment - Katie ********* Promotion code expires. For more promotions go to
I am trying to remove all rows from a dataframe in which the price is greater than 80. My code is as follows:
newdf=olddf.drop(olddf.loc[olddf['price']>80])
However, I am receiving this error:
"IndexError: too many indices for array"
Can someone point out what I'm doing wrong?
A:
I assume that the price is stored as a string and the format of the price is like this
'$180.00'
Then you can use below code to compare the value of price with 80
olddf = pd.read_excel(xlxlsx_file_name)
# remove price and replace it with a new column
newdf = olddf.drop(olddf['price'],1)
if(80>newdf['price'].str.replace('$','').astype(float).sum()):
print "The value of price of the record is greater than 80"
Output
The value of price of the record is greater than 80
Q:
Python - Calling different functions with the same arguments in a loop
I have this code:
for x in range(len(x)):
def callfunc(t, a, b):
if x == 0:
func1(t, a, b)
else:
func2(t, a, b)
callfunc(t1, a
Related links:
Comments