import 'vuetify/dist/vuetify.min.css';
import 'roboto-fontface/css/roboto/roboto-fontface.css';
import 'material-design-icons-iconfont/dist/material-design-icons.css';
这些值是从$dir = "path/to/directory"
$images = Get-ChildItem $dir
foreach ($img in $images) {
$outputName = $img.DirectoryName + "\" + $img.BaseName + ".webp"
##### The line below works well when there are no spaces
##### C:\webp-converter\libwebp-0.6.1-windows-x64\bin\cwebp.exe $img.FullName -o $outputName
##### How do i change the syntax to make the line below work?
C:\Program Files\a folder with many spaces in the title\bin\cwebp.exe $img.FullName -o $outputName
}
中读取的。
我想按以下内容将这些内容分开
I have a dataframe of the following type,
Input Output Output SE
0 Rat Cat Mat
1 rat cat mat
2 0 4.8 0.255
3 3 7.2 0.32
4 Bat Cat Sat
5 bat cat sat
6 0 1.8 0.275
7 3 1.7 0.745
我当前正在使用Excel
:
df1=
0 Rat Cat Mat
1 rat cat mat
2 0 4.8 0.255
3 3 7.2 0.32
df2=
0 Bat Cat Sat
1 bat cat sat
2 0 1.8 0.275
3 3 1.7 0.745
还有其他方法吗? 我有一个具有相同模式的非常大的数据框,并且想在出现两行字符串时拆分该数据框。
编辑:输入数据框重置
答案 0 :(得分:1)
尝试通过//
s1=df.Input.str.isdigit()
for x , y in df.groupby((~s1&s1.shift().fillna(True)).cumsum()):
print(x,y)
1 Input Output Output SE
0 Rat Cat Mat
1 rat cat mat
2 0 4.8 0.255
3 3 7.2 0.32
2 Input Output Output SE
4 Bat Cat Sat
5 bat cat sat
6 0 1.8 0.275
7 3 1.7 0.745
d={x : y for x , y in df.groupby((~s1&s1.shift().fillna(True)).cumsum())}
答案 1 :(得分:0)
如果您要在至少两行包含非数值的情况下立即进行拆分,则可以进行测试,然后在每个新的 group Leader 上拆分组:
def isnum(ser):
try:
pd.to_numeric(ser)
return True
except ValueError:
return False
num = df.apply(isnum)
# df.grp will be 1 if and only if it is the first of a group of at least 2 lines
# containing non numeric values
df.loc[~(num|(~num.shift().fillna(True))|num.shift(-1).fillna(True)), 'grp'] = 1
# give a different value for each group:
grp = pd.Series(1, df.loc[~(num|(~num.shift().fillna(True))|num.shift(-1).fillna(True)),
'grp'].index)
grp = grp.cumsum().reindex(df.index).ffill()
您现在可以使用groupby获取子数据帧的列表:
dfs = dfs = [sub for _, sub in df.groupby(grp)]