将数据传递到pycharm的最佳方法是什么? [英] What is the best way to pass data into pycharm?

查看:301
本文介绍了将数据传递到pycharm的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将数据上传到MySQL,然后从那里使用PyCharm和plotly.offline库传递该数据.我的最终目标是创建一个美国散点图,其中包含有关特定纬度和经度位置的信息.

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)

我将要传递的行数限制为只有10行.

I have limited the amount of rows to pass to just 10.

我的问题是我将如何通过所有10行进行分析?我能够通过第一个,但我不知道如何通过其余的,因此我在美国有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.

非常感谢您.

推荐答案

什么是分析"? SELECT将返回10行,每行几列.

What is "analyze"? The SELECT will return 10 rows of several columns each.

这可能会运行得更快:

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;

这篇关于将数据传递到pycharm的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆