
GITHUB . COM {
}
Detected CMS Systems:
- Wordpress (2 occurrences)
Title:
BUG: 'Series.to_numpy(dtype=, na_value=)' behaves differently with 'pd.NA' and 'np.nan' Β· Issue #48951 Β· pandas-dev/pandas
Description:
Pandas version checks I have checked that this issue has not already been reported. I have confirmed this bug exists on the latest version of pandas. I have confirmed this bug exists on the main branch of pandas. Reproducible Example imp...
Website Age:
17 years and 8 months (reg. 2007-10-09).
Matching Content Categories {π}
- Technology & Computing
- Video & Online Content
- Education
Content Management System {π}
What CMS is github.com built with?
Github.com is based on WORDPRESS.
Traffic Estimate {π}
What is the average monthly size of github.com audience?
ππ Tremendous Traffic: 10M - 20M visitors per month
Based on our best estimate, this website will receive around 10,653,780 visitors per month in the current month.
check SE Ranking
check Ahrefs
check Similarweb
check Ubersuggest
check Semrush
How Does Github.com Make Money? {πΈ}
Subscription Packages {π³}
We've located a dedicated page on github.com that might include details about subscription plans or recurring payments. We identified it based on the word pricing in one of its internal links. Below, you'll find additional estimates for its monthly recurring revenues.How Much Does Github.com Make? {π°}
Subscription Packages {π³}
Prices on github.com are in US Dollars ($).
They range from $4.00/month to $21.00/month.
We estimate that the site has approximately 5,316,107 paying customers.
The estimated monthly recurring revenue (MRR) is $22,327,651.
The estimated annual recurring revenues (ARR) are $267,931,808.
Wordpress Themes and Plugins {π¨}
What WordPress theme does this site use?
It is strange but we were not able to detect any theme on the page.
What WordPress plugins does this website use?
It is strange but we were not able to detect any plugins on the page.
Keywords {π}
navalue, pdna, pandas, bug, issue, pdseries, line, npnan, typeerror, marcogorelli, printxtonumpyint, file, argument, member, commented, sign, seriestonumpydtype, tonumpy, result, npasarrayselfvalues, dtypedtype, string, number, natype, projects, behaves, differently, traceback, recent, call, float, fails, phofl, copy, related, nullable, type, array, baloe, navigation, open, pull, requests, actions, security, closed, description, bbassetttibco, version, confirmed,
Topics {βοΈ}
src\venv\w310\lib\site-packages\pandas\core\base file ~/pandas-dev/pandas/core/base pandas/pandas/core/base integer-type pandas data 'natype' issue description nullable extension arrays personal information bug comment metadata assignees import pandas type projects fourth 'float64' case latest version represent missing values marcogorelli mentioned nullable type lib pd import numpy baloe edits open projects milestone bug exists pandas triage issue phofl mentioned objecttypeseries = floattypeseries result = np ' behaves differently main branch recent call raised exception exception raises related converting milestone relationships dtype=object real number print statements github dtype='float64' dtype=dtype bug issue floattypeseries 'natype' print respecting na_value x2 = pd dtype=float na_value=np na fails expected behavior
Payment Methods {π}
- Braintree
Questions {β}
- Already have an account?
- Could you post this in #48891?
- Is it a problem with numpy?
- NA is experimental ?
Schema {πΊοΈ}
DiscussionForumPosting:
context:https://schema.org
headline:BUG: 'Series.to_numpy(dtype=, na_value=)' behaves differently with 'pd.NA' and 'np.nan'
articleBody:### Pandas version checks
- [X] I have checked that this issue has not already been reported.
- [X] I have confirmed this bug exists on the [latest version](https://pandas.pydata.org/docs/whatsnew/index.html) of pandas.
- [ ] I have confirmed this bug exists on the main branch of pandas.
### Reproducible Example
```python
import pandas as pd
import numpy as np
x1 = pd.Series([1, 2, None, 4])
x2 = pd.Series([1, 2, np.nan, 4])
x3 = pd.Series([1, 2, pd.NA, 4])
print(x1.to_numpy('int32', na_value=0))
# [1 2 0 4]
print(x2.to_numpy('int32', na_value=0))
# [1 2 0 4]
print(x3.to_numpy('int32', na_value=0))
# Traceback (most recent call last):
# File "<input>", line 14, in <module>
# print(x3.to_numpy('int32', na_value=0))
# File "C:\src\venv\w310\lib\site-packages\pandas\core\base.py", line 535, in to_numpy
# result = np.asarray(self._values, dtype=dtype)
# TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NAType'
print(x3.to_numpy('float64', na_value=0))
# Traceback (most recent call last):
# File "<input>", line 22, in <module>
# print(x3.to_numpy('float64', na_value=0))
# File "C:\src\venv\w310\lib\site-packages\pandas\core\base.py", line 535, in to_numpy
# result = np.asarray(self._values, dtype=dtype)
# TypeError: float() argument must be a string or a real number, not 'NAType'
```
### Issue Description
It appears that a Series that has a missing value that was created using either `None` or `np.nan` can be replaced by using `Series.to_numpy(dtype=, na_value=)`, but one created with `pd.NA` fails with a raised exception (both arguments must be specified to trigger the behavior).
### Expected Behavior
It is expected that since all three values (`None`, `np.nan`, and `pd.NA`) all represent missing values, that all three should behave the same. For the above reproducible example, the print statements should all report `[1 2 0 4]` (or `[1. 2. 0. 4.]` for the fourth 'float64' case).
### Installed Versions
<details>
INSTALLED VERSIONS
------------------
commit : 87cfe4e38bafe7300a6003a1d18bd80f3f77c763
python : 3.10.6.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19043
machine : AMD64
processor : Intel64 Family 6 Model 158 Stepping 13, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : English_United States.1252
pandas : 1.5.0
numpy : 1.23.3
pytz : 2022.2.1
dateutil : 2.8.2
setuptools : 65.3.0
pip : 22.2.2
Cython : 0.29.32
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.9.1
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
brotli : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : 3.6.0
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : None
snappy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
zstandard : None
tzdata : NoneReplace this line with the output of pd.show_versions()
</details>
author:
url:https://github.com/bbassett-tibco
type:Person
name:bbassett-tibco
datePublished:2022-10-05T03:27:00.000Z
interactionStatistic:
type:InteractionCounter
interactionType:https://schema.org/CommentAction
userInteractionCount:5
url:https://github.com/48951/pandas/issues/48951
context:https://schema.org
headline:BUG: 'Series.to_numpy(dtype=, na_value=)' behaves differently with 'pd.NA' and 'np.nan'
articleBody:### Pandas version checks
- [X] I have checked that this issue has not already been reported.
- [X] I have confirmed this bug exists on the [latest version](https://pandas.pydata.org/docs/whatsnew/index.html) of pandas.
- [ ] I have confirmed this bug exists on the main branch of pandas.
### Reproducible Example
```python
import pandas as pd
import numpy as np
x1 = pd.Series([1, 2, None, 4])
x2 = pd.Series([1, 2, np.nan, 4])
x3 = pd.Series([1, 2, pd.NA, 4])
print(x1.to_numpy('int32', na_value=0))
# [1 2 0 4]
print(x2.to_numpy('int32', na_value=0))
# [1 2 0 4]
print(x3.to_numpy('int32', na_value=0))
# Traceback (most recent call last):
# File "<input>", line 14, in <module>
# print(x3.to_numpy('int32', na_value=0))
# File "C:\src\venv\w310\lib\site-packages\pandas\core\base.py", line 535, in to_numpy
# result = np.asarray(self._values, dtype=dtype)
# TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NAType'
print(x3.to_numpy('float64', na_value=0))
# Traceback (most recent call last):
# File "<input>", line 22, in <module>
# print(x3.to_numpy('float64', na_value=0))
# File "C:\src\venv\w310\lib\site-packages\pandas\core\base.py", line 535, in to_numpy
# result = np.asarray(self._values, dtype=dtype)
# TypeError: float() argument must be a string or a real number, not 'NAType'
```
### Issue Description
It appears that a Series that has a missing value that was created using either `None` or `np.nan` can be replaced by using `Series.to_numpy(dtype=, na_value=)`, but one created with `pd.NA` fails with a raised exception (both arguments must be specified to trigger the behavior).
### Expected Behavior
It is expected that since all three values (`None`, `np.nan`, and `pd.NA`) all represent missing values, that all three should behave the same. For the above reproducible example, the print statements should all report `[1 2 0 4]` (or `[1. 2. 0. 4.]` for the fourth 'float64' case).
### Installed Versions
<details>
INSTALLED VERSIONS
------------------
commit : 87cfe4e38bafe7300a6003a1d18bd80f3f77c763
python : 3.10.6.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19043
machine : AMD64
processor : Intel64 Family 6 Model 158 Stepping 13, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : English_United States.1252
pandas : 1.5.0
numpy : 1.23.3
pytz : 2022.2.1
dateutil : 2.8.2
setuptools : 65.3.0
pip : 22.2.2
Cython : 0.29.32
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.9.1
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
brotli : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : 3.6.0
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : None
snappy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
zstandard : None
tzdata : NoneReplace this line with the output of pd.show_versions()
</details>
author:
url:https://github.com/bbassett-tibco
type:Person
name:bbassett-tibco
datePublished:2022-10-05T03:27:00.000Z
interactionStatistic:
type:InteractionCounter
interactionType:https://schema.org/CommentAction
userInteractionCount:5
url:https://github.com/48951/pandas/issues/48951
Person:
url:https://github.com/bbassett-tibco
name:bbassett-tibco
url:https://github.com/bbassett-tibco
name:bbassett-tibco
InteractionCounter:
interactionType:https://schema.org/CommentAction
userInteractionCount:5
interactionType:https://schema.org/CommentAction
userInteractionCount:5
External Links {π}(4)
- How much does https://github.blog earn?
- How much does https://pandas.pydata.org/docs/whatsnew/index.html generate monthly?
- Learn how profitable https://pandas.pydata.org/pandas-docs/stable/whatsnew/v1.0.0.html#experimental-new-features is on a monthly basis
- How much profit does https://www.githubstatus.com/ make?
Analytics and Tracking {π}
- Site Verification - Google
Libraries {π}
- Clipboard.js
- D3.js
- Lodash
Emails and Hosting {βοΈ}
Mail Servers:
- aspmx.l.google.com
- alt1.aspmx.l.google.com
- alt2.aspmx.l.google.com
- alt3.aspmx.l.google.com
- alt4.aspmx.l.google.com
Name Servers:
- dns1.p08.nsone.net
- dns2.p08.nsone.net
- dns3.p08.nsone.net
- dns4.p08.nsone.net
- ns-1283.awsdns-32.org
- ns-1707.awsdns-21.co.uk
- ns-421.awsdns-52.com
- ns-520.awsdns-01.net