我真的心烦意乱.
我在XCode中创建了一个Localizable.strings文件,然后在其中创建了两种语言.
我用语言翻译填充了这些文件,进行了构建/清理,然后进行了新的构建,但是我的项目中没有出现Localization字符串的方法.如果我尝试类似的东西:
self.title = NSLocalizedString(@"HEAD", nil);
Run Code Online (Sandbox Code Playgroud)
只有"HEAD"而不是翻译显示在设备模拟器中.
这是我的项目层次结构:
这是英文本地化文件的内容:
有任何想法吗?
我在python pandas中有一个数据框,其中有几列来自CSV文件.
例如,data =:
Day P1S1 P1S2 P1S3 P2S1 P2S2 P2S3
1 1 2 2 3 1 2
2 2 2 3 5 4 2
Run Code Online (Sandbox Code Playgroud)
我需要的是得到名称以P1开头的所有列的总和......类似于带有通配符的P1*.
像下面这样的错误:
P1Sum =数据["P1*"]
有没有为什么要用熊猫做这个?
我有这个非常大的CSV文件(15 Gb),我需要读取大约100万条随机行.据我所知 - 并实现 - Python中的CSV实用程序只允许在文件中按顺序迭代.
将所有文件读入内存以使用一些随机选择是非常耗费内存的,并且通过所有文件并丢弃一些值并选择其他文件非常耗时,因此,无论如何都要从CSV文件中选择一些随机行并且只读那行?
我尝试没有成功:
import csv
with open('linear_e_LAN2A_F_0_435keV.csv') as file:
reader = csv.reader(file)
print reader[someRandomInteger]
Run Code Online (Sandbox Code Playgroud)
CSV文件的示例:
331.093,329.735
251.188,249.994
374.468,373.782
295.643,295.159
83.9058,0
380.709,116.221
352.238,351.891
183.809,182.615
257.277,201.302
61.4598,40.7106
Run Code Online (Sandbox Code Playgroud) 我已经看到一些报道PyCharm很慢但是我遇到的问题似乎与正常操作相比太慢了.
我在pandas数据帧中有大量数据(从440 MB csv文件中读取).
当我在PyCharm中使用ipython控制台时,每次我尝试处理这些数据时,让我们说,我写my_data.
它只是挂在那里大约30秒.
我真的不明白发生了什么,但似乎PyCharm正在通过所有数据找到一些智能自动完成(这是一个非常愚蠢的事情).
有什么方法可以停用这种行为?
我正在编写一个小的React Native应用程序,我正在尝试使用Flow,但我无法在任何地方获得适当的教程.
我一直收到错误:destructuring (Missing annotation)
关于({ station })
此代码的第1行:
const StationDetail = ({ station }) => {
const {
code,
label,
} = station;
Run Code Online (Sandbox Code Playgroud)
station
是一个JSON响应和code
和label
是strings
其内部JSON.
如何修复错误/警告?
我正在绞尽脑汁地试图弄清楚如何在Python的极坐标库中使用groupby
and 。apply
来自 Pandas,我使用的是:
def get_score(df):
return spearmanr(df["prediction"], df["target"]).correlation
correlations = df.groupby("era").apply(get_score)
Run Code Online (Sandbox Code Playgroud)
但在极地,这不起作用。
我尝试了几种方法,主要是:
correlations = df.groupby("era").apply(get_score)
Run Code Online (Sandbox Code Playgroud)
但这失败并出现错误消息:
'可以获取 DataFrame 属性'_df'。确保返回 DataFrame 对象。: PyErr { type: <class 'AttributeError'>, value: AttributeError("'numpy.float64' object has no attribute '_df'"),
有任何想法吗?
我有一个小数据框:
> testdfcompound_1
E1 E2
2012-05-17 01:00:58 20.94700 2.148299
2012-05-17 01:01:57 15.36875 2.199166
2012-05-17 01:02:56 19.05800 2.697803
2012-05-17 01:03:55 17.90500 2.358735
Run Code Online (Sandbox Code Playgroud)
我想只得到第一个元素的E1值,所以,20.94700.
但我无法找到一种方法来获得它.如果我尝试:testdfcompound_1$E1[1]
,我得到:
> testdfcompound_1$E1[1]
E1
2012-05-17 01:00:58 20.947
Run Code Online (Sandbox Code Playgroud)
我怎么才能得到20.947?
我搜索过但除了Visual Studio Code文档之外我找不到任何外部来源,只是遵循这些文档不允许在iOS或Android中调试React Native应用程序.
我一直收到错误消息(这个用于Android,对于iOS类似:
[vscode-react-native] [警告]无法在http:// localhost:8081/index.android.bundle?platform = android&dev = true&hot = false&minify = false导入脚本 .调试不起作用:尝试从应用程序内部重新加载JS,或重新连接VS Code调试器:path必须是一个字符串
我的launch.json
文件为:
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Android",
"program": "${workspaceRoot}/.vscode/launchReactNative.js",
"type": "reactnative",
"request": "launch",
"platform": "android",
"internalDebuggerPort": 9090,
"sourceMaps": true,
"outDir": "${workspaceRoot}/.vscode/.react"
},
{
"name": "Debug iOS",
"program": "${workspaceRoot}/.vscode/launchReactNative.js",
"type": "reactnative",
"request": "launch",
"platform": "ios",
"target": "iPhone 6s",
"internalDebuggerPort": 9090,
"sourceMaps": true,
"outDir": "${workspaceRoot}/.vscode/.react"
},
{
"name": "Attach to packager",
"program": "${workspaceRoot}/.vscode/launchReactNative.js",
"type": "reactnative",
"request": "attach", …
Run Code Online (Sandbox Code Playgroud) 首先,如果我没有使用正确的条款来提出这个问题,我很抱歉,但我没有达到术语.
我有一个在docker容器中运行的traefik,并使用PathPrefix选项提供一些服务,例如,www.myserver.com/wordpress重定向到运行wordpress的docker容器.
但是如何让它重定向到docker容器外?具体来说,如何让www.myserver.com重定向到我的机器中的端口8080,以便为我在主机操作系统(而不是在docker容器中)中运行的服务提供服务?
这是我的traefik.toml
:
logLevel = "DEBUG"
defaultEntryPoints = ["http", "https"]
[entryPoints]
[entryPoints.http]
address = ":80"
compress = false
[entryPoints.http.redirect]
entryPoint = "https"
[entryPoints.https]
address = ":443"
[entryPoints.https.tls]
[acme]
email = "mymail@mail.com"
storage = "acme.json"
entryPoint = "https"
onHostRule = true
#onDemand = true
[[acme.domains]]
main = "www.myserver.com"
[web]
address = ":8888"
[docker]
endpoint = "unix:///var/run/docker.sock"
domain = "www.myserver.com"
watch = true
exposedbydefault = false
Run Code Online (Sandbox Code Playgroud)
而我docker-compose.yml
的traefik容器:
version: "2"
services:
traefik:
image: traefik
network_mode: "host"
ports:
- …
Run Code Online (Sandbox Code Playgroud) 无论如何要在一个zip文件中创建一个可以在Python中查找的文件,而无需将其读入内存?
我尝试了明显的程序,但由于文件不可搜索,我收到错误:
In [74]: inputZipFile = zipfile.ZipFile("linear_g_LAN2A_F_3keV_1MeV_30_small.zip", 'r')
In [76]: inputCSVFile = inputZipFile.open(inputZipFile.namelist()[0], 'r')
In [77]: inputCSVFile
Out[77]: <zipfile.ZipExtFile at 0x102f5fad0>
In [78]: inputCSVFile.se
inputCSVFile.seek inputCSVFile.seekable
In [78]: inputCSVFile.seek(0)
---------------------------------------------------------------------------
UnsupportedOperation Traceback (most recent call last)
<ipython-input-78-f1f9795b3d55> in <module>()
----> 1 inputCSVFile.seek(0)
UnsupportedOperation: seek
Run Code Online (Sandbox Code Playgroud)