Added code for a9.
This commit is contained in:
parent
cdbc080f14
commit
79dd2b3ec8
31
Codes/Code-A9 (Data visualisation-2).md
Normal file
31
Codes/Code-A9 (Data visualisation-2).md
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# A9 - Data visualization-2
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
1. Import library
|
||||||
|
|
||||||
|
```python3
|
||||||
|
import seaborn as sns
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Set dataframe
|
||||||
|
|
||||||
|
```python3
|
||||||
|
df = sns.load_dataset("titanic")
|
||||||
|
df
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Boxplot
|
||||||
|
|
||||||
|
```python3
|
||||||
|
sns.boxplot(x="sex", y="age", data=df, hue="survived")
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Catplot
|
||||||
|
|
||||||
|
```python3
|
||||||
|
sns.catplot(x="sex", hue="survived", data=df, kind="count")
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
Loading…
Reference in New Issue
Block a user