-
Notifications
You must be signed in to change notification settings - Fork 0
/
narabikae.py
56 lines (45 loc) · 1.6 KB
/
narabikae.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
import pandas as pd
def sorting(fi):
print("どれをソートしますか")
print("年[西暦]:1 ,月:2 ,市・区名:3")
cho1=input("人口総数[人]:4 ,男[人]:5 ,女[人]:6 ,世帯数[世帯]:7 ---->")
cho2=input("昇順:1 ,降順:2---->")
st=sorting2(fi,cho1,cho2)
return st
def sorting2(fi1,a,b):
if int(a)==1:
if int(b)==1:
st1=fi1.sort_values("年[西暦]",ascending=True)
else:
st1=fi1.sort_values("年[西暦]",ascending=False)
elif int(a)==2:
if int(b)==1:
st1=fi1.sort_values("月",ascending=True)
else:
st1=fi1.sort_values("月",ascending=False)
elif int(a)==3:
if int(b)==1:
st1=fi1.sort_values("市・区名",ascending=True)
else:
st1=fi1.sort_values("市・区名",ascending=False)
elif int(a)==4:
if int(b)==1:
st1=fi1.sort_values("人口総数[人]",ascending=True)
else:
st1=fi1.sort_values("人口総数[人]",ascending=False)
elif int(a)==5:
if int(b)==1:
st1=fi1.sort_values("男[人]",ascending=True)
else:
st1=fi1.sort_values("男[人]",ascending=False)
elif int(a)==6:
if int(b)==1:
st1=fi1.sort_values("女[人]",ascending=True)
else:
st1=fi1.sort_values("女[人]",ascending=False)
elif int(a)==7:
if int(b)==1:
st1=fi1.sort_values("世帯数[世帯]",ascending=True)
else:
st1=fi1.sort_values("世帯数[世帯]",ascending=False)
return st1