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 :: elif in django template 
Python :: pandas convert entries in a column after groupby in list 
Python :: append item to array python 
Python :: create a python3 virtual environment 
Python :: how to save a python object in a file 
Python :: python extend list 
Python :: rotate 90 degrees clockwise counter python 
Python :: python convert string to lowercase 
Python :: list of numbers 
Python :: how to make a list string in python 
Python :: python kivy 
Python :: pandas merge on index column 
Python :: python replace character in string 
Python :: add css in html django 
Python :: pandas strip whitespace 
Python :: python file open 
Python :: xor string python 
Python :: python comment multiple lines 
Python :: how to add two matrix using function in python 
Python :: Make a basic pygame window 
Python :: python nested list comprehension 
Python :: onehotencoder pyspark 
Python :: time py 
Python :: pil crop image 
Python :: pandas replace values based on condition 
Python :: Converting objects into integers 
Python :: biggest of 3 numbers in python 
Python :: cmd check if python is installed 
Python :: python string slicing 
Python :: remove index in pd.read 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =