如果以数字开头,我想用前一行值填充空单元格.例如,我有
Text Text
30 Text Text
Text Text
Text Text
31 Text Text
Text Text
31 Text Text
Text Text
Text Text
32 Text Text
Text Text
Text Text
Text Text
Text Text
Text Text
Run Code Online (Sandbox Code Playgroud)
但是,我希望拥有
Text Text
30 Text Text
30 Text Text
30 Text Text
31 Text Text
Text Text
31 Text Text
31 Text Text
31 Text Text
32 Text Text
Text Text
Text Text
Text Text
Text Text
Text Text
Run Code Online (Sandbox Code Playgroud)
我试图通过使用此代码达到此目的:
data = pd.read_csv('DATA.csv',sep='\t', dtype=object, error_bad_lines=False) …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用此代码从文件夹中导入数据
from google.colab import files
uploaded = files.upload()
for fn in uploaded.keys():
print('User uploaded file "{name}" with length {length} bytes'.format(name=fn, length=len(uploaded[fn])))
Run Code Online (Sandbox Code Playgroud)
但是它给了我这个错误:
Traceback (most recent call last) <ipython-input-7-3ff52e25531b> in <module>()
1 from google.colab import files
2
----> 3 uploaded = files.upload()
4
5 #for fn in uploaded.keys():
/usr/local/lib/python3.6/dist-packages/google/colab/files.py in upload()
70 result = _output.eval_js(
71 'google.colab._files._uploadFilesContinue("{output_id}")'.format(
---> 72 output_id=output_id))
73 if result['action'] != 'append':
74 # JS side uses a generator of promises to process all of the files- some …Run Code Online (Sandbox Code Playgroud)