1

Hello I read a gzip file into dataframe and when I was create columns name I take this: enter image description here

However when I read the table the result is: enter image description here

My quesstion is: I want to create 7 different columns but I can't. Each comma is a column . How can I do that?

3
  • 1
    And make sep=r' |,' Commented May 24, 2016 at 21:36
  • 1
    @YakymPirozhenko Only sep=',' Space is excessive - it breaks datetime field 'created at'. Commented May 25, 2016 at 10:14
  • @knagaev you are correct - I did not notice the date and assumed the OP wanted to subdivide the existing dataframe. Commented May 25, 2016 at 13:47

1 Answer 1

2

Maybe you can try this:

import pandas as pd
df = pd.read_table('part-00000.gz', compression='gzip', sep=',', name=['search_id',...,'return'], header=None)

You can pass column names when you read gzip files. Hope this will help.

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.