Taiyi dev

Notes

Dataframe

import pandas as pd

DataFrame

pd.DataFrame(columns=['A', 'B', 'C'], data=[[1, 2, 3],[4, 5, 6]])

	A	B	C
0	1	2	3
1	4	5	6

drop_duplicates

df = pd.DataFrame(columns=['A', 'B', 'C'], data=[[1,2,3],[1,2,3],[4,5,6]])
	A	B	C
0	1	2	3
1	1	2	3
2	4	5	6

df.drop_duplicates()
	A	B	C
0	1	2	3
2	4	5	6

Search/Filter

包含關鍵字

keywords = ['A','B','C']
pattern = '|'.join(keywords)
df_keywords = df[df['Column'].str.contains(pattern, case=False, na=False)]
;