问题
I uploaded data into MySQL and from there am using PyCharm and the plotly.offline library to pass in that data. My end goal is to create a scatter plot of the US with information on places of a certain latitude and longitude.
This is what I am trying to pass in:
checkin_data = pd.read_sql('select bus.business_id,
bus.latitude, bus.longitude,
sum(chk.checkin_count ) as checkin_count
from yelp.business bus
inner join yelp.checkin chk ON bus.business_id=chk.business_id
group by bus.business_id, bus.latitude, bus.longitude
order by bus.business_id
limit 10;', con=connection)
I have limited the amount of rows to pass to just 10.
My question is how would I pass in all 10 rows to analyze? I am able to pass in the first one but I do not know how to pass in the rest so that I have a scatter plot with 10 points on the US.
Thank you very much.
回答1:
What is "analyze"? The SELECT will return 10 rows of several columns each.
This will probably run faster:
select bus.business_id, bus.latitude, bus.longitude,
(
SELECT sum(checkin_count)
FROM yelp.checkin
WHERE business_id = chk.business
) AS checkin_count
from yelp.business bus
order by bus.business_id
limit 10;
来源:https://stackoverflow.com/questions/43749646/what-is-the-best-way-to-pass-data-into-pycharm