0
import pandas as pd
import numpy as np
import os

files = [file for file in os.listdir('./dataset')]

all_schedule_data = pd.DataFrame()

for file in files:
    df = pd.read_csv("./dataset/"+file)
    all_schedule_data = pd.concat([all_schedule_data, df])

all_schedule_data.to_csv("all_data.csv", index=False)

all_datas = pd.read_csv("all_data.csv")
all_datas.columns

'''

The problem part is the last line. When I put 'all_datas.columns', this happens. Nothing is printed. enter image description here

And when I put 'all_data.columns()', this error comes in.enter image description here I also did 'all_data.head()', but nothing is printed just like the first photo.

I followed the youtube video tutorial to build this code so the code is exactly the same except the file part as like the video. But in the video, he did 'all_data.head()' and he got some results. But for me, I didn't get any results. Just got the thing like the first photo as I explained above.

  1. I have no idea why I get the different results from the youtube video even I did all same.
  2. I don't know why the results are different when I put each all_datas.columns() and without ().
  3. Someday I may use all_datas.columns(), all_datas.values() etc. But I got errors so it would be a problem. How can I solve it and want to know why the error is happening.

Thank you for reading and if someone can help me out with this problem, I would be really appreciated it. Thank you:)

2 Answers 2

1

Try using the print() function for the last line. The tutorial you're following probably uses jupyter notebook or a form of magic python which prints any statements at the end of the block of code. Regular python doesn't.

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

Comments

0

I think there is no index or data in the CSV that you are trying to read

Comments

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.