Skip to main content
9 events
when toggle format what by license comment
Feb 1, 2020 at 9:16 comment added bioinformatics_student Thanks for the input :)
Jan 31, 2020 at 5:28 comment added Fatemeh Asgarinejad For removing everything after for instance "1" in string "sleC34_1.region026" string =sleC34_1.region026 index = string.find('1') string = string[:index]
Jan 30, 2020 at 12:12 comment added bioinformatics_student yeah, it's strange because I eliminated the NULL values before using this script. I don't know if it's how the strings are written... Another question, how would it be possible to remove everything from a given character? For example if I want to remove everything after the . (Example: sleC34_1.region026 or ) rtr = line.split(";", 1)[0].rstrip() + '\n' Sorry for all the noob questions, I'm quite new to coding still
Jan 29, 2020 at 18:36 comment added Fatemeh Asgarinejad Your [df1['Organism'] column might have some NULL values. You can check if it is true.
Jan 29, 2020 at 16:30 comment added bioinformatics_student I wanted to follow up with another question, I don't know why but I get the following error : organism = [df1['Organism'][i].replace(' ', '_') for i in range(len(df1))] #substituting ' ' by '_' AttributeError: 'float' object has no attribute 'replace' I tried changing all my data columns to strings and this didn't have any effect, some of my string values are a bit off I guess, see the example.
Jan 22, 2020 at 21:29 comment added Fatemeh Asgarinejad @Biohacker Sure. Yes it is much simpler this way. However, the second approach is more used. Feel free to ask if there are further questions.
Jan 22, 2020 at 14:05 comment added bioinformatics_student thanks very much for your input on this! Looks great and a very nice approach taking into consideration the lists. I thought it might just be simpler with the normal pandas approach, but this is much better. Thanks once again :)
Jan 22, 2020 at 2:34 history edited Fatemeh Asgarinejad CC BY-SA 4.0
added 526 characters in body
Jan 22, 2020 at 2:16 history answered Fatemeh Asgarinejad CC BY-SA 4.0