问题:

我正在尝试做一些相当简单的事情,将大型csv文件读入pandas数据帧。

data = pandas.read_csv(filepath, header = 0, sep = DELIMITER,skiprows = 2)

代码要么因为MemoryError失败,要么永远不会完成。

任务管理器中的内存使用量停止在506 Mb,并且在5分钟没有变化且没有CPU活动的过程中我停止了它。

我使用的是pandas版本0.11.0。

我知道文件解析器曾经存在内存问题,但根据http://wesmckinney.com/blog/?p=543这应该已修复。

我试图读取的文件是366 Mb,如果我将文件剪切为短(25 Mb),则上面的代码可以正常工作。

还有一个弹出窗口告诉我它无法写入地址0x1e0baf93 …

堆栈跟踪:

Traceback (most recent call last):
  File "F:\QA ALM\Python\new WIM data\new WIM data\new_WIM_data.py", line 25, in
 <module>
    wimdata = pandas.read_csv(filepath, header = 0, sep = DELIMITER,skiprows = 2
)
  File "C:\Program Files\Python\Anaconda\lib\site-packages\pandas\io\parsers.py"
, line 401, in parser_f
    return _read(filepath_or_buffer, kwds)
  File "C:\Program Files\Python\Anaconda\lib\site-packages\pandas\io\parsers.py"
, line 216, in _read
    return parser.read()
  File "C:\Program Files\Python\Anaconda\lib\site-packages\pandas\io\parsers.py"
, line 643, in read
    df = DataFrame(col_dict, columns=columns, index=index)
  File "C:\Program Files\Python\Anaconda\lib\site-packages\pandas\core\frame.py"
, line 394, in __init__
    mgr = self._init_dict(data, index, columns, dtype=dtype)
  File "C:\Program Files\Python\Anaconda\lib\site-packages\pandas\core\frame.py"
, line 525, in _init_dict
    dtype=dtype)
  File "C:\Program Files\Python\Anaconda\lib\site-packages\pandas\core\frame.py"
, line 5338, in _arrays_to_mgr
    return create_block_manager_from_arrays(arrays, arr_names, axes)
  File "C:\Program Files\Python\Anaconda\lib\site-packages\pandas\core\internals
.py", line 1820, in create_block_manager_from_arrays
    blocks = form_blocks(arrays, names, axes)
  File "C:\Program Files\Python\Anaconda\lib\site-packages\pandas\core\internals
.py", line 1872, in form_blocks
    float_blocks = _multi_blockify(float_items, items)
  File "C:\Program Files\Python\Anaconda\lib\site-packages\pandas\core\internals
.py", line 1930, in _multi_blockify
    block_items, values = _stack_arrays(list(tup_block), ref_items, dtype)
  File "C:\Program Files\Python\Anaconda\lib\site-packages\pandas\core\internals
.py", line 1962, in _stack_arrays
    stacked = np.empty(shape, dtype=dtype)
MemoryError
Press any key to continue . . .

一点背景 – 我试图说服人们Python可以像R一样。为此我试图复制一个R脚本

data <- read.table(paste(INPUTDIR,config[i,]$TOEXTRACT,sep=""), HASHEADER, DELIMITER,skip=2,fill=TRUE)

R不仅能够很好地读取上面的文件,它甚至可以在for循环中读取其中的几个文件(然后对数据进行一些处理)。 如果Python对那个大小的文件有问题,我可能正在打一场失败的战斗……

I am trying to do something fairly simple, reading a large csv file into a pandas dataframe.The code either fails with a MemoryError , or just never finishes.Mem usage in the task manager stopped at 506 Mb and after 5 minutes of no change and no CPU activity in the process I stopped it.I am using pandas version 0.11.0.I am aware that there used to be a memory problem with the file parser, but according to http://wesmckinney.com/blog/?p=543 this should have been fixed.The file I am trying to read is 366 Mb, the code above works if I cut the file down to something short (25 Mb).It has also happened that I get a pop up telling me that it can’t write to address 0x1e0baf93…Stacktrace:A bit of background – I am trying to convince people that Python can do the same as R. For this I am trying to replicate an R script that doesR not only manages to read the above file just fine, it even reads several of these files in a for loop (and then does some stuff with the data).If Python does have a problem with files of that size I might be fighting a loosing battle…

问题:

我试图通过抓取网站来进行练习,但是我一直收到HTTP错误403(它认为我是机器人)吗?

这是我的代码:

#import requests
import urllib.request
from bs4 import BeautifulSoup
#from urllib import urlopen
import re

webpage = urllib.request.urlopen('http://www.cmegroup.com/trading/products/#sortField=oi&sortAsc=false&venues=3&page=1&cleared=1&group=1').read
findrows = re.compile('<tr class="- banding(?:On|Off)>(.*?)</tr>')
findlink = re.compile('<a href =">(.*)</a>')

row_array = re.findall(findrows, webpage)
links = re.finall(findlink, webpate)

print(len(row_array))

iterator = []

我得到的错误是:

 File "C:\Python33\lib\urllib\request.py", line 160, in urlopen
    return opener.open(url, data, timeout)
  File "C:\Python33\lib\urllib\request.py", line 479, in open
    response = meth(req, response)
  File "C:\Python33\lib\urllib\request.py", line 591, in http_response
    'http', request, response, code, msg, hdrs)
  File "C:\Python33\lib\urllib\request.py", line 517, in error
    return self._call_chain(*args)
  File "C:\Python33\lib\urllib\request.py", line 451, in _call_chain
    result = func(*args)
  File "C:\Python33\lib\urllib\request.py", line 599, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden

I was trying to scrap a website for practice, but I kept on getting the HTTP Error 403 (does it think I’m a bot)?Here is my code:The error I get is:

问题:

我安装了Xcode 6 GM种子,我正在尝试首次创建一个IPA文件。 存档成功后,当我单击“导出”按钮时,会出现一个窗口,显示:

无法找到或生成匹配的签名资产

Xcode试图找到或生成匹配的签名资产,但由于以下问题而未能这样做。

  • 您的帐户已拥有有效的iOS分发证书。

    如果您在其他Mac上拥有签名身份,则可以导入开发人员配置文件。 您也可以撤销当前证书并再次申请。

这是错误的屏幕截图:

在此输入图像描述

谁能告诉我怎么解决这个问题?

I installed the Xcode 6 GM seed, and I’m trying to create an IPA file for the first time.After archive success, when I click on the Export button, a window appears saying:Failed to locate or generate matching signing assetsXcode attempted to locate or generate matching signing assets and failed to do so because of the following issues.Your account already has a valid iOS Distribution certificate.If you have your signing identity on another Mac, you can import a developer profile.You can also revoke the current certificate and request one again.Here’s a screenshot of the error:Can anybody tell me how to solve this?

问题:

在我的脚本中,我尝试对第一个也是唯一的参数是否等于-v进行错误检查,但这是可选参数。 我使用if语句,但始终收到一元运算符预期的错误。

这是代码:

if [ $1 != -v ]; then
   echo "usage: $0 [-v]"
   exit
fi

编辑:

我应该更具体一些:上面脚本的这一部分正在检查可选参数,然后,如果未输入该参数,则它将运行程序的其余部分。

#!/bin/bash

if [ "$#" -gt "1" ]; then
   echo "usage: $0 [-v]"
   exit
fi

if [ "$1" != -v ]; then
   echo "usage: $0 [-v]"
   exit
fi

if [ "$1" = -v ]; then
   echo "`ps -ef | grep -v '\['`"
else
   echo "`ps -ef | grep '\[' | grep root`"
fi

In my script I am trying to error check if the first and only argument is equal to -v but it is an optional argument.I use an if statement but I keep getting the unary operator expected error.this is the code:Edit:I should be more specific: This part of the script above is checking an optional argument and then after, if the argument is not entered, it should run the rest of the program.

问题:

首先,我有一个装有8gb ram的盒子,所以我怀疑总内存是问题所在。 此应用程序在6gb或更少的计算机上运行良好。

我正在尝试在Eclipse的“运行配置”中的“ VM参数”下使用-Xmx3G保留3GB的空间。

每当我尝试保留超过1500mb的内存时,都会出现以下错误:“ VM初始化期间发生错误; -Xmx3G无法为对象堆保留足够的空间”

这里发生了什么?

First of all, I have a box with 8gb of ram, so I doubt total memory is the issue.This application is running fine on machines with 6gb or less.I am trying to reserve 3GB of space using -Xmx3G under “VM Arguments” in Run Configurations in Eclipse.Every time I try to reserve more than 1500mb, I get this error: “Error occurred during initialization of VM;Could not reserve enough space for object heap” using -Xmx3GWhat is going on here?