Jun-13-2017, 08:23 PM
Hi all... will admit right up front that Python has been an horrible nightmare for me. I can't seem to get anything to work, can't figure out the syntax, and struggle with literally every line I try to write. I believe I have version 3.5.1, and am using PyCharm for editing.
Hoping somebody can help me solve what I would think is a relatively basic problem (but I can't say how difficult it is in Python). Normally I'd just use vba, but with 800,000+ rows, it's killing my CPU and crashing. Plus this may be a good way for me to finally get my feet wet, and if I can actually get it to do something useful, I will finally see some good in it :-)
I have a text file with two columns. Column 1 has a code, and Column 2 has a description of that code. The problem is, some of the descriptions are truncated, or have changed. So I want to find every instance of each code with varying descriptions. For example my file has:
MSFT Microsoft Corp
MSFT Microsft Co
MSFT Microsoft Corporation
MSFT Microsoft Corp
I would like to output
MSFT Microsoft Corp
MSFT Microsft Co
MSFT Microsoft Corporation
With that output, I can write a sql script to change all "MSFT" descriptors to any one of them.
So far, this is the only thing I can get to work
Hoping somebody can help me solve what I would think is a relatively basic problem (but I can't say how difficult it is in Python). Normally I'd just use vba, but with 800,000+ rows, it's killing my CPU and crashing. Plus this may be a good way for me to finally get my feet wet, and if I can actually get it to do something useful, I will finally see some good in it :-)
I have a text file with two columns. Column 1 has a code, and Column 2 has a description of that code. The problem is, some of the descriptions are truncated, or have changed. So I want to find every instance of each code with varying descriptions. For example my file has:
MSFT Microsoft Corp
MSFT Microsft Co
MSFT Microsoft Corporation
MSFT Microsoft Corp
I would like to output
MSFT Microsoft Corp
MSFT Microsft Co
MSFT Microsoft Corporation
With that output, I can write a sql script to change all "MSFT" descriptors to any one of them.
So far, this is the only thing I can get to work
import pandas as pd file = open("f://HITS//fixnames.txt", "r")Thank you for any help!