idxmax()在Pandas中使用该功能时,我一直收到此错误.
Traceback (most recent call last):
File "/Users/username/College/year-4/fyp-credit-card-fraud/code/main.py", line 20, in <module>
best_c_param = classify.print_kfold_scores(X_training_undersampled, y_training_undersampled)
File "/Users/username/College/year-4/fyp-credit-card-fraud/code/Classification.py", line 39, in print_kfold_scores
best_c_param = results.loc[results['Mean recall score'].idxmax()]['C_parameter']
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas/core/series.py", line 1369, in idxmax
i = nanops.nanargmax(_values_from_object(self), skipna=skipna)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pandas/core/nanops.py", line 74, in _f
raise TypeError(msg.format(name=f.__name__.replace('nan', '')))
TypeError: reduction operation 'argmax' not allowed for this dtype
Run Code Online (Sandbox Code Playgroud)
我正在使用的熊猫版本是 0.22.0
main.py
import ExploratoryDataAnalysis as eda
import Preprocessing as processor
import Classification as classify
import pandas as pd
data_path = '/Users/username/college/year-4/fyp-credit-card-fraud/data/'
if __name__ …Run Code Online (Sandbox Code Playgroud) 我已经使用自制软件在我的机器上安装了 XQuartz,然后我重新启动了我的机器,当我尝试在 RStudio 中使用 fix() 命令时,我收到以下错误
> College=read.csv("College.csv",header=T,na.strings ="?")
> fix(College)
Error in edit.data.frame(get(subx, envir = parent), title = subx, ...) :
X11 is not available
Run Code Online (Sandbox Code Playgroud)
当我尝试在终端中执行以下操作时,它按预期工作。如何在 RStudio 中使用相同的命令
我正在从一个基本的 Java 程序向一个 URL 发出 HTTP GET 请求,它恰好是"http://localhost:9992/users/john.doe@example.com":
public class Tester {
public static void main(String[] args) {
HttpRequester.doesUserExist("john.doe@example.com");
}
}
Run Code Online (Sandbox Code Playgroud)
的实现HTTPRequester是这样的:
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class HttpRequester {
private static HttpURLConnection connection = null;
public static boolean doesUserExist(final String email) {
final String targetUrl = Constants.URL_USER_SRVC + email;
System.out.println(targetUrl);
try {
URL url = new URL(targetUrl);
connection = (HttpURLConnection) url.openConnection();
System.out.println(connection.getRequestMethod());
connection.setRequestMethod("GET");
connection.setRequestProperty("Content-Type", "application/json");
connection.setUseCaches(false);
connection.setDoOutput(true); …Run Code Online (Sandbox Code Playgroud) java ×1
jax-rs ×1
jersey-2.0 ×1
macos ×1
macos-sierra ×1
pandas ×1
python ×1
python-3.x ×1
r ×1
rest ×1
rstudio ×1
web-services ×1