Pandas get dummies()

1 개요[ | ]

Pandas get_dummies()
import pandas as pd
import numpy as np

s = pd.Series(list('abca'))
s
pd.get_dummies(s)
s1 = ['a', 'b', np.nan]
s1
pd.get_dummies(s1)
pd.get_dummies(s1, dummy_na=True)
df = pd.DataFrame({'A': ['a', 'b', 'a'], 'B': ['b', 'a', 'c'],
                   'C': [1, 2, 3]})
df
pd.get_dummies(df, prefix=['col1', 'col2'])
pd.get_dummies(pd.Series(list('abcaa')))
pd.get_dummies(pd.Series(list('abcaa')), drop_first=True)
pd.get_dummies(pd.Series(list('abc')), dtype=float)

2 같이 보기[ | ]

3 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}