pandas - forward fill method fills extended rows -
forward fill method overwrites 'na' values original file. there way treat "na" literally instead of converting nan while reading file?
!wget https://s3.amazonaws.com/datameetgeo/sample.txt import pandas pd df=pd.read_csv('sample.txt', sep='\t') df=df.fillna(method='ffill')
as can seen in above example, value of "c-54465" carried forward next college code 954. wrong , should limited first 22 rows. there way control how ffill works or how "na" values treaded while reading?
by default pd.read_csv
interprets na
null. can turn off parameter keep_default_na=false
pd.read_csv('sample.txt', sep='\t', keep_default_na=false)
Comments
Post a Comment