小编Jim*_*mys的帖子

使用python进行线性回归的简单预测

data2 = pd.DataFrame(data1['kwh'])
data2
                          kwh
date    
2012-04-12 14:56:50     1.256400
2012-04-12 15:11:55     1.430750
2012-04-12 15:27:01     1.369910
2012-04-12 15:42:06     1.359350
2012-04-12 15:57:10     1.305680
2012-04-12 16:12:10     1.287750
2012-04-12 16:27:14     1.245970
2012-04-12 16:42:19     1.282280
2012-04-12 16:57:24     1.365710
2012-04-12 17:12:28     1.320130
2012-04-12 17:27:33     1.354890
2012-04-12 17:42:37     1.343680
2012-04-12 17:57:41     1.314220
2012-04-12 18:12:44     1.311970
2012-04-12 18:27:46     1.338980
2012-04-12 18:42:51     1.357370
2012-04-12 18:57:54     1.328700
2012-04-12 19:12:58     1.308200
2012-04-12 19:28:01     1.341770
2012-04-12 19:43:04     1.278350
2012-04-12 19:58:07     1.253170
2012-04-12 20:13:10     1.420670
2012-04-12 20:28:15     1.292740
2012-04-12 20:43:15     1.322840
2012-04-12 20:58:18 …
Run Code Online (Sandbox Code Playgroud)

python linear-regression scikit-learn

6
推荐指数
2
解决办法
2万
查看次数

使用 Python 获取 Youtube 数据

我正在尝试学习如何分析网络上可用的社交媒体数据,我从 Youtube 开始。

from apiclient.errors import HttpError
from outh2client.tools import argparser
from apiclient.discovery import build
import pandas as pd
DEVELOPER_KEY = "AIzaSyB_F1mCrDydEbGUosnZES-NW-mg1CaOyjI"
YOUTUBE_API_SERVICE_NAME = "youtube"
YOUTUBE_API_VERSION = "v3"
argparser.add_argument("--q", help="Search term", default="apple product")
argparser.add_argument("--max-results", help="Max results", default=50)
args = argparser.parse_args()
options = args
Run Code Online (Sandbox Code Playgroud)

我收到这个错误。

ArgumentError                             Traceback (most recent call last)
<ipython-input-37-ebbf58549b73> in <module>()
----> 1 argparser.add_argument("--q", help="Search term", default="apple product")
  2 argparser.add_argument("--max-results", help="Max results", default=50)
  3 args = argparser.parse_args()
  4 options = args

/usr/lib/python2.7/argparse.py in add_argument(self, *args, **kwargs)
   1306                 raise …
Run Code Online (Sandbox Code Playgroud)

python youtube argparse

5
推荐指数
1
解决办法
1080
查看次数

如何转换一年中的天数(365)?

我有一个数据框,我想要一个函数来转换一年中的天数(365).提前致谢.!!

d_w_data.drop(['kwh',  'time', 'month', 'dewptm', 'hum', 'wspdm', 'cos(hour)', 'sin(hour)'], inplace=True, axis=1)

d_w_data

Out[55]:
                         year   day     index1                aptemp      maptemp      mtempm   tempm      hour_to_rad
2012-04-12 14:00:00     2012    12  2012-04-12 14:00:00     17.574044   14.483582   15.508494   19.510000   3.665191
2012-04-12 15:00:00     2012    12  2012-04-12 15:00:00     17.769016   14.483582   15.508494   19.600000   3.926991
2012-04-12 16:00:00     2012    12  2012-04-12 16:00:00     17.532051   14.483582   15.508494   19.488235   4.188790
2012-04-12 17:00:00     2012    12  2012-04-12 17:00:00     16.975478   14.483582   15.508494   18.690000   4.450590
2012-04-12 18:00:00     2012    12  2012-04-12 18:00:00     16.520319   14.483582   15.508494   17.566667   4.712389
2012-04-12 19:00:00     2012    12 …
Run Code Online (Sandbox Code Playgroud)

python datetime date pandas

-3
推荐指数
1
解决办法
992
查看次数