I have a very large script, to large to post here, so I hope that someone can help me without posting the whole script... In my script, I have multiple columns with numbers (columns 'AAAAA':'TTTTT'), and I divide those numbers with the number in one column ('kmer_number'). The output is written to new columns. This is done by this command
df5d[['Column{}'.format(i) for i in range(2003, 2003+(2002-979)+1)]] = df5d.loc[:, 'AAAAA':'TTTTT'].div(df5d['kmer_number'], axis=0)
The output in the new columns are numbers with > 8 decimals and I want to convert those to scientific notifications
My output is like this
Column2972 Column2973 Column2974
0.000755306 0.00025591 0.000305601
0.000783782 0.000265844 0.000433143
0 0 0
0.000817596 0.000281049 0.000309438
0.000819018 0.000262932 0.000386843
I tried the following command
df5d[2003:3026] = df5d[2003:3026].map('{:.2e}'.format)
but this gave the error
"Traceback (most recent call last):
File "pythonscript_v10.py", line 226, in <module>
df5d[2003:3026] = df5d[2003:3026].map('{:.2e}'.format)
File "/usr/lib/python3/dist-packages/pandas/core/generic.py", line 2360, in __getattr__
(type(self).__name__, name))
AttributeError: 'DataFrame' object has no attribute 'map'