What is the best way to pass data into pycharm?

天大地大妈咪最大 提交于 2019-12-25 07:41:14

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!