修复跑批脚本bug

This commit is contained in:
Jian Shen
2022-06-18 16:17:34 +08:00
parent c9aadb3344
commit 94a9b86517
2 changed files with 29 additions and 35 deletions
+15 -19
View File
@@ -39,7 +39,16 @@ def find_around_by_location(city, location):
"_source": ["name"],
"query": {
"bool": {
"must": [
"must_not": [
{
"term": {
"status": {
"value": 1
}
}
}
],
"filter": [
{"terms": {
"typecode": bank_typecode
}},
@@ -50,15 +59,6 @@ def find_around_by_location(city, location):
}
}
},
{
"term": {
"status": {
"value": 0
}
}
}
],
"filter": [
{
"geo_distance": {
"distance": 1000,
@@ -75,19 +75,15 @@ def find_around_by_location(city, location):
def deal(city, lng, lat):
if lng != None:
location = [lng, lat]
bank_df = find_around_by_location(city, location)
return bank_df
return []
location = [lng, lat]
bank_df = find_around_by_location(city, location)
return bank_df
for city_item in city_dict:
city = city_item['display']
log.info('开始查找' + city + '周边银行')
seaweed_df = pd.DataFrame(list(seaweed_conn.find({'city': city, 'cat': 'district', 'status': 0},
{'city': 1, 'region': 1, 'name': 1, 'lng': 1, 'lat': 1}).batch_size(
10000)))
seaweed_df = pd.DataFrame(list(seaweed_conn.find({'city': city, 'cat': 'district', 'status': 0, 'lng': {'$ne': None}},
{'city': 1, 'region': 1, 'name': 1, 'lng': 1, 'lat': 1}).batch_size(10000)))
seaweed_df['lng'] = seaweed_df['lng'] / 10 ** 10
seaweed_df['lat'] = seaweed_df['lat'] / 10 ** 10
seaweed_df['bank'] = seaweed_df.apply(lambda x: deal(x['city'], x['lng'], x['lat']), axis=1)
+14 -16
View File
@@ -31,7 +31,16 @@ def find_around_by_location(city, location):
"_source": ["name"],
"query": {
"bool": {
"must": [
"must_not": [
{
"term": {
"status": {
"value": 1
}
}
}
],
"filter": [
{"terms": {
"typecode": bus_typecode
}},
@@ -42,15 +51,6 @@ def find_around_by_location(city, location):
}
}
},
{
"term": {
"status": {
"value": 0
}
}
}
],
"filter": [
{
"geo_distance": {
"distance": 1000,
@@ -67,17 +67,15 @@ def find_around_by_location(city, location):
def deal(city, lng, lat):
if lng != None:
location = [lng, lat]
bus_df = find_around_by_location(city, location)
return bus_df
return []
location = [lng, lat]
bus_df = find_around_by_location(city, location)
return bus_df
for city_item in city_dict:
city = city_item['display']
log.info('开始查找' + city + '周边交通')
seaweed_df = pd.DataFrame(list(seaweed_conn.find({'city': city, 'cat': 'district', 'status': 0},
seaweed_df = pd.DataFrame(list(seaweed_conn.find({'city': city, 'cat': 'district', 'status': 0, 'lng': {'$ne': None}},
{'city': 1, 'region': 1, 'name': 1, 'lng': 1, 'lat': 1}).batch_size(
10000)))
seaweed_df['lng'] = seaweed_df['lng'] / 10 ** 10