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

python iterrows

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 :: Reverse an string Using Loop in Python 
Python :: extracting values in pandas 
Python :: alternative to time.sleep() in python 
Python :: python file get text by regular expression 
Python :: declaring array size python 
Python :: pandas order dataframe by column of other dataframe 
Python :: for loop in range 
Python :: dockerize django 
Python :: matplotlib remove drawn text 
Python :: how to add values in python 
Python :: dictionary from two list 
Python :: python raise filenotfounderror 
Python :: python autoclick website 
Python :: python dynamic variable name 
Python :: python herencia 
Python :: get index of first true value numpy 
Python :: how to make code only go once python 
Python :: how to get all values from class in python 
Python :: zip() python 
Python :: unicodedata no accent 
Python :: padnas check if string is in list of strings 
Python :: gtk label set label 
Python :: How to Remove Items in a Set in Python Using the discard() Method 
Python :: ValueError: invalid literal for int() with base 10: ' pandas 
Python :: Label enconding code with sklearn 
Python :: elif python 
Python :: python types 
Python :: how to store the variable in dictionary 
Python :: NumPy invert Syntax 
Python :: access list index python 
ADD CONTENT
Topic
Content
Source link
Name
1+4 =