[Python] Change dtype with pandas

This is my own note because I've been googled myself many times.

dtype change

When you want to change all at once

df = df.astype({'a': 'float32', 'c': 'int8'})

Remarks

I've always re-examined it many times because of pandas, so if I remember, I'll add it here. (2020/08/08)

Recommended Posts

[Python] Change dtype with pandas
Read csv with python pandas
[Python] Join two tables with pandas
1. Statistics learned with Python 1-1. Basic statistics (Pandas)
Excel aggregation with Python pandas Part 1
[Python] Format when to_csv with pandas
FizzBuzz with Python3
Scraping with Python
Change Python 64bit environment to 32bit environment with Anaconda
My pandas (python)
Statistics with python
Scraping with Python
Twilio with Python
Integrate with Python
Play with 2016-Python
AES256 with python
python starts with ()
Excel aggregation with Python pandas Part 2 Variadic
with syntax (Python)
Bingo with python
Zundokokiyoshi with python
[Easy Python] Reading Excel files with pandas
python pandas notes
Excel with Python
Microcomputer with Python
Cast with python
Automatic operation of Chrome with Python + Selenium + pandas
Read Python csv data with Pandas ⇒ Graph with Matplotlib
Serial communication with Python
Django 1.11 started with Python3.6
Primality test with Python
Python with eclipse + PyDev.
Socket communication with Python
Data analysis with python 2
Scraping with Python (preparation)
Try scraping with Python.
Python interpreter prompt change
Quickly visualize with Pandas
Learning Python with ChemTHEATER 03
"Object-oriented" learning with python
Run Python with VBA
Handling yaml with python
Solve AtCoder 167 with python
Serial communication with python
[Python] Use JSON with Python
Learning Python with ChemTHEATER 05-1
Learn Python with ChemTHEATER
Processing datasets with pandas (1)
Run prepDE.py with python3
Bootstrap sampling with Pandas
Convert 202003 to 2020-03 with pandas
Processing datasets with pandas (2)
1.1 Getting Started with Python
Collecting tweets with Python
Binarization with OpenCV / Python
3. 3. AI programming with Python
Kernel Method with Python
Non-blocking with Python + uWSGI
Scraping with Python + PhantomJS
Learn Pandas with Cheminformatics
Posting tweets with python