Python Forum

Full Version: upend data to dataframe
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I am new in python. Here i'm trying to run loop with data frame and doing sum and also trying to insert data to another dataframe but unable to insert data to another dataframe.

num=0
max_value=200000
for index, row in df1.iterrows():
if num > max_value:
break # break here
print(row['LOAN_AGREEMENT_NO'],row['CITY'],row['POS_AS_ON_DATE'])## i want to insert these three column in another dataframe.
## print( row)
num = num + row['POS_AS_ON_DATE']
Hi, welcome to Python and the forums!
Please put your code in Python code tags, you can find help here.
Also be more specific about the problem. If you get errors, put full error traceback message in error tags. If result is not as expected, show actual vs. desired result (you can use output tags).