Hello I have a coding question. So I have a dataset that basically have Tract IDs, and I know they should have 6 digits but since some start with 0, some have less than 6 digits, and before I want to add the state and county identifier, I want to make sure each tract ID has 6 digits, like if it has 5 digits, I want there to be a 0 at the beginning, and so on. Is there a way for me to code that, because Im hoping to match CBGs to their CTs which have populations I will have to use for my research, thank you.
This topic was automatically generated from Slack. You can find the original thread here.
you could also make sure you’re reading in the column as a string from the beginning. I am guessing the original file has the leading 0s there but Pandas is interpreting it as an integer
To prevent any further questions from being overlooked, I’ll go ahead and close this thread out. If you have any more questions or follow-up questions, we’re always here to help! Just be sure to make a new post to help, as we aren’t monitoring old threads at this time. Thanks!