pandas(DataFrame,Series)のbool値をint型(0,1)に一瞬で変換する方法
1をかけるだけでOKです
sample.py
import pandas as pd
#DataFrame
df = pd.DataFrame({'A': (True, False, True),})
df * 1
#Series
sr = pd.Series([True, False, True],index=[0,1,2])
sr * 1
Author And Source
この問題について(pandas(DataFrame,Series)のbool値をint型(0,1)に一瞬で変換する方法), 我々は、より多くの情報をここで見つけました https://qiita.com/suk1yak1/items/3e80148470aa97a7f727著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .