I want to return edgar/data/915802/0001398344-15-001900.txt if 1398344 matches from a DataFrame column. (There will be multiple matching values)
915802|FINANCIAL INVESTORS TRUST|485BPOS|2015-03-19|edgar/data/915802/**0001398344**-15-001900.txt
915802|FINANCIAL INVESTORS TRUST|497J|2015-03-03|edgar/data/915802/**0000915802**-15-000012.txt
915802|FINANCIAL INVESTORS TRUST|497K|2015-03-02|edgar/data/915802/**0001398344**-15-001328.txt
915802|FINANCIAL INVESTORS TRUST|497K|2015-03-02|edgar/data/915802/**0001398344**-15-001330.txt
915802|FINANCIAL INVESTORS TRUST|497K|2015-03-02|edgar/data/915802/**0001398344**-15-001332.txt
915802|FINANCIAL INVESTORS TRUST|497K|2015-03-02|edgar/data/915802/**0001398344**-15-001334.txt
915802|FINANCIAL INVESTORS TRUST|497K|2015-03-02|edgar/data/915802/**0001398344**-15-001336.txt
.....
I am currently trying the following code to return each line which matches the 10-digit starred number from the dataframe column stockStat.CIK.
import pandas as pd
stockStat = pd.DataFrame.from_csv(path ='/home/aranjohn/StockRec/stockData/csvData')
print(stockStat)
q1 = open('/home/aranjohn/StockRec/StockIndex/edgar.full-index.2015.QTR1.master.idx', 'r')
q2 = str.splitlines(q1.read())
strStockStat = str(stockStat.CIK)
for eachCik in strStockStat:
for eachLine in q2:
if eachCik in eachLine:
print(eachCik, eachLine)
I understand the logical error here in which I end up returning every CIK number and every line. How would I only return eachLine that contains eachCik?
Aucun commentaire:
Enregistrer un commentaire