Skip to content

Commit

Permalink
Added 'pandas' as option for missing
Browse files Browse the repository at this point in the history
  • Loading branch information
ticoneva committed Oct 8, 2022
1 parent 7eff2d9 commit 112ffc8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ The following settings are permitted inside the configuration file:
- 'False': the kernel will not echo single commands.
Default is 'False'.
- `splash`: controls display of the splash message during Stata startup. Default is 'True'.
- `missing`: What should be displayed in the output of the `*%browse` magic for a missing value. Default is '.', following Stata. To defer to pandas' format for `NA`, specify `None`.
- `missing`: What should be displayed in the output of the `*%browse` magic for a missing value. Default is '.', following Stata. To defer to pandas' format for `NA`, specify 'pandas'.

Settings must be under the title `[pystata-kernel]`. Example:

Expand Down
6 changes: 4 additions & 2 deletions pystata-kernel/magics.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,10 @@ def magic_browse(self,args,kernel):
obs_range = range(0,min(count(),N_max))

# Missing value display format
missingval = env['missing'] if env['missing'] is not None else np.NaN

missingval = np.NaN
if env['missing'] is not None and env['missing'] != 'pandas':
missingval = env['missing']

try:
df = better_pdataframe_from_data(obs=obs_range,
var=vars,
Expand Down

0 comments on commit 112ffc8

Please sign in to comment.