You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reading in a csv file with the following line
T,FMG,20200803,000000,10071068,,,20200804,,,XT,,,,
results in pandas ignoring the 4th column, and matches the current column to the next value (10071068) in that case.
type symbol Date ... QuotationBasis ExchangeRate TradeAttributes
T FMG 20200803 000000 ... NaN NaN NaN
where T is moved to the index, cause your names are shorter than the data. This means that the 0 is moved to date.
Please provide something which can be executed and narrow it down to the relevant part. I don't think that most of your columns on the right side of the 0000 are necessary. For example the following is executable:
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Code Sample, a copy-pastable example
Problem description
Reading in a csv file with the following line
T,FMG,20200803,000000,10071068,,,20200804,,,XT,,,,
results in pandas ignoring the 4th column, and matches the current column to the next value (10071068) in that case.
Previous reports suggested setting the dtype to string (see https://stackoverflow.com/questions/13250046/how-to-keep-leading-zeros-in-a-column-when-reading-csv-with-pandas), which should be fine if the column is read in as "0000000", but apparently it is not. Am I missing something?
Current output:
-- | -- | -- | -- | --
71068 | FMG | 20200803 | 10071068 | 20200803.0 ...
Expected Output
-- | -- | -- | -- | --
71068 | FMG | 20200803 | 000000 | 10071068 | 20200803.0 ...
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : 67a3d42
python : 3.8.5.final.0
python-bits : 64
OS : Linux
OS-release : 5.8.0-7642-generic
Version : #47
161228899020.04~b8113e7-Ubuntu SMP Wed Feb 3 02:25:36 UTC 2machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.1.4
numpy : 1.19.4
pytz : 2020.4
dateutil : 2.8.1
pip : 20.3.3
setuptools : 51.3.3.post20210118
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.6.2
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.19.0
pandas_datareader: None
bs4 : 4.9.3
bottleneck : None
fsspec : None
fastparquet : 0.5.0
gcsfs : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : 3.0.6
pandas_gbq : None
pyarrow : None
pytables : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : 1.3.22
tables : None
tabulate : None
xarray : None
xlrd : 2.0.1
xlwt : None
numba : 0.52.0
The text was updated successfully, but these errors were encountered: