- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsample.py
More file actions
Latest commit
36 lines (33 loc) · 1.02 KB
/
Copy pathsample.py
File metadata and controls
36 lines (33 loc) · 1.02 KB
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
importpandasaspd
importnumpyasnp
# 1. BIKIN DATA BERANTAKAN (BEFORE)
data_kotor= {
"Order ID": ["1001", "1002", "1002", np.nan, "1004"],
"Customer Email": [
" JOHN@example.com ",
"jane@EXAMPLE.com",
"jane@example.com",
"ghost@mail.com",
" ALICE@mail.com",
],
"Order Date": [
"12/31/2025",
"2026-01-15",
"15-Jan-26",
"02/02/2026",
"March 5th 2026",
],
"Total Sales": ["150.50", "200", "200", "99.99", "USD 350"],
}
df_kotor=pd.DataFrame(data_kotor)
df_kotor.to_excel("1_data_before.xlsx", index=False)
# 2. BIKIN DATA RAPI (AFTER)
data_rapi= {
"Order ID": ["1001", "1002", "1004"],
"Customer Email": ["john@example.com", "jane@example.com", "alice@mail.com"],
"Order Date": ["2025-12-31", "2026-01-15", "2026-03-05"],
"Total Sales": [150.50, 200.00, 350.00],
}
df_rapi=pd.DataFrame(data_rapi)
df_rapi.to_excel("2_data_after.xlsx", index=False)
print("File Excel berhasil dibuat! Silakan buka dan screenshot.")