小编Ign*_*rre的帖子

重命名 pandas.concat 的 DataFrame 输出上的列

我正在通过连接其他 DataFrame 的列来构建一个新的 DataFrame,如下所示:

pairs = pd.concat([pos1['Close'], pos2['Close'], pos3['Close'], pos4['Close'], pos5['Close'],
                  pos6['Close'], pos7['Close']], axis=1)
Run Code Online (Sandbox Code Playgroud)

我想将pairsDataframe 的所有列重命名为基础证券的符号。在 concat 方法调用期间有没有办法做到这一点?通读这里方法的文档http://pandas.pydata.org/pandas-docs/version/0.17.0/generated/pandas.concat.html并没有给我一个可靠的答案。

python pandas

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

Unity - 如何在无限循环的情况下停止播放模式?

我只是犯了一个愚蠢的错误而且在里面void Update()而不是写if(var)我写的while(var)并且var从未修改过,所以我最终在我的内部编写了一个无限循环Update()

故事本身并不重要.重要的是我无法停止播放模式.实际上,在重新启动之前,我无法用Unity做任何其他事情.

所以我的问题是,有没有人知道如何优雅地停止Unity中的播放模式?是否有任何快捷方式或某些代码行强制超时?

我知道最好的方法是避免无限循环,但有些事情你可以做出愚蠢的错字.

额外注意:我一直在寻找这个问题的解决方案一段时间,遗憾的是没有成功.但是我找到了这个问题的副作用的解决方案.当你按下ctrl-alt-del时,你可以放弃你在场景中保存的所有东西(这可能是工作小时数).

所以当你点击播放时Unity会自动保存,并且Temp folder只要你在强制退出后没有再次运行Unity,场景备份就会出现.

c# unity-game-engine

8
推荐指数
4
解决办法
9309
查看次数

Android Wi-Fi Direct:onPeersAvailable

我正在开发一个基于WiFi Direct for Android的简单应用程序,它必须连接两个设备.为此,我需要调用funciónonPeersAvailable(myPeerListListener),但我不知道如何.

我的应用程序有这两个元素:

1主要活动:

package android.nacho.WifiDirect;



import android.net.wifi.p2p.WifiP2pManager.Channel;

import android.net.wifi.p2p.WifiP2pManager;
import android.os.Bundle;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class WifiDirect extends Activity {


    WifiP2pManager mManager;
    Channel mChannel;
    BroadcastReceiver mReceiver;

    IntentFilter mIntentFilter;

    @Override
    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_wifi_direct);


        //To register the BroadastReceiver
        mManager = (WifiP2pManager) getSystemService(Context.WIFI_P2P_SERVICE);
        mChannel =   mManager.initialize(this, getMainLooper(), null); //It was necessary to make a cast (Channel)
        mReceiver = new …
Run Code Online (Sandbox Code Playgroud)

android wifi-direct

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

Avro架构格式异常 - "记录"不是已定义的名称

我正在尝试使用这种avro shcema

{
  "namespace": "nothing",
  "name": "myAvroSchema",
  "type": "record",
  "fields": [
    {
      "name": "checkInCustomerReference",
      "type": "string"
    },
    {
      "name": "customerContacts",
      "type": "record",
      "fields": [
        {
          "name": "customerEmail",
          "type": "array",
          "items": {
            "type": "record",
            "name": "customerEmail_element",
            "fields": [
              {
                "name": "emailAddress",
                "type": "string"
              },
              {
                "name": "typeOfEmail",
                "type": "string"
              }
            ]
          }
        },
        {
          "name": "customerPhone",
          "type": "array",
          "items": {
            "type": "record",
            "name": "customerPhone_element",
            "fields": [
              {
                "name": "fullContactNumber",
                "type": "string"
              },
              {
                "name": "ISDCode",
                "type": "string"
              }
            ]
          }
        }, …
Run Code Online (Sandbox Code Playgroud)

json avro avro-tools

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

Android:扫描Wifi网络+可选列表

我正在尝试创建一个应用程序,让您扫描可用的无线网络,然后将它们显示在可选择的列表中.为此,我尝试使用此代码:

package android.nacho.WifiScan;

import java.util.List;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.AdapterView.OnItemClickListener;

public class WifiScan extends Activity {
    TextView mainText;
    WifiManager mainWifi;
    WifiReceiver receiverWifi;
    List<ScanResult> wifiList;
    StringBuilder sb = new StringBuilder();
    ListView listView = new ListView(this);
    ArrayAdapter<String> adapter;
    Context context = this;

    static String[] NETWORKS;

    public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.activity_wifi_scan);
       mainText = (TextView) …
Run Code Online (Sandbox Code Playgroud)

android wifi android-listview

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

Android:在AudioRecord中推荐bufferSizeInBytes值

我正在使用AudioRecord类,其构造函数是:

AudioRecord(
    int audioSource, int sampleRateInHz,
    int channelConfig, int audioFormat, int bufferSizeInBytes)
Run Code Online (Sandbox Code Playgroud)

在我在互联网上找到的所有(或大多数)教程和示例中,建议设置bufferSizeInBytes,如下所示:

bufferSizeInBytes= getMinBufferSize (
    int sampleRateInHz, int channelConfig, int audioFormat) 
Run Code Online (Sandbox Code Playgroud)

谁能告诉我原因?

我需要在记录的值和模式之间建立相关性.此模式比MinBufferSize长.那么,我应该将bufferSizeInBytes增加到我喜欢的值,还是会使AudioRecord的性能恶化.

android audiorecord

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

Hive查询停留在99%

我在Hive中使用左连接插入记录。当我设置限制1时,查询有效,但对于所有记录,查询卡住了99%的减少工作。

下面的查询作品

   Insert overwrite table tablename select a.id , b.name from a left join b on a.id = b.id limit 1; 
Run Code Online (Sandbox Code Playgroud)

但这不是

    Insert overwrite table tablename select table1.id , table2.name from table1 left join table2 on table1.id = table2.id;
Run Code Online (Sandbox Code Playgroud)

我增加了减速器的数量,但仍然无法正常工作。

sql hadoop hive mapreduce hiveql

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

W/DynamiteModule:未找到 com.google.android.gms.googlecertificates 的本地模块描述符类

由于未找到 com.google.android.gms.googlecertificates,无法定位地址。

10-15 14:07:42.801 7646-7770/com.magicstudio.geomaps W/DynamiteModule:未找到 com.google.android.gms.googlecertificates 的本地模块描述符类。10-15 14:07:42.847 7646-7770/com.magicstudio.geomaps W/zygote:由于无法识别的类加载器而跳过重复的类检查 10-15 14:07:42.857 7646-7770/com.magicstudio/IDynamomapstudio.考虑到本地模块 com.google.android.gms.googlecertificates:0 和远程模块 com.google.android.gms.googlecertificates:4 10-15 14:07:42.857 7646-7770/com.magicstudio.geomaps I/DynamiteModule: Selected com.google.android.gms.googlecertificates 的远程版本,版本 >= 4

Gradile 文件依赖项

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.androi`enter code here`d.support.enter code heretest.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })enter code here
    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.google.android.gms:play-services-maps:11.0.4'
    testCompile 'junit:junit:4.12'enter code here
}
Run Code Online (Sandbox Code Playgroud)

请帮忙解决这个问题

java android

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

使用Android Wi-Fi Direct API的问题:mChannel = mManager.initialize()

这是我的第一篇文章,希望能做得对.我正在尝试使用新的Android技术Wi-Fi Direct创建一个应用程序.为此,我按照您可以找到的教程:

http://developer.android.com/guide/topics/connectivity/wifip2p.html

它真的很有用,但是当我复制代码时,有一些错误.正好与第3步:

WifiP2pManager mManager;
Channel mChannel;
BroadcastReceiver mReceiver;
...
@Override
protected void onCreate(Bundle savedInstanceState){
    ...
    mManager = (WifiP2pManager) getSystemService(Context.WIFI_P2P_SERVICE);
    mChannel = mManager.initialize(this, getMainLooper(), null);
    mReceiver = new WiFiDirectBroadcastReceiver(manager, channel, this);
    ...
}
Run Code Online (Sandbox Code Playgroud)

错误在线:

mChannel = mManager.initialize(this, getMainLooper(), null);
Run Code Online (Sandbox Code Playgroud)

并且错误消息是:

类型不匹配:无法从WifiPesManager.Channel转换为Channel

建议是做一个像这样的演员:

mChannel =(Channel)mManager.initialize(this,getMainLooper(),null);

但是当我为此更改代码时,运行应用程序时出现另一个错误:

10-25 12:08:34.845:E/AndroidRuntime(26634):java.lang.RuntimeException:无法启动活动ComponentInfo {android.nacho.WifiDirect/android.nacho.WifiDirect.WifiDirect}:java.lang.ClassCastException:android .net.wifi.p2p.WifiP2pManager $ Channel无法强制转换为java.nio.channels.Channel

只需添加其余的代码就是它在教程中的显示方式,但以防万一我要添加Activity和Broadcast类:

1主要活动:

    package android.nacho.WifiDirect;

import java.nio.channels.Channel;

import android.net.wifi.p2p.WifiP2pManager;
import android.os.Bundle;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.IntentFilter;
import android.view.Menu;

public class WifiDirect extends Activity {


    WifiP2pManager mManager; …
Run Code Online (Sandbox Code Playgroud)

android channel wifi-direct

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

Spark Dataframe - 如何从一行中的列中获取特定字段

我有一个结构如下的数据框:

root
 |-- npaDetails: struct (nullable = true)
 |    |-- additionalInformation: struct (nullable = true)
 |    |-- npaStatus: struct (nullable = true)
 |    |-- npaDetails: struct (nullable = true)
 |-- npaHeaderData: struct (nullable = true)
 |    |-- npaNumber: string (nullable = true)
 |    |-- npaDownloadDate: string (nullable = true)     
 |    |-- npaDownloadTime: string (nullable = true) 
Run Code Online (Sandbox Code Playgroud)

我想npaNumber从数据框中的所有行中检索所有内容。

我的方法是遍历数据框中的所有行,为每一行提取npaHeaderData字段中列中存储的值npaNumber。所以我编写了以下几行代码:

parquetFileDF.foreach { newRow =>  

  //To retrieve the second column
  val column = newRow.get(1)

  //The following line …
Run Code Online (Sandbox Code Playgroud)

scala apache-spark apache-spark-sql

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