selik / xport

Python reader and writer for SAS XPORT data transport files.
MIT License
49 stars 24 forks source link

ds=xport.Dataset(df, name='MAX8CHRS', label='Up to 40!') about "name" and "label" variable #87

Closed lishuaiyin02 closed 2 years ago

lishuaiyin02 commented 2 years ago

Hi,Blogger,I wish to consult you on a few questions. First, I want to the name above 8 characters, and labels above 40 characters. Can I do it? Second, if I want to let the label variable become chinese, for example : xport.Dataset(df, name='MAX8CHRS', label='我我我'), what can I do to achieve it. By the way, I find in xport=3.2.1and pandas=1.0.3 the label is a description for dataset, however, in xport=3.5.0 and pandas=1.3.5 the label add every column. I want to achieve as follow: image

Third, I want to add labels for every column, I find I can use as below: for k, v in ds.items(): v.label = k.title() if v.dtype == 'object': v.format = '$CHAR20.' else: v.format = '10.2'

however, I find v.label only is English characters, I want to let it become Chinese characters, for example: for k, v in ds.items(): v.label = "您您您" if v.dtype == 'object': v.format = '$CHAR20.' else: v.format = '10.2' the result picture as follow: image

Now,I am use xport=3.2.1and pandas=1.0.3 and write use xport.v56.dump(ds, f) Please help me ! Thank you very much!

Because I am a Chinese developer, my English is poor, so there may be errors in the expression. Please forgive me.

gaineleanor commented 2 years ago

你好 因为原来版本的编码问题需要自己计算长度.

可以加好友吗. 同为中文开发者. 微信 rock_guo

selik commented 2 years ago

This is a duplicate of #75

selik commented 2 years ago

Note that #89 may implement what you want.