Unrelated project during PhD I am in my 3rd year of the PhD program in theoretical physics. Although I would love to stay within academia, my hopes of obtaining a good position are dwindling because of various factors. Given that, it seems wise to be get prepared to leave academia after I get a PhD. My work has nothing to do with coding/programming, and I have zero experience at that. If I leave academia, I want to get into the field of data science/machine learning. Is it possible/advisable/reasonable to work on a side project within physics but in an unrelated field which allows me to gain experience in data analysis and programming? Would I be able to handle it? Would it be a reasonable thing to do without upsetting my advisor? Also, if I do intend to stay within academia, would the experience of working in a different field count, even though it doesn't appear in my dissertation at all?

I do want to mention that I am certain that I do not want to change my field of research for my dissertation just because of the possibility of moving away from academia. I really enjoy working in my field and wouldn't give that up for anything. So switching to the other field for good is not an option.

Thanks in advance!

Edit: I could also work on problems that are a little more closely related with my work that involves numerical computation through which I could learn to code but I wouldn't be working with data. However, I don't know if that would help in terms of getting into industry.
Long story short: Depends. It is difficult to answer these questions without understanding the precise details of your situation. Getting experience is always a good thing, especially if it is programming experience, and you are considering a possible career shift towards more programming/machine learning heavy field of research . However, your part-time contribution to a different scientific project might distract you from finishing your PhD: which should be, considering the year you are in your main worry. If possible, I would discuss this with your supervisor and ask them for a honest opinion: if they feel like your particular situation (expected time commitment, skills, the nature of the work...) allows to go for outside research opportunity, and they think it is good for your career, good for you. I believe that simply bringing up the subject is very unlikely to upset them: after all, their main purpose, at least from your point of view is to supervise you and advise you on starting of your scientific career. If however they express doubts about the extra project being a good fit for you at this point, you might consider focusing on your PhD and then looking for extra learning opportunities: remember that life is just starting after you're done, and there will be plenty of time for various projects afterwards. As to whether the experience would count: depends on what do you understand as 'counts'. But personally I believe that at least familiarity with programming is a skill which counts a lot regardless of the field you end up with.