Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
ffm-baseline
Project
Project
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ML
ffm-baseline
Commits
dfcbc1e8
Commit
dfcbc1e8
authored
May 13, 2020
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
1e176da9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
1 deletion
+30
-1
ai_test.py
ai_test.py
+1
-1
near_city.py
near_city.py
+29
-0
No files found.
ai_test.py
View file @
dfcbc1e8
...
...
@@ -9,7 +9,7 @@ header_dict={'Content-Type': 'application/x-www-form-urlencoded'}
param_dict
=
{}
param_dict
[
"method"
]
=
"doris/search/spu_sku"
param_detail
=
{
"device_id"
:
"3ab"
,
"size"
:
10
,
"offset"
:
0
,
"user_city_tag_id"
:
328
,
"recall_type"
:
3
,
"unit_id"
:
4
,
"promotion_ids"
:[
312
,
334
,
345
],
"sort_params"
:{
"lat"
:
0
,
"lng"
:
0
}}
param_detail
=
{
"device_id"
:
"3ab"
,
"size"
:
10
,
"offset"
:
0
,
"user_city_tag_id"
:
328
,
"recall_type"
:
1
,
"unit_id"
:
2102
,
"promotion_ids"
:[
],
"sort_params"
:{
"lat"
:
0
,
"lng"
:
0
}}
# param_detail = {"device_id":"3ab", "size":10,"offset":0,"user_city_tag_id":328,"recall_type":2,"unit_id":4,"sort_params":{"lat":0,"lng":0},"tag_ids":[993, 971, 5, 41, 759, 47, 821]}
# param_detail = {'unit_id': 1, 'device_id': "863791030182646", 'offset': 0, 'size': 10,
...
...
near_city.py
0 → 100644
View file @
dfcbc1e8
import
pymysql
import
pandas
as
pd
def
get_city
():
sql
=
"select c.name,d.name as near_city_name from (select a.city_id,a.nearby_city_id,b.name "
\
"from api_transaction_nearby_city_to_es a left join api_city b on a.city_id = b.id) c "
\
"left join api_city d on c.nearby_city_id = d.id"
db
=
pymysql
.
connect
(
host
=
'172.16.30.141'
,
port
=
3306
,
user
=
'work'
,
passwd
=
'BJQaT9VzDcuPBqkd'
,
db
=
'zhengxing'
)
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql
)
result
=
cursor
.
fetchall
()
df
=
pd
.
DataFrame
(
list
(
result
))
name
=
[
"name"
,
"near_city_name"
]
df
=
df
.
rename
(
columns
=
dict
(
zip
(
list
(
range
(
len
(
name
))),
name
)))
print
(
df
.
head
(
6
))
print
(
df
.
shape
)
data
.
to_csv
(
'/tmp/city.csv'
,
index
=
False
)
if
__name__
==
"__main__"
:
get_city
()
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