Skip to content

Python code snippet – How to define dtype of each column before actually reading csv file?

import pandas as pd 

# ...[.].csv = your .csv file 
# datatype = dtype you want to define.
read = pd.read_csv('......[.]csv',dtype={'name_column':'datatype'})
See also  How to get length of string in Python?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.