我有一本昨天下午保存的工作簿,并且运行良好。我今天早上打开了它,但没有“找到”VBE 中的任何模块。从视觉上我可以看到他们都坐在那里。
当尝试打开这些模块中的任何一个来编辑代码时,窗口会变灰,如下所示。
当我尝试导出代码模块时,出现“找不到模块”错误。
有谁知道 a) 为什么会发生这种情况,以及 b) 我该如何解决这个问题?
我最初以为是我的 Excel 的实例,所以重新启动了 PC。
任何帮助表示赞赏!
我目前正在尝试将 46 个数组合并为一个数组。我已经在互联网上搜索过,但没有成功,希望这里有人能提供帮助。我确实找到了下面的页面,但我需要能够在嵌套的 for 循环中查看新数组的每个元素,因此使用下面的方法并不能完全实现我的最终目标。
基本上,我需要以这样的方式组合我的 46 个数组,然后我可以使用嵌套的 for 循环遍历每个元素。IE。
数组集:
myArray1 = (1, 2, 3, 4)
myArray2 = (5, 6, 7)
myArray3 = (8, 9)
myArray4 = (10, 11, 12, 13, 14)
.
.
.
myArray46 = (101, 102, 103)
Run Code Online (Sandbox Code Playgroud)
将它们组合起来形成新的数组:
myNewArray = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14... 101, 102, 103)
Run Code Online (Sandbox Code Playgroud)
在嵌套的 for 循环中循环,根据我的主数组检查每个元素:
For i = LBound(mainArray) to UBound(mainArray)
For j = LBound(myArray) to UBound(myArray) …Run Code Online (Sandbox Code Playgroud) 我有以下数据框:
我有以下字典:
resource_ids_dict = {'Austria':1586023272, 'Bulgaria':1550004006, 'Croatia':1131119835, 'Denmark':1703440195,
'Finland':2005848983, 'France':1264698819, 'Germany':1907737079, 'Greece':2113941104,
'Italy':27898245, 'Netherlands':1832579427, 'Norway':1054291604, 'Poland':1188865122,
'Romania':270819662, 'Russia':2132391298, 'Serbia':1155274960, 'South Africa':635838568,
'Spain':52600180, 'Switzerland':842323896, 'Turkey':1716131192, 'UK':199152257}
Run Code Online (Sandbox Code Playgroud)
我正在使用上述字典值来调用供应商 API。然后,我将所有返回数据附加到 dataframe 中df。
我现在想做的是在后面添加一列,ID该列是位于 中的字典值的字典键。ResourceSetID
我在网上查了一下,但没有找到任何东西(可能是因为我缺乏准确的关键词搜索)。这肯定应该是一句单行话吧?我想避免循环遍历数据框和字典并以这种方式映射。
我在 SO 上查找了其他相关主题,只发现了类似的问题,但没有什么可以帮助我。
我正在查询 AlphaVantage 的股票数据。我收到了数据并进行了解码,但由于格式问题,目前无法转换为 pandas 数据帧。响应的形式如下:
{
"Meta Data": {
"1. Information": "Daily Prices (open, high, low, close) and Volumes",
"2. Symbol": "AAPL",
"3. Last Refreshed": "2021-04-26",
"4. Output Size": "Full size",
"5. Time Zone": "US/Eastern"
},
"Time Series (Daily)": {
"2021-04-26": {
"1. open": "134.8300",
"2. high": "135.0600",
"3. low": "133.5600",
"4. close": "134.7200",
"5. volume": "66905069"
},
"2021-04-23": {
"1. open": "132.1600",
"2. high": "135.1200",
"3. low": "132.1600",
"4. close": "134.3200",
"5. volume": "78756779"
},
"2021-04-22": …Run Code Online (Sandbox Code Playgroud) 我正在尝试提出授权请求并提出TypeError: can't concat str to bytes. 我在网上搜索并发现了类似的问题,但没有一个可以帮助解决我的问题。我目前正在 Jupyter 工作(如果有帮助的话?)而且我是一个 python 菜鸟,所以请温柔一些......
这是我的代码:
import http.client as httplib
import urllib.request, urllib.parse, urllib.error, base64
import requests as rq
base_url = 'api/url'
end_point = '/endpoint'
full_url = base_url + end_point
request_body = {
'UserName':'un',
'Password':'pw'
}
header = {
'tenant': 'tenant name' #required by vendor
}
print(type(base_url))
print(type(end_point))
print(type(full_url))
print(type(request_body))
print(type(header))
try:
conn = httplib.HTTPSConnection(base_url)
conn.request(method='POST',url=full_url, body=request_body, headers=header)
response = conn.getresponse()
data = response.read()
print(type(data))
print(data)
conn.close()
except Exception as e:
print("[Errno …Run Code Online (Sandbox Code Playgroud) python ×3
excel ×2
pandas ×2
vba ×2
arrays ×1
dataframe ×1
dictionary ×1
http.client ×1
vbe ×1