Google App Engine 500错误,但为什么?(Google App Engine 500 Error, but why?)
我在部署App Engine后遇到以下错误。 有人知道原因吗? 它有时会导致错误页面。 看起来simplejson是原因...
据http://code.google.com/status/appengine/ everyting应该相应地工作。
09-20 11:03AM 56.027 / 500 55902ms 240cpu_ms 0kb Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; nl-nl) AppleWebKit/533.18.1 (KHTML, like Gecko) Version/5.0.2 Safari/533.18.5,gzip(gfe) - - [20/Sep/2010:11:04:51 -0700] "GET / HTTP/1.1" 500 0 - "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; nl-nl) AppleWebKit/533.18.1 (KHTML, like Gecko) Version/5.0.2 Safari/533.18.5,gzip(gfe)" "" ms=55903 cpu_ms=240 api_cpu_ms=0 cpm_usd=0.006723 loading_request=1 pending_ms=1266 E 09-20 11:04AM 51.915 <class 'google.appengine.runtime.DeadlineExceededError'>: Traceback (most recent call last): File "/base/data/home/apps//7.344918194765199957/main.py", line 11, in <module> from logic import home, program, image, searchhandler, twitter, sitemap, feed File "/base/data/home/apps/7.344918194765199957/logic/home.py", line 14, in <module> from django.utils import simplejson File "/base/python_runtime/python_lib/versions/third_party/django-0.96/django/utils/simplejson/__init__.py", line 95, in <module> from django.utils.simplejson.decoder import JSONDecoder File "/base/python_runtime/python_lib/versions/third_party/django-0.96/django/utils/simplejson/decoder.py", line 6, in <module> from django.utils.simplejson.scanner import Scanner, pattern File "/base/python_runtime/python_lib/versions/third_party/django-0.96/django/utils/simplejson/scanner.py", line 3, in <module> """ I 09-20 11:04AM 51.924 This request caused a new process to be started for your application, and thus caused your application code to be loaded for the first time. This request may thus take longer and use more CPU than a typical request for your application.
这是页面显示的错误:
Error: Server Error The server encountered an error and could not complete your request. If the problem persists, please report your problem and mention this error message and the query that caused it.
看来这不是导致500错误的唯一错误。 因为大部分时间这似乎是原因:
09-20 11:37AM 18.229 /ohohcherso.html 500 11007ms 0cpu_ms 0kb Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.62 Safari/534.3,gzip(gfe),gzip(gfe) 94.209.194.233 - sammiestoel [20/Sep/2010:11:37:29 -0700] "GET /ohohcherso.html HTTP/1.1" 500 0 "http://www.tweetstream.nl/index.html" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.62 Safari/534.3,gzip(gfe),gzip(gfe)" "www.tweetstream.nl" ms=11008 cpu_ms=0 api_cpu_ms=0 cpm_usd=0.000148 W 09-20 11:37AM 29.237 Request was aborted after waiting too long to attempt to service your request. This may happen sporadically when the App Engine serving cluster is under unexpectedly high or uneven load. If you see this message frequently, please contact the App Engine team.
I am getting the following error in App Engine after I deployed it. Does anybody know the reason? It's causing an error page sometimes. It seems simplejson is the cause...
According to http://code.google.com/status/appengine/ everyting should be working accordingly.
09-20 11:03AM 56.027 / 500 55902ms 240cpu_ms 0kb Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; nl-nl) AppleWebKit/533.18.1 (KHTML, like Gecko) Version/5.0.2 Safari/533.18.5,gzip(gfe) - - [20/Sep/2010:11:04:51 -0700] "GET / HTTP/1.1" 500 0 - "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; nl-nl) AppleWebKit/533.18.1 (KHTML, like Gecko) Version/5.0.2 Safari/533.18.5,gzip(gfe)" "" ms=55903 cpu_ms=240 api_cpu_ms=0 cpm_usd=0.006723 loading_request=1 pending_ms=1266 E 09-20 11:04AM 51.915 <class 'google.appengine.runtime.DeadlineExceededError'>: Traceback (most recent call last): File "/base/data/home/apps//7.344918194765199957/main.py", line 11, in <module> from logic import home, program, image, searchhandler, twitter, sitemap, feed File "/base/data/home/apps/7.344918194765199957/logic/home.py", line 14, in <module> from django.utils import simplejson File "/base/python_runtime/python_lib/versions/third_party/django-0.96/django/utils/simplejson/__init__.py", line 95, in <module> from django.utils.simplejson.decoder import JSONDecoder File "/base/python_runtime/python_lib/versions/third_party/django-0.96/django/utils/simplejson/decoder.py", line 6, in <module> from django.utils.simplejson.scanner import Scanner, pattern File "/base/python_runtime/python_lib/versions/third_party/django-0.96/django/utils/simplejson/scanner.py", line 3, in <module> """ I 09-20 11:04AM 51.924 This request caused a new process to be started for your application, and thus caused your application code to be loaded for the first time. This request may thus take longer and use more CPU than a typical request for your application.
This is the error that the page will show:
Error: Server Error The server encountered an error and could not complete your request. If the problem persists, please report your problem and mention this error message and the query that caused it.
It seems this is not the only error causing the 500 error. Because most of the time this seems to be the cause:
09-20 11:37AM 18.229 /ohohcherso.html 500 11007ms 0cpu_ms 0kb Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.62 Safari/534.3,gzip(gfe),gzip(gfe) 94.209.194.233 - sammiestoel [20/Sep/2010:11:37:29 -0700] "GET /ohohcherso.html HTTP/1.1" 500 0 "http://www.tweetstream.nl/index.html" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.62 Safari/534.3,gzip(gfe),gzip(gfe)" "www.tweetstream.nl" ms=11008 cpu_ms=0 api_cpu_ms=0 cpm_usd=0.000148 W 09-20 11:37AM 29.237 Request was aborted after waiting too long to attempt to service your request. This may happen sporadically when the App Engine serving cluster is under unexpectedly high or uneven load. If you see this message frequently, please contact the App Engine team.
原文:https://stackoverflow.com/questions/3754243
最满意答案
如果除以系列(通过选择第二个数据帧的那一行),则熊猫将在第一个数据帧的列上对齐该系列,并给出所需的结果:
In [75]: df1 / df2.loc['q'] Out[75]: A B C D x inf 2 1.000000 2 y inf 6 2.333333 4 z inf 10 3.666667 6
如果您不知道/想要使用该行的名称,则可以使用
squeeze
将一列数据df1 / df2.squeeze()
转换为一系列:df1 / df2.squeeze()
(请参阅@EdChum的答案)。If you divide by a Series (by selecting that one row of the second dataframe), pandas will align this series on the columns of the first dataframe, giving the desired result:
In [75]: df1 / df2.loc['q'] Out[75]: A B C D x inf 2 1.000000 2 y inf 6 2.333333 4 z inf 10 3.666667 6
If you don't know/want to use the name of that one row, you can use
squeeze
to convert the one-column dataframe to a series:df1 / df2.squeeze()
(see answer of @EdChum).
相关问答
更多-
熊猫数据框迭代(Pandas Dataframe Iterating)[2023-05-31]
这是你在追求什么? 如果是这样,我可以在编辑中提供更详细的解释。 如果没有,请说明样本数据和所需结果。 import numpy as np import pandas as pd gene_master = pd.DataFrame(np.random.randn(5,4), index=list('ABCDE')) >>> gene_master 0 1 2 3 A 0.156349 1.230291 1.202380 -0. ... -
这是你的索引: Index([u'C/A', u' UNIT', u' SCP', u' DATEn', u' TIMEn', u' DESCn', u' ENTRIESn', u' EXITSn'], dtype='object') 请注意领先空间: u' ENTRIESn' 因此,改变: df['ENTRIESn_hourly'] = df.ENTRIESn.diff(1) 至: df['ENTRIESn_hourly'] = df[u' ENTRIESn'].diff(1) 或者, ...
-
你如何使用pandas.DataFrame列作为索引,列和值?(How do you use pandas.DataFrame columns as index, columns, and values?)[2023-10-31]
它(几乎)完全如你所说: df.pivot_table(index="a", columns="b", values="c", fill_value=0) 给 b cat dog rat a 1 1 2 6 2 2 0 0 3 4 1 0 HTH It's (almost) exactly as you phrase it: df.pivot_table(index="a", columns="b", values ... -
将一个熊猫数据框除以另一个 - 忽略索引但尊重列(Divide One Pandas Dataframe by Another - Ignore index but respect columns)[2023-06-21]
如果除以系列(通过选择第二个数据帧的那一行),则熊猫将在第一个数据帧的列上对齐该系列,并给出所需的结果: In [75]: df1 / df2.loc['q'] Out[75]: A B C D x inf 2 1.000000 2 y inf 6 2.333333 4 z inf 10 3.666667 6 如果您不知道/想要使用该行的名称,则可以使用squeeze将一列数据df1 / df2.squeeze()转换为一系列: df1 / df ... -
您可以使用any()分割器,对列指定axis=1 ,对行指定axis=0 : df.loc[(df != 0).any(axis=1),(df != 0).any(axis=0)] You can use any() slicer specifying axis=1 for columns and axis=0 for rows: df.loc[(df != 0).any(axis=1),(df != 0).any(axis=0)]
-
在熊猫数据框中的空白列(Blank column in Pandas Dataframe)[2024-03-20]
只需通过param for usecols : In [160]: t="""1;2;1;7.00; 2;32;2;0.76; 3;4;6;6.00; 4;1;5;4.00;""" import pandas as pd import io df = pd.read_csv(io.StringIO(t), sep=';', header=None, usecols=range(4)) df Out[160]: 0 1 2 3 0 1 2 1 7.00 1 2 32 2 ... -
从numpy使用lexsort可能是另一种方式,也可能更快一些: df.iloc[np.lexsort((df.index, df.A.values))] # Sort by A.values, then by index 结果: A 3 2 4 4 6 4 5 5 2 6 与timeit比较: %%timeit df.iloc[np.lexsort((df.index, df.A.values))] # Sort by A.values, then by index 结果: 1000 ...
-
根据您的更新,您需要具有两个索引列的pivot_table - v = df1.pivot_table( index=['Entity', 'Name'], columns='Date', values='Value' ).reset_index() v.index.name = v.columns.name = None v Entity Name 2018-01-31 2018-02-28 2018-03-31 0 111 ...
-
合并CSV使用熊猫数据框(Merging CSV Using pandas dataframe)[2024-04-17]
因为你在第二列有一个空格: 'Date', 'Date ' ^ 所以你需要在追加之前对列进行标准化 all_data = pd.DataFrame() for f in glob.glob("/Users/tcssig/Desktop/Files/*.csv"): df = pd.read_csv(f) df.columns = df.columns.str.strip() all_data = all_data.append(df,ignore_inde ... -
你想要满足什么条件? import pandas as pd df=pd.DataFrame([['This is also a interesting topic',2],[' the valley of flowers ...',1],['found in the hilly terrain',5], ['we must preserve it ',6]],columns=['description','count']) print(df) prin ...