0

I'm looking at sensor data with Pandas dataframes. The text file I have does not have an index field.

It starts with time data, but when I use this code to load data from a file into a Pandas data frame,

dfSensordata = pd.read_csv(fileFolder + filename + ext, header=1, sep=',', index_col=False)

the first column, which was time data, changes to index data.

In brief, I expeced dfSensordata to be like this:

Time 1A [V]
time1 data 1
time2 data 1

but result was like this:

Index Time 1A [V]
time1 data 1
time2 data 1

I also tried these codes, but they didn't change anything.

pd.read_csv(column_index =0)
pd.read_csv(column_index =None)
pd.read_csv(column_index =False)

Could you help me figure out what to do?

1
  • Add a sample of the csv as text, not a screenshot of it Commented May 28, 2024 at 7:32

1 Answer 1

0

Your problem maybe is on the first comma displayed on the csv (87,). Try to delete it from the file and reading it setting index=False. YOur are using comma as a separator for the file and it might be confussed about the first comma.

Sign up to request clarification or add additional context in comments.

1 Comment

@Bokyung Seo Was the issue solved? I would appreciate you to accept and upvote the answer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.