【发布时间】:2022-12-01 16:13:20
【问题描述】:
def my_function(df_1) :
df_1 = df_1.filter[['col_1','col_2','col_3']]
# Keeping only those records where col_1 == 'success'
df_1 = df_1[df_1['col_1'] == 'success']
# Checking if the df_1 shape is 0
if df_1.shape[0]==0:
print('No records found')
break
#further program
如果如果条件满足。
这是这样做的正确方法吗..?因为 break 只结束循环,但我想结束函数
【问题讨论】:
-
你想一起停止功能或程序吗?