To my mind, that’s akin to having two numbers in a spreadsheet cell, but I’m in no way a experienced pandas user, so maybe there’s a good reason that I’m unaware of, for doing that in a pandas df.
You can use multi-level indexing to store multiple numbers within a cell. This involves creating a hierarchical index with multiple levels. However, this approach may complicate data manipulation and analysis. Here’s an example:
import pandas as pd
data = {‘Numbers’: [(1, 2), (3, 4)]}
df = pd.DataFrame(data)
Pandas is intended for number-crunching, not to represent complex data structures. A big part of the point of having a DataFrame is knowing that all the values in a column have the same type - and normally it will be a simple type that supports efficient operations that can be optimized behind the scenes (things like numeric types, dates, and strings used in relatively simple ways). Another big part is that the data makes sense according to the labels. What would it mean for a dog to have a height of (1, 2)? And why would it make sense for a dog’s height to be a different type than a cat’s?
What underlying problem are you really trying to solve - why do you want Pandas to work like this?