python3よく書くコード集

背景
投稿者投稿者まっつんいいね0お気に入り登録
プレイ回数187難易度(3.6) 722打 長文
順位 名前 スコア 称号 打鍵/秒 正誤率 時間(秒) 打鍵数 ミス 問題 日付
1 ss 2255 F++ 2.3 94.6% 231.0 552 31 30 2024/04/27

問題文

ふりがな非表示 ふりがな表示

(kmeans)

Kmeans

(init)

init

(n_clusters)

n_clusters

(y_pred)

y_pred

(fit(x))

fit(X)

(predict)

predict

(import numpy as np)

import numpy as np

(value_counts())

value_counts()

(import pandas as pd)

import pandas as pd

(import matplotlib.pyplot as plt)

import matplotlib.pyplot as plt

(import seaborn as sns)

import seaborn as sns

(factories.head())

factories.head()

(warehouses.head())

warehouses.head()

(cost.head())

cost.head()

(trans.head())

trans.head()

(join_data = pd.dataframe())

join_data = pd.DataFrame()

(join_data.drop(”fcid”,axis=1))

join_data.drop("FCID", axis=1)

(join_data.drop(”whid”,axis=1))

join_data.drop("WHID",axis=1)

(join_data.loc[join_data[”wh”]==1])

join_data.loc[join_data["WH"]==1]

(import networkx as nx)

import networkx as nx

など

(g = nx.graph())

G = nx.Graph()

(g.add_node(”nodea”))

G.add_node("nodeA")

(g.add_edge(”nodea”,”nodeb”))

G.add_edge("nodeA","nodeB")

(g.add_edge(”nodeb”,”nodec”))

G.add_edge("nodeB","nodeC")

(pos[”nodea”] = (0,0))

pos["nodeA"] = (0,0)

(pos = {})

pos = {}

(pos[”nodeb”] = (3,2))

pos["nodeB"] = (3,2)

(pos[”nodec”] = (4,9))

pos["nodeC"] = (4,9)

(nx.draw(g,pos))

nx.draw(G,pos)

(plt.show())

plt.show()

(for i in range(len(df_w.columns)):)

for i in range(len(df_w.columns)):

(font_color=”w”)

font_color="w"

(node_color=”r”,)

node_color="r",

(node_size=1000,)

node_size=1000,

(edge_weights.append(df_w.iloc[i][j]))

edge_weights.append(df_w.iloc[i][j]*

(if i != j:)

if i != j :

(def trans_cost(df_tr, df_tc):)

def trans_cost(df_tr, df_tc):

(cost += df_tr.iloc[i][j])

cost += df_tr.iloc[i][j]

(return cost)

return cost

(index_col=”factory”)

index_col="factory"

問題文を全て表示 一部のみ表示 誤字・脱字等の報告