0

I exported a csv file from A code file

A col
-----
0 10
-----
1 10
-----

but when I read it in other B code file, there are some missing values in the dataframe

B col
----
0 10
----
1 5
----

I expected to see:

B col
----
0 10
----
1 10
----

I already cross checked the missing values show in the B code file with in A code file, it does has data in the A code file, but missing in the B code file with no reasons.

May I know why the number of rows differ? Thank you

My code:

dfA.to_csv("df.csv", index=False)
dfB = pd.read_csv("df.csv")
Irene Hsu
  • 1
  • 2
  • 2
    show your code. – Nesi Aug 06 '23 at 10:09
  • @Nesi Hi, I attached the code in the post. Thank you – Irene Hsu Aug 06 '23 at 10:12
  • [Please read this](https://stackoverflow.com/help/minimal-reproducible-example) – Nesi Aug 06 '23 at 10:16
  • @Nesi Hi I read it. Thank you. I already found what the issue is. I checked the file I exported, it does have some missing values in the column. It just doesn't show in the output when I ran df.info() in A code file – Irene Hsu Aug 06 '23 at 10:27
  • please refer to this [link](https://stackoverflow.com/questions/47786584/python-not-identifying-null-values-even-though-it-is-present-in-the-pandas-dat) if you face the same issue – Irene Hsu Aug 06 '23 at 10:29
  • Please post a sample of your CSV that reproduces your problem. CSV is a text file so it's content can be copied from a text editor to this post. See [How to make good reproducible pandas examples?](https://stackoverflow.com/q/20109391/1422451) – Parfait Aug 06 '23 at 15:24

0 Answers0