Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: df string manipulation before / after / when single digit pad zero
Post: RE: df string manipulation before / after / when s...

Hi snippsat, Many thanks for your reply. Is there a way to try parsing it, if it doesnt parse, then it doesnt. I have dates that contain strings or even months as strings in different languages. It wo...
metalray Data Science 3 2,964 Oct-16-2018, 01:32 PM
    Thread: df string manipulation before / after / when single digit pad zero
Post: RE: df string manipulation before / after / when s...

xxx = re.sub(r'(\_a)?\.([^\.]*)$' , r'_suff.\2',"long.file.name.jpg") xxxy = re.sub(r'^\d{1,2}\/\d{1,2}\/(\d{2}$)' , r'19\1', "1/3/85") print(xxxy)OK I made some progress. However the 1/3/ are not pr...
metalray Data Science 3 2,964 Oct-12-2018, 02:02 PM
    Thread: df string manipulation before / after / when single digit pad zero
Post: df string manipulation before / after / when singl...

Dear Python Experts, I have some dates that I need to clearn up. d = {'col1': ['1/25/84', '2/8/86'],} dfdates = pd.DataFrame(data=d) print(dfdates)For the first date, I want to add a zero to all sin...
metalray Data Science 3 2,964 Oct-08-2018, 09:58 AM
    Thread: clean up list elements and replace
Post: RE: clean up list elements and replace

Wow, Thanks perfringo! That is something to chew on :D
metalray General Coding Help 7 4,239 Aug-30-2018, 08:13 AM
    Thread: os.listdir(path) and non-string as input
Post: RE: os.listdir(path) and non-string as input

OK, got it. outpath = os.path.join(rootdir, dir+"_flip") now I a at this:
metalray General Coding Help 4 16,691 Aug-15-2018, 11:43 AM
    Thread: os.listdir(path) and non-string as input
Post: RE: os.listdir(path) and non-string as input

Why is outpath not concatenating properly? #interate through tub folders rootdir = 'C:/Users/xxx/data_thinktank/' for root, dirs, files in os.walk(rootdir): flip = r'_flip' ...
metalray General Coding Help 4 16,691 Aug-14-2018, 05:52 PM
    Thread: os.listdir(path) and non-string as input
Post: RE: os.listdir(path) and non-string as input

Hi Gribouillis, Thank you so much for your input! I see, thanks for the hint. I thought I can just leave the other two out if I only want the "dir". OK. Now I am here: TypeError: listdir: path shou...
metalray General Coding Help 4 16,691 Aug-14-2018, 03:21 PM
    Thread: os.listdir(path) and non-string as input
Post: os.listdir(path) and non-string as input

Dear Python Experts, I am trying to interate through folders in my root directory. With the start of the first interation (folder) a new folder should be created named existingname+'_flip'. I then w...
metalray General Coding Help 4 16,691 Aug-14-2018, 12:44 PM
    Thread: clean up list elements and replace
Post: RE: clean up list elements and replace

Hi perfringo, thanks for your suggestion. The dates are of various formats, I wish I could do date conversion in a second, seperate step. Right now, what worries me most is the clean up. I tried the...
metalray General Coding Help 7 4,239 Jul-25-2018, 01:50 PM
    Thread: clean up list elements and replace
Post: clean up list elements and replace

Dear Python Experts, I am looking for a loop that goes through my elements in the list and removes the comma , and ' ' signs. All other strings should remain and occurences like "March" be replaced b...
metalray General Coding Help 7 4,239 Jul-17-2018, 12:03 PM
    Thread: regex to extract only yy or yyyy
Post: regex to extract only yy or yyyy

Dear Python/Regex Experts, I have two regex patterns that I use in Python that need a little improvement. 1. #m/d/yy month in Digits e.g. 1/2/98 pattern1 = r'(\d{1}/\d{1}/\d{2})' I need an extra co...
metalray General Coding Help 2 3,582 Jul-11-2018, 11:29 AM
    Thread: [split] regular expression
Post: RE: [split] regular expression

Anyone a suggestion?
metalray Homework 2 3,022 Jun-14-2018, 03:15 PM
    Thread: reading, modifying and writing json file
Post: RE: reading, modifying and writing json file

OK. Thanks. Got it.
metalray Data Science 2 10,944 Jun-06-2018, 03:09 PM
    Thread: reading, modifying and writing json file
Post: reading, modifying and writing json file

Hi Python Experts, I am trying to open a json file, modify the content and write it to a different directory. The code runs but nothing is really happening. I am not sure what should come first, the...
metalray Data Science 2 10,944 Jun-06-2018, 09:23 AM
    Thread: [split] regular expression
Post: [split] regular expression

I have a regex question as well :) Got a few more dates that I need to find and look for mainly of the following format: 26 August 1982 05 Mar 1974 *** May 15, 1989 ** Mar. 10, 1976 Dec 14 1975 On ...
metalray Homework 2 3,022 Jun-05-2018, 11:09 AM
    Thread: missing pandas even if in conda list
Post: RE: missing pandas even if in conda list

Awesome. Thanks!
metalray Data Science 2 3,460 May-29-2018, 12:52 PM
    Thread: missing pandas even if in conda list
Post: missing pandas even if in conda list

Dear Python Experts, I wonder why pandas is noted as missing even if I have it in my list. (donkey) C:\Users\HOL\d2>conda list # packages in environment at C:\Users\HOL\AppData\Local\Continuum\mi...
metalray Data Science 2 3,460 May-29-2018, 09:14 AM
    Thread: regex.findall and data frame
Post: RE: regex.findall and data frame

(May-06-2018, 05:43 PM)killerrex Wrote: our first pattern reduces to r'[01]?\d/(?:[0-2]\d|3[01])/(?:19\d\d|[2-9]\d{3})' OK I have progressed by doing a loop and going through the data frame. That i...
metalray Homework 6 9,969 May-15-2018, 02:35 PM
    Thread: Looping through files, check content and delete
Post: Looping through files, check content and delete

Dear Python Experts, I wonder if it is possible to write a small python program that goes through my 50 000 .json files on my windows machine and deletes every .json file that conains "throttle":"0" ...
metalray General Coding Help 1 2,389 May-11-2018, 02:12 PM
    Thread: regex.findall and data frame
Post: RE: regex.findall and data frame

stringsearch2 = df['text'].str.findall(pattern1,pattern2) does not work either.
metalray Homework 6 9,969 May-11-2018, 02:04 PM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020