You can try :
df = pd.get_dummies(df, columns=['type'])
More Related Contents:
- Dummy variables when not all categories are present
- Converting pandas column of comma-separated strings into dummy variables
- What are the pros and cons between get_dummies (Pandas) and OneHotEncoder (Scikit-learn)?
- Comparing two dataframes and getting the differences [duplicate]
- Pandas: How to easily share a sample dataframe using df.to_dict()?
- set difference for pandas
- Python pandas: how to specify data types when reading an Excel file?
- Pandas filling missing dates and values within group
- No module named ‘pandas._libs.tslibs.timedeltas’ in PyInstaller
- Use groupby in Pandas to count things in one column in comparison to another
- Reset color cycle in Matplotlib
- Parallelize apply after pandas groupby
- pandas unique values multiple columns
- Use index in pandas to plot data
- How to find which columns contain any NaN value in Pandas dataframe
- Populate a Pandas SparseDataFrame from a SciPy Sparse Matrix
- Python pandas: Keep selected column as DataFrame instead of Series
- Refresh Excel External Data with Python
- Pandas – dataframe groupby – how to get sum of multiple columns
- Python pandas / matplotlib annotating labels above bar chart columns [duplicate]
- How to upsert pandas DataFrame to PostgreSQL table?
- How to plot multiple dataframes to the same plot axes
- python pandas read_csv delimiter in column data
- Pandas Plotting Display all date values on x-axis (matplolib only displays few values) formatted as MMM-YYYY [duplicate]
- Week of a month pandas
- Add a sequence number to each element in a group using python
- How to iterate over columns of pandas dataframe to run regression
- Load CSV to Pandas MultiIndex DataFrame
- Python pandas – new column’s value if the item is in the list
- bash: Python import – Command not found for pandas