I don't think there is much demand, but ... The environment is supposed to run on anaconda. You may want to change the type when you import csv etc. into dataframe with python. There is a way to take out the values one by one, convert the type and put it back in, but that is difficult. If possible, I would like to convert each column at once. For example, suppose you have the following table and you have imported this csv data.
I don't think there is much demand, but I would like to convert numbers to strings.
import pandas as pd import datetime test_data = pd.read_csv("test.csv") type(test_data['age']) test_data['age'] = test_data['age'].astype('str') age = test_data['age'] type(ages)
I think that the age column is int type because it is cast in the data frame. After that, astype is used to convert the cast type for each column. To be honest, I don't think there is much use for this.
Let's take a look at the date data of the previous data. I think it has become a character string type. I think this is difficult to handle as data, so I will convert it to a time stamp.
type(test_data['birthday']) test_data['birthday'] = pd.to_datetime(test_data['birthday']) type(test_data['birthday'])
It was a summary that I wanted to see by converting the type for each column of the data frame.