पंक्तियों के माध्यम से पांडा डेटाफ्रेम लूप

कोड उदाहरण

26
0

पंक्तियों के माध्यम से पांडा लूप

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

Output: 
   10 100
   11 110
   12 120
16
0

पर पुनरावृति पंक्तियों dataframe

df = pd.DataFrame([{'c1':10, 'c2':100}, {'c1':11,'c2':110}, {'c1':12,'c2':120}])
for index, row in df.iterrows():
    print(row['c1'], row['c2'])
1
0

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
0
0

पांडा पुनरावृति पंक्तियाँ

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'])
0
0

पांडा डेटाफ्रेम के माध्यम से पुनरावृति कैसे करें

# creating a list of dataframe columns 
columns = list(df) 
  
for i in columns: 
  
    # printing the third element of the column 
    print (df[i][2])

इसी तरह के पन्ने

उदाहरणों के साथ समान पृष्ठ

अन्य भाषाओं में

यह पृष्ठ अन्य भाषाओं में है

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................