Maximize Interest, My Money Grows Infinitely -
Chapter 466 - 272 Chen Cheng’s Choice_3
Chapter 466: Chapter 272 Chen Cheng’s Choice_3
import os
import re
import pandas as pd
...
date_pattern = r"\d{4}-\d{2}-\d{2}"# Date format
amount_pattern = r"\d+(\.\d+)?"# Amount format
location_pattern = r"阿苏港"# Location keyword
# Process text files
for filename in os.listdir(data_folder):
if filename.endswith(".txt"):
filepath = os.path.join(data_folder, filename)
try:
with open(filepath,’r’, encoding=’utf-8’) as f:
...
...
Chen Cheng wrote this piece of code that first defined regular expressions to match dates, amounts, and key locations, and then iterated over all Excel, CSV, and text files on the hard drive, pulled table data using the Pandas library, and used regular expressions to extract matching information.
All the extracted data were stored in a list, eventually converted into a DataFrame and saved to a CSV file, for later analysis.
Mei Xiang stood by, stunned, witnessing the fully engrossed Chen Cheng, as if she was watching a hacker code something remarkable.
Especially when Chen Cheng pressed the Enter key and the program began to run, with computer screen continuously scrolling through the code execution info—just like something out of a movie.
"Brother Cheng... you can do this too?" Mei Xiang covered her mouth in surprise.
In her eyes, Chen Cheng was like a mystery, always able to bring her unexpected surprises.
Chen Cheng leaned back in the chair, watching the rapidly scrolling code on the screen, and said in a relaxed tone, "It’s a breadwinner’s skill; used to earn a living with this craft."
He paused, then added, "But I’ve barely used it in over a month, feels a bit rusty."
Despite Chen Cheng claiming to be rusty, his fingers danced across the keyboard at a speed almost too fast to see.
Mei Xiang watched silently, her eyes filled with admiration and curiosity.
A few minutes later, the program finished running, and a file named "extracted_data.csv" appeared on the desktop.
"All done," Chen Cheng stretched out, "Let’s see if we’ve found anything."
He opened the file and began to meticulously analyze the extracted data.
Mei Xiang also leaned in to take a look at the dense numbers and text on the screen, looking perplexed.
"Brother Cheng, what are all these?" she asked.
"These are the mining, transportation, and sales records from your family’s mine over the past five years," explained Chen Cheng,
"The code I just wrote can automatically extract information related to Asu Port and any anomalies in these records."
He pointed to a line of data on the screen, "Look, this line shows, five years ago, there really was a batch of niobium ore mined, but the amount declared at customs and the amount you mined, there’s a discrepancy between these two."
Although Mei Xiang didn’t quite understand, she could make out the red numbers and the "-" sign.
"Hasn’t your father ever inquired about this mine?" Chen Cheng scrolled with the mouse.
Mei Xiang gripped Chen Cheng’s arm tightly, "My dad originally disagreed with venturing into overseas markets."
"But Uncle Watanabe and his team strongly advised, so he approved it eventually."
"And in the beginning, Brazil really did bring quite a lot of benefits to our family," Mei Xiang continued, "afterward, dad delegated his responsibilities and agreed to the arrangement."
She watched as more and more minus signs and red characters appeared on the screen, "You mean, our mine really has been secretly mined?"
Chen Cheng nodded gravely, Mei Xiang then asked, "How come it’s never been discovered over the years?"
"Don’t worry, we’ll go through it slowly."
Mei Xiang looked at that focused face, her heart pounding like mad; this was the man to whom she entrusted her life.
"Smooch~"
A crisp sound hit Chen Cheng’s ear, that belated welcome kiss, finally landing on his cheek.
"We’re doing serious work now; you’ll distract me like this," Chen Cheng turned his head and smiled.
"Uh-huh!"
Mei Xiang sat obediently, "Brother Cheng, I’ll just stay here with you, not going to disturb you."
If you find any errors (non-standard content, ads redirect, broken links, etc..), Please let us know so we can fix it as soon as possible.
Report