python - Python: List all the files names containing the string as in its column name
问题描述
I am new to python. I have a folder with many sub folders containing Parquet files of 100+GB data. some of the file size is also in GBs. I am trying to list all the files that contains column name like "Email"(at start, end or mid) case=False. The output should be in a .txt file. I have tried the below code but its not working properly.Can someone help?
inp=["Email","Mail"]
op=[]
for elem in listOfFiles:
if(elem.endswith(".parquet")):
full_path=elem
filename = elem.split(".")
filename = filename[0]
pfile=pq.read_table(elem)
stri = str(pfile.schema)
for val in inp:
if(stri.count(val)>0):
op.append(full_path)
解决方案
inp=["Email","Mail"]
op=[]
for elem in listOfFiles:
if(elem.endswith(".parquet")):
full_path=elem
filename = elem.split(".")
filename = filename[0]
pfile=pq.read_table(elem)
stri = str(pfile.schema)
for val in inp:
if(stri.count(val)>0):
op.append(full_path)
试试看。如果您遇到错误,请在此处发布,我可以进一步解决问题。
推荐阅读
- python - Scikit-learn 在监督学习结果中包含字符串
- mysql - 带有变量连接的Mysql触发器不起作用
- r - Shiny R:使用单选按钮的输入作为 by() 中的参数
- azure-logic-apps - Azure 逻辑应用:将 HTTP 请求标头键值获取到条件检查中
- c++ - 当有足够的空闲 RAM 时使用交换。性能受到影响
- javascript - 在java脚本中将对象作为属性分配给元素
- java - 经过时间测量问题 - JAVA
- python - 为什么函数标签在该函数的范围内,但类方法标签不在其自身范围内?
- linux - NASM 中的增量循环
- c# - 如何在作为 Windows 服务运行的 Jenkins 上以无头模式使用 Firefox 运行 Selenium 测试(C#、.NET)