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 :: sklearn.utils.bunch to dataframe 
Python :: how to move a column to the beginning in dataframe 
Python :: how to sort by length python 
Python :: plot keras model 
Python :: view whole dataset in python 
Python :: clear terminal in python 
Python :: python removing from string 
Python :: python split string in pairs 
Python :: python random hex color 
Python :: python gui programming using pyqt5 
Python :: animations text terminal python 
Python :: random letter generator python 
Python :: spammer bot python 
Python :: python setter getter deleter 
Python :: install pytorch 
Python :: installing django 
Python :: python count number of zeros in a column 
Python :: plt vertical line 
Python :: import mean absolute error 
Python :: get last column pandas 
Python :: python 2.7 ubuntu command 
Python :: what is self in programming 
Python :: pandas uniqe values in the columns 
Python :: random character generator python 
Python :: convert pdf to base64 python 
Python :: python format 2 digits 
Python :: flask boiler plate 
Python :: how to plot kmeans graph 
Python :: thousands separator python 
Python :: get max float value python 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =