修复跑批脚本bug
This commit is contained in:
@@ -39,7 +39,16 @@ def find_around_by_location(city, location):
|
|||||||
"_source": ["name"],
|
"_source": ["name"],
|
||||||
"query": {
|
"query": {
|
||||||
"bool": {
|
"bool": {
|
||||||
"must": [
|
"must_not": [
|
||||||
|
{
|
||||||
|
"term": {
|
||||||
|
"status": {
|
||||||
|
"value": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"filter": [
|
||||||
{"terms": {
|
{"terms": {
|
||||||
"typecode": bank_typecode
|
"typecode": bank_typecode
|
||||||
}},
|
}},
|
||||||
@@ -50,15 +59,6 @@ def find_around_by_location(city, location):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"term": {
|
|
||||||
"status": {
|
|
||||||
"value": 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"filter": [
|
|
||||||
{
|
{
|
||||||
"geo_distance": {
|
"geo_distance": {
|
||||||
"distance": 1000,
|
"distance": 1000,
|
||||||
@@ -75,19 +75,15 @@ def find_around_by_location(city, location):
|
|||||||
|
|
||||||
|
|
||||||
def deal(city, lng, lat):
|
def deal(city, lng, lat):
|
||||||
if lng != None:
|
location = [lng, lat]
|
||||||
location = [lng, lat]
|
bank_df = find_around_by_location(city, location)
|
||||||
bank_df = find_around_by_location(city, location)
|
return bank_df
|
||||||
return bank_df
|
|
||||||
return []
|
|
||||||
|
|
||||||
|
|
||||||
for city_item in city_dict:
|
for city_item in city_dict:
|
||||||
city = city_item['display']
|
city = city_item['display']
|
||||||
log.info('开始查找' + city + '周边银行')
|
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(
|
{'city': 1, 'region': 1, 'name': 1, 'lng': 1, 'lat': 1}).batch_size(10000)))
|
||||||
10000)))
|
|
||||||
seaweed_df['lng'] = seaweed_df['lng'] / 10 ** 10
|
seaweed_df['lng'] = seaweed_df['lng'] / 10 ** 10
|
||||||
seaweed_df['lat'] = seaweed_df['lat'] / 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)
|
seaweed_df['bank'] = seaweed_df.apply(lambda x: deal(x['city'], x['lng'], x['lat']), axis=1)
|
||||||
|
|||||||
@@ -31,7 +31,16 @@ def find_around_by_location(city, location):
|
|||||||
"_source": ["name"],
|
"_source": ["name"],
|
||||||
"query": {
|
"query": {
|
||||||
"bool": {
|
"bool": {
|
||||||
"must": [
|
"must_not": [
|
||||||
|
{
|
||||||
|
"term": {
|
||||||
|
"status": {
|
||||||
|
"value": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"filter": [
|
||||||
{"terms": {
|
{"terms": {
|
||||||
"typecode": bus_typecode
|
"typecode": bus_typecode
|
||||||
}},
|
}},
|
||||||
@@ -42,15 +51,6 @@ def find_around_by_location(city, location):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"term": {
|
|
||||||
"status": {
|
|
||||||
"value": 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"filter": [
|
|
||||||
{
|
{
|
||||||
"geo_distance": {
|
"geo_distance": {
|
||||||
"distance": 1000,
|
"distance": 1000,
|
||||||
@@ -67,17 +67,15 @@ def find_around_by_location(city, location):
|
|||||||
|
|
||||||
|
|
||||||
def deal(city, lng, lat):
|
def deal(city, lng, lat):
|
||||||
if lng != None:
|
location = [lng, lat]
|
||||||
location = [lng, lat]
|
bus_df = find_around_by_location(city, location)
|
||||||
bus_df = find_around_by_location(city, location)
|
return bus_df
|
||||||
return bus_df
|
|
||||||
return []
|
|
||||||
|
|
||||||
|
|
||||||
for city_item in city_dict:
|
for city_item in city_dict:
|
||||||
city = city_item['display']
|
city = city_item['display']
|
||||||
log.info('开始查找' + city + '周边交通')
|
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(
|
{'city': 1, 'region': 1, 'name': 1, 'lng': 1, 'lat': 1}).batch_size(
|
||||||
10000)))
|
10000)))
|
||||||
seaweed_df['lng'] = seaweed_df['lng'] / 10 ** 10
|
seaweed_df['lng'] = seaweed_df['lng'] / 10 ** 10
|
||||||
|
|||||||
Reference in New Issue
Block a user