-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprueba1.py
57 lines (41 loc) · 869 Bytes
/
prueba1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#%%
import numpy as np
#%%
import pandas as pd
#%%
import altair as alt
# data import
#%%
dat = pd.read_csv("https://vincentarelbundock.github.io/Rdatasets/csv/AER/Guns.csv")
#%%
#---Create a varibale for the URL---
#%%
col_list = pd.DataFrame(dat)
#%%
#--------DROP Column ----- PRINT SOLO 5
#%%
##hola = col_list.drop("Unnamed: 0", axis=1)
#%%
#-------filter by criteria in a column
#esta = (col_list.query ('state == "Idaho"' ))
#%%
#--------Create new column named:ratios (divide one column / with another----)
otra = (col_list.assign(ratios = lambda x: x.violent / x.murder))
print (otra)
#%%
#todo = (hola
# .query ("state == 'Idaho'")
# .filter(['violent','murder','state','year'])
#)
#%%
#chart =( alt.Chart(todo)
# .encode(
# x ='murder',
# y ='state',)
# .mark_line()
# )
# %%
#print (chart)
# %%
#hola
#hola2