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
temp = {"123":{"H":1,"B":2}, | |
"456":{"H":1, "B":1} | |
} | |
data = {"event": [ | |
{ "id":"123", | |
"H":[{"name":3, | |
"label":2} | |
], | |
"B": [{"name":3, |
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
# defining our venn | |
v = venn2(subsets=(1,1,1), set_labels = ('Set A', 'Set B')) | |
# setting color of id 11 to purple | |
v.get_patch_by_id('11').set_color('purple') | |
#setting label of id 10 to New Text | |
v.get_label_by_id('10').set_text('New Text') | |
#plot title | |
plt.title('Customizing Venn using IDs') |
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
# defining our venn | |
venn2(subsets = (50, 20, 10), set_labels = ('Set A', 'Set B')); | |
# adding outline with width 3 and style dashed | |
venn2_circles(subsets = (50, 20, 10), linewidth=3, linestyle='dashed'); |
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
# defining a venn | |
venn2(subsets = (50, 20, 10), set_labels = ('Set A', 'Set B')); | |
# adding an outline | |
venn2_circles(subsets = (50, 20, 10)); |
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
# Taking a union of all sets | |
fire_safety= English | French | Math | Science | |
#Plotting alongside English and French | |
venn3([English, French, fire_safety], set_labels = ('English', 'French','Fire-Safety')) | |
plt.title('Relationship b/w students taking English, French and Fire-Safety Class\n') |
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
# using Science instead of Math | |
venn3([English, French, Science], set_labels = ('English Class', 'French Class','Science Class')) | |
# plot title | |
plt.title('Relationship b/w students taking English, French and Science Class\n') |
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
# use venn3 when you have three groups | |
venn3([English, French, Math], set_labels = ('English Class', 'French Class','Maths Class')) | |
# plot title | |
plt.title('Relationship b/w students taking English, French and MathsClass\n') |
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
# adding labels using set_labels parameter | |
venn2([English, French], set_labels = ('English Class', 'French Class')) | |
# plot title | |
plt.title('Relationship b/w students taking English and French Class\n') |
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 libraries | |
from matplotlib_venn import venn2, venn2_circles | |
from matplotlib_venn import venn3, venn3_circles | |
from matplotlib import pyplot as plt | |
# defining sets for both subjects | |
English = {'John', 'Amy', 'Howard', 'Lucy', 'Alice', 'George', 'Jacob', 'Rajesh', 'Remy', 'Tom'} | |
French = {'Arthur', 'Leonard', 'Karan', 'Debby', 'Bernadette', 'Alice', 'Ron', 'Penny', 'Sheldon', 'John'} |
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
# drop all rows with atleast one NaN | |
new_df = df.dropna(axis = 0, how ='any') | |
# drop all rows with all NaN | |
new_df = df.dropna(axis = 0, how ='all') | |
# drop all columns with atleast one NaN | |
new_df = df.dropna(axis = 1, how ='any') | |
# drop all columns with all NaN |
NewerOlder