[英]Using Pandas, i'm trying to keep on my DataFrame only 100 rows of each value of my column "neighborhood"
[英]I m trying to do an apply function over a column in my dataframe, trying to divide the entries in the column Price by 100 using lambda function
car_data["Price"]= car_data["Price"].apply(lambda x:x/100))
^
SyntaxError: invalid syntax
car_data["Price"].dtype
dtype('int32')
這是什么錯誤
任何語法錯誤都意味着您在使用編程語言編寫時必須遵守的基本規則有問題。 在您的情況下,第一個語句的末尾有很多括號。 所以應該是:
car_data["Price"]= car_data["Price"].apply(lambda x:x/100)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.