小编Zay*_*iwa的帖子

有没有办法将GIF添加到Markdown文件?

我想将这个gif添加到GitHub风格的markdown文件中.如果无法在GitHub中完成,是否可以在另一个版本的markdown中执行此操作?

markdown gif github-flavored-markdown

184
推荐指数
9
解决办法
9万
查看次数

在Python中将ISO 8601日期时间转换为秒

我想把两次加在一起.ISO 8601时间戳是'1984-06-02T19:05:00.000Z',我想将其转换为秒.我尝试使用Python模块iso8601,但它只是一个解析器.

有什么建议?

python time iso8601 rfc3339 python-2.7

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

如何删除vba中的特定列为excel

我试图删除vba中的多个列为excel.我从伊利诺伊统计分析中心下载有关药物逮捕的数据.http://www.icjia.org/public/sac/index.cfm?metasection=forms&metapage=rawMetadata&k=170

我要删除的每列都是彼此分开的3列.

例如:

亚当斯县伊利诺伊州尚佩恩县伊利诺伊州估计|百分比| 误差幅度|估算保证金| 估计|百分比|误差幅度百分比

d | E | F | G | H | I |Ĵ

我只想删除所有列的误差百分比

这是我的微观:

Sub deleteCol()
Columns("H,J").Delete

 End Sub
Run Code Online (Sandbox Code Playgroud)

我一直得到运行时'13:类型不匹配错误

有什么建议?

excel vba excel-vba

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

用d3.js v.4解析日期

我正在尝试通过基于Free Code Camp课程的第一个d3 迷你项目来学习如何使用d3.js进行编码.我想用这个json文件制作一个简单的条形图.我试图格式化文件中的日期.我已经尝试过查看d3.js API,但我仍然输了.对于我的任何建议,我将非常感激.这是我的代码

    // set the dimensions and margins of the graph
var margin = {top: 20, right: 20, bottom: 30, left: 40},
    width = 960 - margin.left - margin.right,
    height = 500 - margin.top - margin.bottom;

//then make a function to parse the time
var parseDate = d3.timeFormat("%Y-%m-%d");

// set the ranges
var x = d3.scaleBand().rangeRound([0, width]).padding(0.1);
var y = d3.scaleLinear().range([height, 0],0.5);

// append the svg object to the body of the …
Run Code Online (Sandbox Code Playgroud)

javascript json d3.js

6
推荐指数
1
解决办法
6042
查看次数

如何在 R 中将文本文件读取为一行

我正在尝试处理一个文本文件。总的来说,我有一个想要分析的语料库。为了使用 tm 包(R 中的文本挖掘包)创建一个语料库对象,我需要使该段落成为一个巨大的向量,以便能够正确阅读。

我有一个段落

          Commercial exploitation over the past two hundred years drove                  
          the great Mysticete whales to near extinction.  Variation in                   
          the sizes of populations prior to exploitation, minimal                        
          population size during exploitation and current population                     
          sizes permit analyses of the effects of differing levels of                    
          exploitation on species with different biogeographical                         
          distributions and life-history characteristics.
Run Code Online (Sandbox Code Playgroud)

我使用了 scan 和 readLine 方法,它处理文本的方式如下:

[28]“过去两百年的商业开发使
巨须鲸濒临灭绝”
[30]“开发前种群规模极小”

有没有办法摆脱换行符?或者将文本文件作为一个巨大的向量读取?

到目前为止,发布的所有解决方案都很棒,谢谢。

regex text text-processing r text-mining

4
推荐指数
1
解决办法
6521
查看次数

未捕获(承诺中)TypeError:d3.group 不是函数

我有一个口袋妖怪数据集,我想按类型对它们进行分组。所以会有一组类型为火、水、草等的神奇宝贝...并且d3.js有一个名为d3.group的函数。

在文档中,它将Groups指定的可迭代值声明为Map从 key 到 value 数组。我尝试遵循这个可观察的教程,但我不断收到错误Uncaught (in promise) TypeError: d3.group is not a function

我不知道我做错了什么。这是我的代码。bar_chart.js

drawBarChart = async() => {
  // 1. Access the data
  const dataset = await d3.csv('./pokemon.csv');
  console.log(dataset);

  pokemon = d3.group(dataset, d => d.type1)


  const metricAccesor = d => d.type1;

  // 2. create the dimensions
  const width = 600;
}

drawBarChart()
Run Code Online (Sandbox Code Playgroud)
<!DOCTYPE HTML>
<html>

<head>

</head>

<body>
  <div id="wrapper"></div>
  <script src="http://d3js.org/d3.v5.min.js"></script>
  <script src="./bar_chart.js"></script>

</body>

</html>
Run Code Online (Sandbox Code Playgroud)

来自 …

javascript d3.js

2
推荐指数
1
解决办法
4306
查看次数

用Pandas数据帧查找均方根误差

我试图从熊猫数据帧计算均方根误差.我已经检查了堆叠溢出的先前链接,例如python中的均方根错误 和scikit学习文档http://scikit-learn.org/stable/modules/generated/sklearn.metrics.mean_squared_error.html我希望有人出来会对我的错误有所了解.这是数据集.这是我的代码.

import pandas as pd
import numpy as np
sales = pd.read_csv("home_data.csv")

from sklearn.cross_validation import train_test_split
train_data,test_data = train_test_split(sales,train_size=0.8)

from sklearn.linear_model import LinearRegression
X = train_data[['sqft_living']]
y=train_data.price
#build the linear regression object
lm=LinearRegression()
# Train the model using the training sets
lm.fit(X,y)
#print the y intercept
print(lm.intercept_)
#print the coefficents
print(lm.coef_)

lm.predict(300)



from math import sqrt
from sklearn.metrics import mean_squared_error
y_true=train_data.price.loc[0:5,]
test_data=test_data[['price']].reset_index()
y_pred=test_data.price.loc[0:5,]
predicted =y_pred.as_matrix()
actual= y_true.as_matrix()
mean_squared_error(actual, predicted)
Run Code Online (Sandbox Code Playgroud)

编辑

所以这对我有用.我不得不将sqft生活的测试数据集值从行转换为列.

from sklearn.linear_model import …
Run Code Online (Sandbox Code Playgroud)

python pandas

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