import pandas as pd
patient={'patientno':[2000,2010,2022,2024,2100,2330,2345,2479,2526,2556,2567,2768,2897,2999,3000],
'patientname':['Ramlal Tukkaram','Jethalal Gada','Karen Smith','Phoebe Buffet','Lily Aldrin','Sugmadi Kplese','Chad Broman','Babu Rao','Barney Stinson', 'Leegma Bawles','Ted Bundy','Pediphilee Kyler','Regina George','Mikasa Ackerman','Levi Ackerman'],
'age':[22,45,17,32,32,42,45,42,31,22,35,34,17,19,36],
'roomno':[20,60,48,13,12,69,32,40,21,63,1,54,12,68,14],
'contactdetails':[4934944909,7685948576,5343258732,3846384849,2843839493,3237273888,9808909778,9089786756,7757586867,8878777999,7687677756,8789675758,7766969866,9078787867,6656565658],
'diagnosis':['Dementia','Schizophenia','Intellectual Disability','Hepatitis','Child Birth','Piles','Diarrhoea','Corona','Gonorrhea','Cardiac Arrest','Psychopathy','Freak Accident','Road Accident','Attachment Issues','Depression’ ,’OCD'],
'admitdate':['12.01.2022','13.01.2022','17.01.2022','04.01.2022','17.01.2022','12.01.2022','04.01.2022','15.01.2022','05.01.2022','13.01.2022','08.01.2022','01.01.2022','08.01.2022','10.01.2022','06.01.2022'],
'dischargedate':['18.01.2022','17.01.2022','18.01.2022','09.01.2022','21.01.2022','15.01.2022','08.01.2022','18.01.2022','16.01.2022','17.01.2022','18.01.2022','14.01.2022','15.01.2022','13.01.2022','22.01.2022']}
df= pd.DataFrame(patient)
print(df)
OUTPUT
patientno patientname ... admitdate dischargedate
0 2000 Ramlal Tukkaram ... 12.01.2022 18.01.2022
1 2010 Jethalal Gada ... 13.01.2022 17.01.2022
2 2022 Karen Smith ... 17.01.2022 18.01.2022
3 2024 Phoebe Buffet ... 04.01.2022 09.01.2022
4 2100 Lily Aldrin ... 17.01.2022 21.01.2022
5 2330 Sugmadi Kplese ... 12.01.2022 15.01.2022
6 2345 Chad Broman ... 04.01.2022 08.01.2022
7 2479 Babu Rao ... 15.01.2022 18.01.2022
8 2526 Barney Stinson ... 05.01.2022 16.01.2022
9 2556 Leegma Bawles ... 13.01.2022 17.01.2022
10 2567 Ted Bundy ... 08.01.2022 18.01.2022
11 2768 Pediphilee Kyler ... 01.01.2022 14.01.2022
12 2897 Regina George ... 08.01.2022 15.01.2022
13 2999 Mikasa Ackerman ... 10.01.2022 13.01.2022
14 3000 Levi Ackerman ... 06.01.2022 22.01.2022
[15 rows x 8 columns]
Try to remove the limit on the number of displayed columns with:
pd.options.display.max_columns = None
The dataframe has 8 columns, it's just that not all are shown.
It is due to space ( width) that you see only four columns( the first two and last two) and the rest are represented by the three dots "...". There is nothing wrong except that pandas shows partially due to spacing ( width).
print(df) hides some columns by default.
You could either change the pandas display options mentioned by @user2314737, or you could try df.head() instead.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.