I'm reading stock tickers from comma delimited file using pandas.read_csv(). One of the tickers is TRUE, so pandas reader interprets it as a boolean, and fails, since it needs a string to retrieve prices. How can I force TRUE into a string?
Specify the dtype of the desired column in the read_csv
method call:
pd.read_csv('weirdly_formatted_csv.csv', dtype={'weird_column': str})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With