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 :: urllib urlretrieve python 3 
Python :: get ContentType with django get_model 
Python :: convert array to set python 
Python :: assign multiple variables in python 
Python :: install python 3.7 centos 
Python :: python merge lists 
Python :: add row in db django 
Python :: make a window tkinter 
Python :: list with numbers between 2 values by 
Python :: python subprocess stdout to dev null 
Python :: templateDoesNotExist Django 
Python :: square all elements in list python 
Python :: smtplib send pdf 
Python :: python talib install windows 
Python :: python coding questions and answers 
Python :: extract data from json file python 
Python :: how to make a separate list of values from dictionaries in python 
Python :: numpy add new column 
Python :: tkinter entry 
Python :: reading json file in python 
Python :: select multiple columns in pandas dataframe 
Python :: python how to count number of true 
Python :: python time library 
Python :: how to run cmd line commands in python 
Python :: python for loop with increment 
Python :: django models.py convert DateTimeField to DateField 
Python :: remove empty space from string python 
Python :: convert a dictionary to pandas dataframe 
Python :: how to import sin and cos in python 
Python :: pattern in python 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =