小编phe*_*per的帖子

双重百分号(%%)是什么意思?

%%R中使用的双倍百分比()是多少?

从使用它开始,它看起来好像它将前面的数字除以它后面的数字尽可能多的次数并返回左边的值.那是对的吗?

出于好奇,这什么时候有用?

r

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

Docker postgres 无效的主检查点记录

我一直在尝试让 postgres 在 Docker(在 Windows 上)中运行并具有持久数据存储,并认为我终于拥有了它,但现在当我尝试启动容器时,出现以下错误:

LOG:  invalid primary checkpoint record
LOG:  invalid secondary checkpoint record
PANIC:  could not locate a valid checkpoint record
Run Code Online (Sandbox Code Playgroud)

这是我启动并运行容器的开始:

docker volume create ct_data
docker run --name postgres_ct -v ct_data:/var/lib/postgresql/data -p 5432:5432 postgres
Run Code Online (Sandbox Code Playgroud)

然后,我使用 pgAdmin 连接到它,创建一个新表,并使用恢复选项导入 postgres 转储文件。数据加载没有问题。我使用与上面相同的卷启动了第二个容器,但使用不同的名称和端口号来测试它,并且我能够连接,因此我将其关闭。

Now, an hour later, I found my original container was stopped automatically so I tried to start it back up and got the errors above. This is my first attempt at using Docker, so it's very possible …

postgresql docker

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

从 Seaborn 调色板中选择颜色

我有五个并排的分布图,通常使用颜色属性更改每个分布图的颜色。但是,现在我想使用 Seaborn 的 husl 调色板,但我不知道如何将调色板中的颜色应用到每个图表。我很确定这只是我忽略的事情。

# sns.set(style="white", palette="muted", color_codes=True)  
sns.set(style="white", palette="husl", color_codes=True)

# Set up the matplotlib figure
f, axes = plt.subplots(ncols=5, figsize=(15, 4))
sns.despine(left=True)

# Rating of 1
sns.distplot(df1[df1['rating']==1]['cost'], kde=False, color='c', ax=axes[0], axlabel="Rating of 1")

# Rating of 2
sns.distplot(df1[df1['rating']==2]['cost'], kde=False, color='k', ax=axes[1], axlabel='Rating of 2')

# Rating of 3
sns.distplot(df1[df1['rating']==3]['cost'], kde=False, color="g", ax=axes[2], axlabel='Rating of 3')

# Rating of 4
sns.distplot(df1[df1['rating']==4]['cost'], kde=False, color="m", ax=axes[3], axlabel='Rating of 4')

# Rating of 5
sns.distplot(df1[df1['rating']==5]['cost'], kde=False, color="b", ax=axes[4], axlabel='Rating of 5') …
Run Code Online (Sandbox Code Playgroud)

python seaborn

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

Django 使用 AJAX 在模板中渲染模板

我的网站目前在自己的页面上呈现表单。我正在尝试让它们在我的主页上的侧边栏 div 标签内呈现。但是,我不知道如何塑造 JavaScript 和/或视图,因此我取回表单模板的 HTML 并将其插入到 div 标记中。

更新

我在控制台中收到以下错误:GET http://127.0.0.1:8000/new_trend/ 500 (Internal Server Error)

HTML(主页上的标签,我想将表单模板注入其中):

<div id="sidebar">
</div>
Run Code Online (Sandbox Code Playgroud)

JavaScript

$(function() {
    $("#new-trend").click(function(event){
        alert("User wants to add new trend");  //this works
        $.ajax({
            type: "GET",
            url:"/new_trend/",
            success: function(data) {
                $('#sidebar').html(data),
                openNav()
            } 
        })
    });
});
Run Code Online (Sandbox Code Playgroud)

看法

def new_indicator(request):
    # if this is a POST request we need to process the form data
    if request.method == "POST":
        # create a form instance and populate it with data from the …
Run Code Online (Sandbox Code Playgroud)

javascript django django-forms

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

拆分具有多行文本和单行文本的行

我试图找出如何分割数据行,其中行中的列B,C,D包含多行而其他行则不包含.如果我将这些列复制到新工作表中,手动插入行,然后运行下面的宏(这只是用于A列),我已经想出如何分割多行单元格,但是我在编码时丢失了休息.

这是数据的样子: 在此输入图像描述

因此对于第2行,我需要将它分成6行(单元格B2中的每一行一行),A2中的单元格A2中的文本:A8.我还需要将列C和D拆分为B,然后列E:CP与列A相同.

这是我在B,C,D列中拆分单元格的代码:

Dim iPtr As Integer
Dim iBreak As Integer
Dim myVar As Integer
Dim strTemp As String
Dim iRow As Integer
iRow = 0
For iPtr = 1 To Cells(Rows.Count, col).End(xlUp).Row
    strTemp = Cells(iPtr1, 1)
    iBreak = InStr(strTemp, vbLf)
    Range("C1").Value = iBreak
        Do Until iBreak = 0
        If Len(Trim(Left(strTemp, iBreak - 1))) > 0 Then
            iRow = iRow + 1
            Cells(iRow, 2) = Left(strTemp, iBreak - 1)
        End If
        strTemp = Mid(strTemp, iBreak + 1) …
Run Code Online (Sandbox Code Playgroud)

excel vba split excel-vba

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

R regex remove apostrophes NOT between letters

I'm able to remove all punctuation from a string while keeping apostrophes, but I'm now stuck on how to remove any apostrophes that are not between two letters.

str1 <- "I don't know 'how' to remove these ' things"
Run Code Online (Sandbox Code Playgroud)

Should look like this:

"I don't know how to remove these things"
Run Code Online (Sandbox Code Playgroud)

regex r

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

如何创建此VBA结构?

在过去的几个月里,我一直在学习如何在VBA中使用类,但是在找出将多个类项组合在一起的正确方法时遇到了问题,因此我可以迭代它们.

例如,我有一个名为clsPersons的类,其属性包括Name,Gender,DOB和Age(Today - DOB).如果我只想添加一个人,我会做以下事情:

    Dim Person As New clsPersons

    Person.Name = "Phillip"
    Person.Gener = "Male"
    Person.DOB = "#1/1/2000"
    ' Person.Age would be automatically set by adding Person.DOB
Run Code Online (Sandbox Code Playgroud)

但是,如果我有一个包含每个人的电子表格并决定创建一个报告,其中每个人的名字都以字母"P"开头,那么我首先需要使用某种对象(集合,字典等)以及类似的东西填写它:

    Dim Person As New clsPersons
    Dim lastRow As Long
    lastRow = Sheet1.Cells(Rows.Count, 1).Row(xlUp).End

    For i = 1 To lastRow
        If Worksheet.Function.Left(Sheet1.Cells(i, 1), 1) = "P" Then
            Person.Name = Sheet1.Cells(i, 1)
            Person.Gener = Sheet1.Cells(i, 2)
            Person.DOB = Sheet1.Cells(i, 3)
        End If
    Next i
Run Code Online (Sandbox Code Playgroud)

在填充之后,我希望能够循环通过它来拉出项目,所以这样的事情:

    For Each Person In objPeople
        Sheet2.Cells(i, 1) = Person.Name …
Run Code Online (Sandbox Code Playgroud)

excel vba excel-vba

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

标签 统计

excel ×2

excel-vba ×2

r ×2

vba ×2

django ×1

django-forms ×1

docker ×1

javascript ×1

postgresql ×1

python ×1

regex ×1

seaborn ×1

split ×1