我希望脚本的用户输入将被读入数据帧的文件路径和名称。
用户可以输入类似directory1\test1.csv或directory1\test1.psv或directory1\test1.xlsx的内容
无论他们输入的是psv、csv还是xlsx,我都希望通过以下逻辑将其读入数据帧:
如果文件名以.psv结尾,则df=pd.read\u psv(),elif文件名以.csv结尾,然后df=read\u csv(),elif文件名以.xlsx结尾,则df=pd.read\u excel()
有办法做到这一点吗
Tags:
这就是我尝试过的:
相关问题 更多 >
编程相关推荐