Python Forum
Redistributing column data - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: Redistributing column data (/thread-31207.html)



Redistributing column data - metro17 - Nov-28-2020

Hello All,

Sample data from one column in my SQLServer database:
ColumnA
,Take one tablet first of every month
,Take one tablet every 30 days
,Take 1 tablet every 7 days
,Take one tablet every twenty four hours
,Take 2 tablets every 12 hours
,Take 2 tablets once in every week
,Take 0.5 tablets by mouth every 12 hours.
,Take 1 tablet by mouth twice daily with meals for 41 doses.
,Take one tablet by mouth once daily.
,Take 1 tablet by mouth daily with dinner.
,Take two tablet by mouth twice daily as needed (for pain). Take with food
,Take 1 tablet by mouth every 4 hours as needed.
,Take 1 tablet by mouth once daily.
,Take 5 mL by mouth twice daily for 6 days.
,Take 1 tablet by mouth twice daily for 7 days. Do not use alcohol while taking this medication or for 48h after completion.
,Inject 0.6 mL subcutaneously q 12 HR for 28 days.
,Take 1 tablet by mouth once daily for 7 days. Take 200mg loading dose followed by 100mg daily x 7 days.
,Take 1 capsule by mouth four times daily as needed.
,Take 1 tablet by mouth daily at bedtime.
,Take 1 tablet by mouth DAILY (6 AM).
,Take 0.5 tablets by mouth twice daily.
,Take 1 tablet by mouth every 6 hours as needed for Pain.
,Take 1 tablet by mouth every 6 hours as needed.
,Take 5 mL by mouth three times daily as needed for Nausea/Vomiting.
,Take 1 tablet by mouth twice daily.
,Take 0.5 tablets by mouth every 12 hours. For prevention of atrial fibrillation after thoracic surgery, stop after 30 days
,Inject 0.4 mL subcutaneously once daily for 4 days. after discharge from the hospital.
,Take 1 tablet by mouth four times daily as needed.
,Take 1 capsule by mouth twice daily.
,Take one tablet by mouth every 6 hours as needed for Pain.
,Take 3 tablets by mouth twice daily for 7 days.
,Take three tablet by mouth every 6 hours as needed for Pain for up to 7 days.


How can I redistribute this data into multiple columns as:
Sample columns: DosageQuantity DosageFrequency TimebetweenDosages

How can I achieve this.


RE: Redistributing column data - Larz60+ - Nov-28-2020

Please make an effort, show your code, and ask specific questions when a problem arises.
We are glad to help, but won't write the code for you.


RE: Redistributing column data - metro17 - Nov-28-2020

(Nov-28-2020, 12:15 PM)Larz60+ Wrote: Please make an effort, show your code, and ask specific questions when a problem arises.
We are glad to help, but won't write the code for you.

Dear Larz60+,
I was not asking for code.I was asking if this this possible and wanted some direction. I am a SQL person and a newbie to python and hence the post.I dabbled in python basics long time back.I know python can do things but need some direction/ideas/references. Thanks.