Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
Amazon-Selection-Data
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abel_cjy
Amazon-Selection-Data
Commits
33470420
Commit
33470420
authored
Mar 20, 2026
by
fangxingjun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
acf33c33
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletions
+2
-1
import_st_to_pg14.py
Pyspark_job/listen_program/import_st_to_pg14.py
+2
-1
No files found.
Pyspark_job/listen_program/import_st_to_pg14.py
View file @
33470420
...
@@ -21,7 +21,7 @@ class ImportStToPg14(object):
...
@@ -21,7 +21,7 @@ class ImportStToPg14(object):
self
.
df_st_month
=
pd
.
DataFrame
()
self
.
df_st_month
=
pd
.
DataFrame
()
self
.
df_st_month_state
=
pd
.
DataFrame
()
self
.
df_st_month_state
=
pd
.
DataFrame
()
self
.
df_save
=
pd
.
DataFrame
()
self
.
df_save
=
pd
.
DataFrame
()
self
.
fetch_year_month_by_week
()
# 如果传的date_type='week', 将date_info转换成月的值
#
self.fetch_year_month_by_week() # 如果传的date_type='week', 将date_info转换成月的值
self
.
year
,
self
.
month
=
self
.
date_info
.
split
(
"-"
)[
0
],
int
(
self
.
date_info
.
split
(
"-"
)[
1
])
self
.
year
,
self
.
month
=
self
.
date_info
.
split
(
"-"
)[
0
],
int
(
self
.
date_info
.
split
(
"-"
)[
1
])
def
fetch_year_month_by_week
(
self
):
def
fetch_year_month_by_week
(
self
):
...
@@ -31,6 +31,7 @@ class ImportStToPg14(object):
...
@@ -31,6 +31,7 @@ class ImportStToPg14(object):
self
.
date_info
=
list
(
df
.
year_month
)[
0
]
self
.
date_info
=
list
(
df
.
year_month
)[
0
]
def
read_data
(
self
):
def
read_data
(
self
):
self
.
fetch_year_month_by_week
()
# 如果传的date_type='week', 将date_info转换成月的值
# 1. 读取date_20_to_30表获取月份对应的周
# 1. 读取date_20_to_30表获取月份对应的周
sql_get_week
=
f
"select year_week, year, week from selection.date_20_to_30 WHERE `year_month`='{self.date_info}' and week_day=1"
sql_get_week
=
f
"select year_week, year, week from selection.date_20_to_30 WHERE `year_month`='{self.date_info}' and week_day=1"
df_week
=
pd
.
read_sql
(
sql_get_week
,
con
=
self
.
engine_mysql
)
df_week
=
pd
.
read_sql
(
sql_get_week
,
con
=
self
.
engine_mysql
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment