-2
list = []
for df in lp:
           list.append(list(df.loc[985191]))
        list(list of list)
T = pd.DataFrame(list)

Hi I have this code to python but when I returned, shows me an error

IndentationError: unindent does not match any outer indentation level

what can be the error?

Kamran
  • 14,987
  • 4
  • 33
  • 51
  • The indentation of statement "list.append(..)" and "list(list...") should be the same. – zhenguoli Jul 19 '18 at 03:23
  • You should have the lines that start with `list.append(` and `list(list of` indented to the same column. Also, note that calling your variable `list` shadows a builtin name and will cause additional problems. – Brian Cain Jul 19 '18 at 03:24
  • @BrianCain Do you know how can I fix that about the list, cause I 've already fix the indented but you're right, it shows me another problem with the list – Lucia Bazan Jul 19 '18 at 17:02
  • Don't assign to a name called `list`, think of it as a reserved name. e.g. `something = []` and not `list = []`. What is `list(list of list)` supposed to do? – Brian Cain Jul 19 '18 at 20:54
  • @BrianCain It's supposed join all the columns of lp. lp is a list from 40 dataframes, and I want to extract all the same column names of those dataframes and put in a singles df acording the column name – Lucia Bazan Jul 19 '18 at 21:11
  • Try and ask a new SO question about that one and the error you're getting. – Brian Cain Jul 20 '18 at 02:49

1 Answers1

0

You indented this line list.append(list(df.loc[985191])) too far in. Try this.

 list = []
    for df in lp:
            list.append(list(df.loc[985191]))
            list(list of list)
    T = pd.DataFrame(list)
23k
  • 1,596
  • 3
  • 23
  • 52