|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
求助最后一行的代码出错在哪了?如果把它隐藏了可以正常访问,但是一加上它就不行。错误信息:
SyntaxError: f-string: unmatched '['
[Finished in 365ms with exit code 1]
[cmd: ['python', '-u', 'D:\\Python\\Python Study\\Study\\linshi.py']]
[dir: D:\Python\Python Study\Study]
[path: C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64_win\compiler;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\dotnet\;E:\mysql-8.0\bin;E:\Anaconda3;E:\Anaconda3\Scripts;E:\Anaconda3\Library\bin;E:\Anaconda3\Library\mingw-w64\bin;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;;E:\Pycharm\PyCharm Community Edition 2022.3\bin;]
- import pandas as pd
- import numpy as np
- import time
- bj_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time())) #取本机时间
- test_a={'code':['AAPL','TSLA','BABA','FFIE'],'name':['苹果','特斯拉','阿里巴巴','法拉第未来'],'USname':['apple','tsla','alibaba','fariday'],\
- 'classify':['ADR','ADR','ADR','ADR',],'list_date':['20200505','20200505','20200505','20200505'],'delist_date':['20200505','20200505','20200505','20200505']}
- df=pd.DataFrame(test_a)
- for i in range(len(df)):
- print(df.loc[0,'name'])
- print(len(df))
- print(df.loc[i,'name'])
- print(f'数据为:{df.loc[i,'name']}')
复制代码
|
|