It's a question to load Python data

Asked 2 years ago, Updated 2 years ago, 126 views

I loaded raw data and did pd.read_csv() through Pandas. However, the data that was retrieved (500rows x 1 columns) was recognized like this.

So I have two questions. First of all, how many times can we take the data from the first row from the data that's the data that's what's what? For example, this is how it's like this. Pulling only the 22nd to 25th data from columns 1 to 10

The second way is to make it recognized like this instead of being called in like that. Step = ',Even if you try to use the same method, the data cannot be written because the distinction between the data is different. (Some are space bar number 3, some are space bar number 5, etc.)

I'd appreciate it if you could tell me one of these two ways!

python pandas dataframe data

2022-09-21 18:42

1 Answers

If the actual delimiter is 2 or more spaces, look for it this way, turn it around, and use it.

import re
rawdata = re.sub(r"[ \t]{2,}", ",", rawdata, 0)


2022-09-21 18:42

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.