栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

将Google Spreadsheet CSV导入Pandas数据框

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

将Google Spreadsheet CSV导入Pandas数据框

您可以

read_csv()
在一个
StringIO
对象上使用:

from io import BytesIOimport requestsr = requests.get('https://docs.google.com/spreadsheet/ccc?key=0Ak1ecr7i0wotdGJmTURJRnZLYlV3M2daNTRubTdwTXc&output=csv')data = r.contentIn [10]: df = pd.read_csv(BytesIO(data), index_col=0,parse_dates=['Quradate'])In [11]: df.head()Out[11]:Cityregion     Res_Comm         Dothan  South_Central-Montgomery-Auburn-Wiregrass-Dothan  Residential   10       Foley        South_Mobile-Baldwin  Residential   12  Birmingham      North_Central-Birmingham-Tuscaloosa-Anniston   Commercial   38       Brent      North_Central-Birmingham-Tuscaloosa-Anniston  Residential   44      Athens      North_Huntsville-Decatur-Florence  Residential          mkt_type Quradate  National_exp  Alabama_exp  Sales_exp   Rural 2010-01-15 00:00:00  2 2          3   10  Suburban_Urban 2010-01-15 00:00:00  4 4          4   12  Suburban_Urban 2010-01-15 00:00:00  2 2          3   38Rural 2010-01-15 00:00:00  3 3          3   44  Suburban_Urban 2010-01-15 00:00:00  4 5          4    Inventory_exp  Price_exp  Credit_exp  0    2          33  10   4          43  12   2          23  38   3          32  44   4          44


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/639363.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号