This works if I want to print substring of one column:
print(myDf["thisCol"].str[:2])
But, if I want to substring another column and include it in the output, I'm not sure how to do this.
Contrived output of above is roughly:
0 fo
1 ba
What i want, with the second column being say "anotherCol" where the maximum length is greater than 2, is the output:
0 fo tr
1 ba ca
(Disclaimer: I couldn't find the answer with multiple searches. And I'm learning Pandas in a sort of sideways fashion....)
myDf["thisCol"]? I would like to see the data that produces your contrived output. Also, what should "anotherCol" contain and how is it initialised?