Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

df.iterrows()

import pandas as pd
import numpy as np

df = pd.DataFrame({'c1': [10, 11, 12], 'c2': [100, 110, 120]})

for index, row in df.iterrows():
    print(row['c1'], row['c2'])
Comment

iterrows pd

for index, row in df.iterrows():
    print(row['c1'], row['c2'])
Comment

iterrows pandas

>>> df = pd.DataFrame([[1, 1.5]], columns=['int', 'float'])
>>> row = next(df.iterrows())[1]
>>> row
int      1.0
float    1.5
Name: 0, dtype: float64
>>> print(row['int'].dtype)
float64
>>> print(df['int'].dtype)
int64
Comment

PREVIOUS NEXT
Code Example
Python :: python remove first element of list 
Python :: panda loc conditional 
Python :: pandas print column by index 
Python :: Display shape of the DataFrame 
Python :: root = tk() python 3 
Python :: state capitals python 
Python :: program python factorial 
Python :: random forest classifier classification report 
Python :: how to check if element is in list python 
Python :: recall at k calculate python 
Python :: image resolution extracting python 
Python :: set method in python 
Python :: getting python class from string 
Python :: print in pytest python 
Python :: {} string python 
Python :: change creation date filesystem py 
Python :: python digit string 
Python :: python class set dict method 
Python :: pandas convert column to title case 
Python :: plotly facet_grid python 
Python :: @foreach 1 numper 
Python :: python using end keyword 
Python :: pubg python 
Python :: Set path for another directory 
Python :: python observer pattern 
Python :: how to create an app under a folder in django 
Python :: key pressed pygame 
Python :: insert-cells-in-empty-pandas-dataframe 
Python :: boto3 python s3 
Python :: python conditionals 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =