Ok WouterDeCoster, I keep only one ":" by line (only in the informations that I need.
The following error is reported:
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
<ipython-input-6-286eb07c422e> in <module>()
22 # converting dictionary to dataframe
23 dictio_df = pd.DataFrame.from_dict(dictio, orient='index',
---> 24 columns=['Input','Total Sites', 'Polymorphic Sites', 'Pi', 'ZnS', 'Za','ZZ', 'r^2','Pairwise Comparisons','Fischer','Chi^2','Tajimas D','Syn','NonSyn','Sil'])
25 #writing output
26 with open("output.csv", "wt") as out:
~/anaconda3/lib/python3.6/site-packages/pandas/core/frame.py in from_dict(cls, data, orient, dtype, columns)
983 raise ValueError('only recognize index or columns for orient')
984
--> 985 return cls(data, index=index, columns=columns, dtype=dtype)
986
987 def to_dict(self, orient='dict', into=dict):
~/anaconda3/lib/python3.6/site-packages/pandas/core/frame.py in __init__(self, data, index, columns, dtype, copy)
385 if is_named_tuple(data[0]) and columns is None:
386 columns = data[0]._fields
--> 387 arrays, columns = _to_arrays(data, columns, dtype=dtype)
388 columns = _ensure_index(columns)
389
~/anaconda3/lib/python3.6/site-packages/pandas/core/frame.py in _to_arrays(data, columns, coerce_float, dtype)
7454 data = lmap(tuple, data)
7455 return _list_to_arrays(data, columns, coerce_float=coerce_float,
-> 7456 dtype=dtype)
7457
7458
~/anaconda3/lib/python3.6/site-packages/pandas/core/frame.py in _list_to_arrays(data, columns, coerce_float, dtype)
7511 content = list(lib.to_object_array(data).T)
7512 return _convert_object_array(content, columns, dtype=dtype,
-> 7513 coerce_float=coerce_float)
7514
7515
~/anaconda3/lib/python3.6/site-packages/pandas/core/frame.py in _convert_object_array(content, columns, coerce_float, dtype)
7569 raise AssertionError('{col:d} columns passed, passed data had '
7570 '{con} columns'.format(col=len(columns),
-> 7571 con=len(content)))
7572
7573 # provide soft conversion of object dtypes
AssertionError: 15 columns passed, passed data had 44 columns
If I print the dictionary content:
Input Data File : {'f', 'X', 'l', 'p', 's', 'S', 'n', 'C', 'i', 'B', 'a', '\\', 'A', 'g', '.', '8', 'G', 'x', 'e', 'R', 'T', 'r', '4', '7', 'o', '9', '1', '5', 'c', 'd', '_', 'I', '0', '3', '6', 'N', 'O', 'E', 'v', '2', 'F', 'V', 'D', 't'}
Number of sites : {' ', '2', '3', '6', '7'}
Variable (polymorphic) sites : {'f', 'l', 'b', 's', 'n', 'i', 'a', ')', 'm', '(', 'T', 'r', 't', '4', '7', 'o', '9', '1', '5', '_', '3', '0', '6', ' ', 'u', '2', 'e'}
Nucleotide diversity, Pi : {' ', '9', '1', '5', '3', '8', '2', '4', '0', ',', '6', '7'}
Number of pairwise comparisons : {'9', ' ', '3', '5', '1', '8', '2', '4', '0', '6', '7'}
Number of significant pairwise comparisons by Fisher's exact test : {' ', '9', '1', '5', '3', '8', '2', '4', '0', '6', '7'}
Number of significant pairwise comparisons by chi-square test : {' ', '9', '1', '5', '3', '8', '2', '4', '0', '6', '7'}
Value of ZnS (Kelly 1997) : {' ', '9', '1', '5', '3', '8', '2', '4', '0', ',', '6', '7'}
Value of Za (Rozas et al. 2001) : {' ', '9', '1', '5', '3', '8', '2', '4', '0', ',', '6', '7'}
Value of ZZ (Rozas et al. 2001) : {' ', '9', '1', '3', '5', '8', '-', '2', '4', '0', ',', '6', '7'}
r^2 values : {'Y', 'X', 'p', 's', 'i', 'n', ')', '+', '(', '8', '4', ',', '=', '7', 'o', '9', '1', '5', '-', '0', '3', '6', ' ', '2', 't'}
Tajima's D : {'f', 'l', 's', 'S', 'i', 'n', 'a', 'g', '.', '8', 't', '4', ',', '7', '9', '1', '5', 'c', '_', '0', '-', '3', '<', '6', ' ', '*', 'P', '2', 'e'}
Coding region_ Tajima's D : {' ', '*', '.', '6', '9', '1', 'P', '5', '3', '8', '-', '2', '4', '0', ',', '<', '7'}
NonSynonymous sites_ Tajima's D(NonSyn) : {' ', '*', '.', '9', '6', '1', 'P', '5', '3', '0', '4', '-', ',', '<', '7'}
Apparently, I have a great error inside my code.
Content moved to comment.
Please use
ADD COMMENT/ADD REPLYwhen responding to existing posts to keep threads logically organized.SUBMIT ANSWERis for new answers to original question.Right genomax, I fixed that, thanks.
Hello flogin!
We believe that this post does not fit the main topic of this site.
I was able to solve
For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.
If you disagree please tell us why in a reply below, we'll be happy to talk about it.
Cheers!