i have two sheets
the first row become the title of my columns
the second row went to the end when i merged
i need to put the second as a subtitle or do i need to delete?
#๐ i need to put
42 messages ยท Page 1 of 1 (latest)
@rigid phoenix
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
Closes after a period of inactivity, or when you send !close.
you mean this?
Your excel sheet has two header rows. You want to clean up either the excel or the dataframe. Probably by removing or ignoring the extra row.
so do i need to delete this row?
Yes, since it's not part of the data.
it is a test, so i doing this, and the second rows are the question i need to answer
so do i just remove them?
i will do that then
juncao2 = juncao.drop(juncao.index[1556])
juncao2
so i do that?
or, juncao2=juncao[1:]
technically pandas supports multiindex columns, so you could preserve it, but I'd recommend just getting rid of either of the first two rows
hmm, no not juncao.
I'd drop them from cataerizacao and the other df. But, whatever you want.
the first row its the column name, the second its the subtitle
or like etrotta said, if you really need the title and subtitle, you can multiindex it or concat them... but I don't think you need it for this problem
use pd.read_excel(..., skiprows=1)
the subtitle its in 1556 row
because i merged
the first column its the HASHTAG (id)
for the two sheets, datas
so i merged by ID
and the subtitle went to the 1556
fix it before merging bruh
whatever you are doing, make sure you always keep a copy of the original data and the code needed to reproduce your results
i was trying to put the 1556 in 1 but i will delete then ahaha
thanks guys
is this the same?
juncao2 = juncao.drop(juncao.index[1556])
No, i was just showing you how to remove from the two dataframes before merging them.
If it's the first row, then [1:] will exclude it
when i use skiprows=1, skipped the first who is the title ahaha
i will delete, thats it
(you can close this thread)
This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.