Warning: include(/home/www/tutorialcrawler/wp-content/cache/page_enhanced/tutorialcrawler.com/2021/04/79354): failed to open stream: No such file or directory in /home/www/tutorialcrawler/wp-includes/class-wp.php on line 756
Warning: include(): Failed opening '/home/www/tutorialcrawler/wp-content/cache/page_enhanced/tutorialcrawler.com/2021/04/79354' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /home/www/tutorialcrawler/wp-includes/class-wp.php on line 756 Python 3 - pandasデータフレームの反復-Pythonチュートリアル - Tutorial Crawler
<class 'str'> age ~~~~~~ <class 'pandas.core.series.Series'> Alice 20 Bob 32 Name: age, dtype: int64 ------ <class 'str'> state ~~~~~~ <class 'pandas.core.series.Series'> Alice NY Bob CA Name: state, dtype: object ------ <class 'str'> point ~~~~~~ <class 'pandas.core.series.Series'> Alice 64 Bob 92 Name: point, dtype: int64 ------
for index, row in df.iterrows(): print(type(index)) print(index) print('~~~~~~')
print(type(row)) print(row) print('------')
これにより、次のようになります。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
<class 'str'> Alice ~~~~~~ <class 'pandas.core.series.Series'> age 20 state NY point 64 Name: Alice, dtype: object ------ <class 'str'> Bob ~~~~~~ <class 'pandas.core.series.Series'> age 32 state CA point 92 Name: Bob, dtype: object ------