Last active
May 30, 2021 15:17
-
-
Save lauramsfernandes/fa89721224efe03fcfb71272dd36a768 to your computer and use it in GitHub Desktop.
DataFrame Categorial Variables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
index = ['Ana', 'Ian', 'Eva', 'Dan', 'Kim'] | |
columns = ['Color', 'Type', 'Length'] | |
ana = ['Brown', 'Straight', 'Short'] | |
ian = ['Black', 'Wavy', 'Short'] | |
eva = ['Red', 'Curly', 'Long'] | |
dan = ['Blonde', 'Straight', 'Long'] | |
kim = ['Brown', 'Curly', 'Medium'] | |
data = [ana, ian, eva, dan, kim] | |
df = pd.DataFrame(data, index=index, columns=columns) | |
df |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment