RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / user-179846

Viktorov's questions

Martin Hope
Viktorov
Asked: 2020-02-28 16:00:50 +0000 UTC

如何通过 FastAPI 返回名称中带有俄文字母的文件?

  • 1

我在 FastAPI 上创建了一项服务,该服务通过引用返回文件。
原始看起来像这样:

import os

from fastapi import FastAPI, HTTPException    
from starlette.responses import FileResponse    


app = FastAPI()
db = DataBase(config=CONFIG.mysql)

@app.get('/v1.0/get_file')
async def get_file(id_file: str):
    # ...
    file = db.get_file(id_file)
    # ...        
    return FileResponse(file.path, filename=file.file_name)

只要file.file_name不包含俄语字符,文件就成功下载。一旦俄罗斯字母出现在那里,我的代码就会崩溃并出现错误:

 ...
 File
 "/home/servicemanager/services/file_service/venv/lib/python3.7/site-packages/starlette/datastructures.py",
 line 606, in setdefault
     set_value = value.encode("latin-1")
 UnicodeEncodeError: 'latin-1' codec can't encode characters in position 22-26: ordinal not in range(256)

我不明白这个错误来自哪里。我拥有 utf-8 编码的所有内容。我建议也许数据库以错误的编码返回给我一些东西,但是即使我明确地写了一个 call FileResponse(file.path, filename='отчет.xlsx'),我的代码仍然返回一个错误。请帮我弄清楚发生了什么。

python
  • 1 个回答
  • 10 Views
Martin Hope
Viktorov
Asked: 2020-01-22 23:48:49 +0000 UTC

比较给定 epsilon 值的列并将结果放在第三列

  • 3

我正在尝试解决这个问题:
有一个带有两列实数的 DataFrame。
我想构建第三列,它将采用值:

  • 1 - 如果第二列中的数字大于第一列中的数字
  • 0 - 如果两列中的数字相等
  • -1 - 如果第二列中的数字小于第一列中的数字

比较时,我想考虑一些 epsilon,因为 由于测量误差,这些数字可能“大致相等”。

我写了这段代码,它似乎可以按我的需要工作:

columns = ['col1', 'col2']
data = [[1.0, 1.0], [1.0, 2.0], [2.0, 1.0]]
epsilon = 0.01
df = pd.DataFrame(data, columns=columns)
df['is_up'] = np.where((df['col2'] - df['col1'] > epsilon),1, np.nan)
df['is_down'] = np.where((df['col2'] - df['col1'] < - epsilon),-1, np.nan)
df['is_equal'] =  np.where((abs(df['col2'] - df['col1']) < epsilon),0, np.nan)

df['col3'] = df[['is_up','is_down','is_equal']].replace('None','').sum(1)

结果:

-----------------------------------------------
col1 | col2 | is_up | is_down | is_equal | col3
-----------------------------------------------
1.0  |1.0   |NaN    |NaN      |0.0       |0.0
1.0  |2.0   |1.0    |NaN      |NaN       |1.0
2.0  |1.0   |NaN    |-1.0     |NaN       |-1.0

但是,我有一种感觉,它可以做得更简单,更清晰,更快。请指出正确的道路!

python
  • 2 个回答
  • 10 Views
Martin Hope
Viktorov
Asked: 2020-12-19 16:52:07 +0000 UTC

是否可以将服务器与数据库的连接限制为仅一个用户?

  • 4

有一个网络,该网络有一个可供所有人使用的服务器和 Oracle 数据库。
我想确保只有一个特定的技术用户可以从这个服务器连接。不应限制来自其他服务器的连接。

您可能可以在 Logon 上编写一个触发器,如果​​连接了错误的会话,它将拒绝来自指定服务器的所有会话。乌兹 然而,这看起来是一个糟糕的解决方案。

也许甲骨文有某种安全设置或其他允许连接有机的东西?

sql
  • 2 个回答
  • 10 Views
Martin Hope
Viktorov
Asked: 2020-12-12 19:46:58 +0000 UTC

如何将 *.yml 文件读入数据类

  • 1

假设我有一个 .yaml 文件,简化如下:

oracle:
    user_name : name
    password: password
yandex:
    api_key: xxxxx
    params:
        param1: 1
        param2: two

并且有描述的类:

from dataclasses import dataclass

@dataclass
class Oracle:
    user_name: str
    password: str


@dataclass
class Params:
    param1: int
    param2: str


@dataclass
class Yandex:
    api_key: str
    params : Params

@dataclass
class Config:
   oracle: Oracle
   yandex: Yandex

现在,要读取所有参数,以简化的方式使用以下代码:

def get_config(config_file='config.yaml'): 
    here = os.path.dirname(os.path.abspath(__file__))
    full_file_path = os.path.join(here, config_file)
    with open(full_file_path, 'r') as yaml_file:
        config = yaml.load(yaml_file, Loader=yaml.BaseLoader)
    params = Params(param1= config['yandex']['params']['param1'], ...)
    yandex = ...
    oracle = ...
    return Config(oracle, yandex)

这种可以通过几行读取参数并立即将它们加载到类中的方式进行优化的感觉并没有离开。但我找不到类似的东西。

告诉我这里可以做什么?

python
  • 1 个回答
  • 10 Views
Martin Hope
Viktorov
Asked: 2020-12-03 13:03:18 +0000 UTC

如何找出密钥每天完成/剩余的请求数?

  • 3

我们在开发者办公室生成了一个用于地理编码的密钥。该密钥每天的请求限制为 25,000 次。

是否可以使用 Yandex API 找出每天发出的请求数或剩余的请求数?

yandex-maps-api
  • 1 个回答
  • 10 Views
Martin Hope
Viktorov
Asked: 2020-10-07 20:22:28 +0000 UTC

如何获取块中所有被调用过程的子sql_Id的层次结构?

  • 3

我有一段代码,其中调用了其他程序。示意图如下所示:

begin
  procedure_0;
  procedure_1;
  procedure_2;
  ....
end;

在被调用的过程中,执行各种 DDL 和 DML。所有这些建设工作的时间长得令人无法接受。我有sql_id这个来自 EM 的块。我想以某种方式sql_id为这个块建立一个所有孩子的层次结构,看看在哪里花费了多少时间。

请告诉我如何解决这个问题?

sql
  • 1 个回答
  • 10 Views
Martin Hope
Viktorov
Asked: 2020-07-11 02:16:17 +0000 UTC

如何在精灵周围绘制边框?

  • 1

我使用pygame并绘制地图。我创建了一个类Tail并将Sprite所有图块添加到一个组中以一次绘制所有图块。现在我希望每个图块都有一个边框,但我不明白该怎么做。

我的代码的简化示例:

import pygame
from pygame.rect import Rect
from pygame.sprite import Sprite, Group

# Константы
TAIL_SIZE = 80
WIN_W = 800
WIN_H = 600
TAIL_COLOR = (127, 255, 212)
BORDER_COLOR = (0, 0, 0)
MAP_SIZE = (5, 7)
FPS = 60


class Tail(Sprite):
    def __init__(self, x: int, y: int, w: int, h: int, group: Group):
        Sprite.__init__(self)
        self.color = TAIL_COLOR
        self.image = pygame.Surface((w, h))
        self.image.fill(self.color)
        self.rect = Rect(x, y, w, h)
        self.add(group)
        self.border_color = BORDER_COLOR


pygame.init()
sc = pygame.display.set_mode((WIN_W, WIN_H))
game_map = pygame.sprite.Group()
clock = pygame.time.Clock()

# Создадим карту из тайлов
y = 0
for line in range(MAP_SIZE[0]):
    x = 0
    for rect in range(MAP_SIZE[1]):
        big_x = x * TAIL_SIZE
        big_y = y * TAIL_SIZE
        Tail(x=big_x, y=big_y, w=TAIL_SIZE, h=TAIL_SIZE, group=game_map)
        x += 1
    y += 1

while True:
    for i in pygame.event.get():
        if i.type == pygame.QUIT:
            exit()

    game_map.draw(sc)
    pygame.display.update()
    clock.tick(FPS)

我可以按图块的数量分别绘制矩形,但我并没有想到我可以以某种方式简单地扩展我的类Tail,以便框架与图块一起绘制

UPD:
我试图在 class 中Tail添加一行pygame.draw.rect(self.image, self.border_color, self.rect, 1)。据我了解,这会在每个图像上绘制一个框架,但是出了点问题,该框架仅针对左上角的图块绘制。

python
  • 1 个回答
  • 10 Views
Martin Hope
Viktorov
Asked: 2020-07-03 17:09:14 +0000 UTC

如何将任意对象序列化为字符串?

  • 3

我有一个任意对象,例如为一个类简化:

class Attribute:
    def __init__(self, x, y):
        self.x = x
        self.y = y

    def calc():
        return self.x + self.y

我创建一个对象:

attr = Attribute(1, 1)

我想将此对象(attr)保存到一个字符串中,然后在必要时从那里加载它。我尝试使用该模块pickle,但没有掌握它。

import pickle
pickled = pickle.dumps(attr)
spickled = str(pickled)

unpickled = pickle.loads(spickled)

导致错误:

TypeError: a bytes-like object is required, not 'str'

str(pickled)因为实际上我必须将我的对象存储json为字符串,然后在另一次运行时从那里读取。

实际上问题是,如何将我的对象保存在 json 中然后读取它?不需要人类可读性。

python
  • 2 个回答
  • 10 Views
Martin Hope
Viktorov
Asked: 2020-05-23 02:02:16 +0000 UTC

如何制作一个用于在python中存储常量的结构?

  • 4

我有要存储的卡数据。每张卡片包含:имя карты、ссылка на изображение和。我有几十张这样的卡片。我预计在不久的将来卡片的结构可能会开始改变,并且会添加/删除字段。它将像 Amazon 服务器上的 lambda 一样工作,因此每个操作都会有一个新的调用和所有数据的新初始化。список словключевая буква

这是我从一开始就创建的结构:

class CardData:
    class Card1:
        title = 'Card 1'
        image_url = 'https://s3.amazonaws.com/...'
        words = ['postgame', 'amongst', 'megaton', 'montage', ...]
        key_letter = 't'

    class Card2:
        title = 'Card 2'
        image_url = 'https://s3.amazonaws.com/...'
        words = ['portside', 'riposte', 'deport', 'poser', ...]
        key_letter = 'r'

现在我可以像这样访问我的数据getattr(CardData, 'Card1').words

让我感到困惑
的是: 1. 我一直不喜欢写作getattr。
2. 嵌套类必须具有相同的结构。我希望 IDE 告诉我是否遗漏了什么。

还有哪些其他选择?

python
  • 1 个回答
  • 10 Views
Martin Hope
Viktorov
Asked: 2020-03-26 16:40:59 +0000 UTC

如何通过条件“in np.array”从 Pandas 中的 DataFrame 中选择数据?

  • 3

我有类似这个数据集的东西,只有几十万行:

data = [{'name': 'name1', 'launch_id': 5},\
        {'name': 'name2', 'launch_id': 6},\
        {'name': 'name2', 'launch_id': 7},\
        {'name': 'name3', 'launch_id': 8}]
df = pd.DataFrame(data)

将会:

  | launch_id | name
---------------------
0   5           name1
1   6           name2
2   7           name2
3   8           name3

我想从中选择一些launch_id从另一个大型 DataFrame 获得的行。我用名字launch_id保存了必要的:np.arraysimple

simple = np.array([5, 8])

现在我想得到以下结果:

  | launch_id | name
---------------------
0   5           name1
3   8           name3

如果我写一个 SQL 查询,我会写一些where launch_id in simple.

如何在 Pandas 中获得类似的结果?

python
  • 1 个回答
  • 10 Views
Martin Hope
Viktorov
Asked: 2020-03-04 16:25:21 +0000 UTC

在子字段上调用父类方法

  • 0

我有几个班级Class1,Class2他们都有一个方法get_params()。对于它们,我描述了接口Main_class,并通过构造函数用一个接口创建它们。

from abc import ABC, abstractmethod

class Main_class(ABC):

    @abstractmethod
    def init(self, x, y):
        pass

    ...


class Class1():

    def get_params():        
    ...

我不想在每个子类中描述相同的方法。我可以以某种方式为父类描述它,以便为子类的字段调用它吗?

附言

该任务本质上是教育性的,与现实无关,我只是了解语言的工作原理

python
  • 1 个回答
  • 10 Views
Martin Hope
Viktorov
Asked: 2020-12-07 18:59:41 +0000 UTC

左侧的符号不适合 jupyter notebook,如何解决?

  • -1

学习使用 Jupyter Notebook。由于某种原因,左侧的某些字符不适合输出(见图)。告诉我如何解决这个问题?

在此处输入图像描述

python
  • 1 个回答
  • 10 Views
Martin Hope
Viktorov
Asked: 2020-11-17 03:39:25 +0000 UTC

使用 sklearn.linear_model.RidgeCV 时出现 MemoryError

  • 2

我正在尝试训练我的模型

from sklearn.linear_model import RidgeCV
alphas = [0.00001, 0.0001, 0.001, 0.01, 0.01, 0.5, 1, 3,  5]
clf = RidgeCV(alphas=alphas, normalize=True, gcv_mode = 'eigen').fit(x_train, y_train)

其中:

print(x_train.shape, y_train.shape)
(62313, 100600) (62313,)

type(x_train)
scipy.sparse.csr.csr_matrix

在发布之前,我有大约 10 GB 的可用 RAM。启动后,它需要大约 2 GB 并保持空闲 8 字节。我的代码运行了大约半小时,而空闲内存一直在 8 GB 左右,然后崩溃并出现错误:

---------------------------------------------------------------------------
MemoryError                               Traceback (most recent call last)
<ipython-input-9-e9d3d7210319> in <module>()
      2 from sklearn.linear_model import RidgeCV
      3 alphas = [0.00001, 0.0001, 0.001, 0.01, 0.01, 0.5, 1, 3,  5]
----> 4 clf = RidgeCV(alphas=alphas, normalize=True, gcv_mode = 'eigen').fit(x_train, y_train)

~/anaconda3/lib/python3.6/site-packages/sklearn/linear_model/ridge.py in fit(self, X, y, sample_weight)
   1112                                   gcv_mode=self.gcv_mode,
   1113                                   store_cv_values=self.store_cv_values)
-> 1114             estimator.fit(X, y, sample_weight=sample_weight)
   1115             self.alpha_ = estimator.alpha_
   1116             if self.store_cv_values:

~/anaconda3/lib/python3.6/site-packages/sklearn/linear_model/ridge.py in fit(self, X, y, sample_weight)
   1027         centered_kernel = not sparse.issparse(X) and self.fit_intercept
   1028 
-> 1029         v, Q, QT_y = _pre_compute(X, y, centered_kernel)
   1030         n_y = 1 if len(y.shape) == 1 else y.shape[1]
   1031         cv_values = np.zeros((n_samples * n_y, len(self.alphas)))

~/anaconda3/lib/python3.6/site-packages/sklearn/linear_model/ridge.py in _pre_compute(self, X, y, centered_kernel)
    883     def _pre_compute(self, X, y, centered_kernel=True):
    884         # even if X is very sparse, K is usually very dense
--> 885         K = safe_sparse_dot(X, X.T, dense_output=True)
    886         # the following emulates an additional constant regressor
    887         # corresponding to fit_intercept=True

~/anaconda3/lib/python3.6/site-packages/sklearn/utils/extmath.py in safe_sparse_dot(a, b, dense_output)
    133     """
    134     if issparse(a) or issparse(b):
--> 135         ret = a * b
    136         if dense_output and hasattr(ret, "toarray"):
    137             ret = ret.toarray()

~/anaconda3/lib/python3.6/site-packages/scipy/sparse/base.py in __mul__(self, other)
    477             if self.shape[1] != other.shape[0]:
    478                 raise ValueError('dimension mismatch')
--> 479             return self._mul_sparse_matrix(other)
    480 
    481         # If it's a list or whatever, treat it like a matrix

~/anaconda3/lib/python3.6/site-packages/scipy/sparse/compressed.py in _mul_sparse_matrix(self, other)
    500                                     maxval=nnz)
    501         indptr = np.asarray(indptr, dtype=idx_dtype)
--> 502         indices = np.empty(nnz, dtype=idx_dtype)
    503         data = np.empty(nnz, dtype=upcast(self.dtype, other.dtype))
    504 

MemoryError: 

你能帮我弄清楚发生了什么以及可以做些什么吗?

python
  • 1 个回答
  • 10 Views
Martin Hope
Viktorov
Asked: 2020-11-05 03:20:05 +0000 UTC

如何计算pandas中值个数的百分比?

  • 2

我有一个DataFrame,其中包含各种值。

import pandas as pd 
df = pd.DataFrame({"data": [1, 1, 1, 1, 0, 0, 0, 2, 2, 3]})

我想计算每个值占总数据的百分之几,也就是得到一个这样的表:

value | percent
_____________________
0     | 30 ( или 0.3)
1     | 40 ( или 0.4)
2     | 20 ( или 0.2)
3     | 10 ( или 0.1)

我可以这样算:

# Добавляю еще одну колонку, чтобы нормально посчитать count()
df['column'] = 1
df2 = df.groupby('data').count()
df2['percent'] = df2['column'] / len(df.index)

我得到了我正在寻找的东西:

      column  percent
data                 
0          3      0.3
1          4      0.4
2          2      0.2
3          1      0.1

但是,我仍然觉得我做错了一切。这样的问题应该更容易解决。你能告诉我解决我的问题的最佳方法吗?

python
  • 2 个回答
  • 10 Views
Martin Hope
Viktorov
Asked: 2020-11-03 21:14:46 +0000 UTC

如何在 Pandas 中将列转换为行(UNPIVOT)

  • 2

我有一个数据结构:

id | data1 | data2 | data3
---------------------------
 1 | 's11' | 's12' | 's13'
 2 | 's21' | 's22' | 's23'
 3 | 's31' | 's32' | 's33'

从中我想得到这样的一套:

id | data 
----------
 1 | 's11'
 1 | 's12'
 1 | 's13'
 2 | 's21'
 2 | 's22'
 2 | 's23'
 3 | 's31'
 3 | 's32'
 3 | 's33'

我试过这样:

import pandas as pd

df = pd.DataFrame(
    {"id": [1, 2, 3], "data1": ['s11', 's22', 's33'], "data2": ["s21", 's22', 's23'],
     'data3': ['s31', 's32', 's33']})
df2 = pd.concat([df[['id', 'data1']], df[['id', 'data2']], df[['id', 'data3']]], keys=['d1', 'd2', 'd3'])

是什么给出了这样的集合:

     data1 data2 data3  id
--------------------------
d1 0   s11   NaN   NaN   1
   1   s22   NaN   NaN   2
   2   s33   NaN   NaN   3
d2 0   NaN   s21   NaN   1
   1   NaN   s22   NaN   2
   2   NaN   s23   NaN   3
d3 0   NaN   NaN   s31   1
   1   NaN   NaN   s32   2
   2   NaN   NaN   s33   3

我打算进一步分组

df3 = df2.fillna('zzz').groupby('id').first()

结果:

   data1 data2 data3
id                  
1    s11   zzz   zzz
2    s22   zzz   zzz
3    s33   zzz   zzz

一般来说,这对我来说并不奏效,因为分组按键折叠了我的行。似乎我可以通过将列重命名为相同并执行来生成更多 DataFrame concat,但在我看来,应该有一种更简单的方法。我该如何解决我的问题?

我也看向一边pivot_table,但什么也做不了。

python
  • 1 个回答
  • 10 Views
Martin Hope
Viktorov
Asked: 2020-09-18 22:25:19 +0000 UTC

RMAN-05579:从备份还原数据库时找不到 CONTROLFILE 备份

  • 0

我有一个用 RMAN 创建的备份。脚本:

connect target /
shutdown immediate;
startup mount;
run{
allocate channel d1 type disk;
backup full format 'D:\Databases\Backups\02.RMAN_BKP\bkp__%d_%U.bus'
database;
}
startup;
exit;

结论:

connected to target database: DO_ETLN (DBID=4267723674)

using target database control file instead of recovery catalog
database closed
database dismounted
Oracle instance shut down

connected to target database (not started)
Oracle instance started
database mounted

Total System Global Area    2254802944 bytes

Fixed Size                     2283224 bytes
Variable Size                587204904 bytes
Database Buffers            1644167168 bytes
Redo Buffers                  21147648 bytes

allocated channel: d1
channel d1: SID=63 device type=DISK

Starting backup at 18-SEP-18
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
input datafile file number=00004 name=D:\DATABASES\DO_ETLN\BD\USERS01.DBF
input datafile file number=00005 name=D:\DATABASES\DO_ETLN\BD\INDEXES01.DBF
input datafile file number=00002 name=D:\DATABASES\DO_ETLN\BD\SYSAUX01.DBF
input datafile file number=00001 name=D:\DATABASES\DO_ETLN\BD\SYSTEM01.DBF
input datafile file number=00003 name=D:\DATABASES\DO_ETLN\BD\UNDOTBS01.DBF
input datafile file number=00006 name=D:\DATABASES\DO_ETLN\BD\LOB_TS_01.DBF
input datafile file number=00007 name=D:\DATABASES\DO_ETLN\BD\REPOSITORY_BO_01.DBF
input datafile file number=00008 name=D:\DATABASES\DO_ETLN\BD\TOOLS_01.DBF
channel d1: starting piece 1 at 18-SEP-18
channel d1: finished piece 1 at 18-SEP-18
piece handle=D:\DATABASES\BACKUPS\02.RMAN_BKP\BKP__DO_ETLN_01TDECMD_1_1.BUS tag=TAG20180918T170933 comment=NONE
channel d1: backup set complete, elapsed time: 00:01:05
channel d1: starting full datafile backup set
channel d1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel d1: starting piece 1 at 18-SEP-18
channel d1: finished piece 1 at 18-SEP-18
piece handle=D:\DATABASES\BACKUPS\02.RMAN_BKP\BKP__DO_ETLN_02TDECOF_1_1.BUS tag=TAG20180918T170933 comment=NONE
channel d1: backup set complete, elapsed time: 00:00:01
Finished backup at 18-SEP-18
released channel: d1

database is already started
database opened

Recovery Manager complete.

我正在尝试将其还原到新创建的数据库。脚本:

connect auxiliary / 
run{ 
allocate auxiliary channel aux1 device type disk;
allocate auxiliary channel aux2 device type disk;
allocate auxiliary channel aux3 device type disk;
allocate auxiliary channel aux4 device type disk;
SET NEWNAME FOR DATABASE TO 'D:\Databases\DODEVT\%b'; 
DUPLICATE TARGET DATABASE TO DODEVT
backup location '"D:\Databases\Backups\02.RMAN_BKP"' NOREDO
logfile
   group 1 ('D:\Databases\DODEVT\redo01.log') size 50M reuse,
   group 2 ('D:\Databases\DODEVT\redo02.log') size 50M reuse,
   group 3 ('D:\Databases\DODEVT\redo03.log') size 50M reuse;
}
exit;

我收到一个错误:

connected to auxiliary database: DODEVT2 (not mounted)

allocated channel: aux1
channel aux1: SID=63 device type=DISK

allocated channel: aux2
channel aux2: SID=129 device type=DISK

allocated channel: aux3
channel aux3: SID=193 device type=DISK

allocated channel: aux4
channel aux4: SID=6 device type=DISK

executing command: SET NEWNAME

Starting Duplicate Db at 18-SEP-18
released channel: aux1
released channel: aux2
released channel: aux3
released channel: aux4
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 09/18/2018 17:11:47
RMAN-05501: aborting duplication of target database
RMAN-05579: CONTROLFILE backup not found in "D:\Databases\Backups\02.RMAN_BKP"

Recovery Manager complete.
db dublicated

控制文件似乎包含在我的备份中,但 RMAN 说它不存在。告诉我我错过了什么?

oracle
  • 1 个回答
  • 10 Views
Martin Hope
Viktorov
Asked: 2020-09-17 04:53:26 +0000 UTC

如何在 pandas 中构建浮动分组窗口?

  • 2

我有一个数据集:

id  |  value
------------
1   |  3
2   |  4
3   |  6
4   |  7
5   |  2

我想在此处添加一列,其中包含前 3 行的平均值,同时考虑到当前行,因此结果是这样的:

id  | value | my_column
-----------------------
1   | 3     |  3                   3/1
2   | 4     |  3.5             (3+4)/2
3   | 6     |  4.33          (3+4+6)/3
4   | 7     |  5.66          (4+6+7)/3
5   | 2     |  5             (6+7+2)/3

到目前为止,我已经编写了一个函数,可以多次循环我的集合并计算这些总和。似乎可以不用循环。能?

python
  • 1 个回答
  • 10 Views
Martin Hope
Viktorov
Asked: 2020-07-16 19:17:50 +0000 UTC

如何将 Oracle 查询执行计划导出到其他数据库?

  • 2

有一个查询在一个数据库上运行很快,而在第二个数据库上运行速度非常慢。分析后发现该请求已离开计划。无法配置提示查询计划。

如何将一个好的查询计划从一个数据库转移到另一个数据库?

sql
  • 1 个回答
  • 10 Views
Martin Hope
Viktorov
Asked: 2020-07-10 19:22:49 +0000 UTC

如何找出特定会话的 Oracle 优化器 (optimizer_mode) 的操作模式?

  • 2

我可以通过以下查询查看数据库的优化器操作模式:

select valuer
from   v$parameter t
where  t.name = 'optimizer_mode'

现在如何查看特定会话的相同值?

sql
  • 2 个回答
  • 10 Views
Martin Hope
Viktorov
Asked: 2020-07-04 17:36:14 +0000 UTC

吉特。如何重置/删除已保存的密码?

  • 3

我在 BitBucket 上有空调。我不得不更改密码,现在当我尝试执行时

git fetch 

我看到一个错误:

致命:“地址”的身份验证失败

据我了解,git 保存了我的密码,现在正在尝试使用它。如何重置此密码?

当然,您可以再次删除并克隆存储库,但我想找到一种更简单的方法。

windows
  • 2 个回答
  • 10 Views

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5