I have a question about Python 3 data frame types.

Asked 2 years ago, Updated 2 years ago, 42 views

For data frames with data values ranging from 5000 to 15000, I would like to extract the maximum and minimum values from them, but somehow df.max() will extract the maximum values below 10000 (e.g., 9999.9).For df.min(), more than 10000 values are also extracted.I would appreciate it if you could tell me the cause and the solution.
Enter a description of the image here

python python3 pandas

2022-09-30 21:32

1 Answers

(From comments)

When I ran print(df.dtypes), it was of object type.I changed it to a numeric type and it worked well.

(Supplement to the person who made the transfer)

You can change the DataFrame data type by pd.to_numeric(df).


2022-09-30 21:32

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.