
GITHUB . COM {
}
Detected CMS Systems:
- Wordpress (2 occurrences)
Title:
API: Consistency between DataFrame, MultiIndex.to_frame and reset_index Β· Issue #45245 Β· pandas-dev/pandas
Description:
DataFrame, MultiIndex.to_frame, Series.reset_index and DataFrame.reset_index all create DataFrames. In most cases they are the same. But in the following cases they behave differently: bool values: DataFrame: bool to_frame: object reset_...
Website Age:
17 years and 8 months (reg. 2007-10-09).
Matching Content Categories {π}
- Family & Parenting
- Mobile Technology & AI
- Dating & Relationships
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,000,019 visitors per month in the current month.
However, some sources were not loaded, we suggest to reload the page to get complete results.
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 4,989,889 paying customers.
The estimated monthly recurring revenue (MRR) is $20,957,532.
The estimated annual recurring revenues (ARR) are $251,490,385.
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 {π}
int, dtype, dataframe, object, toframe, dtypes, resetindex, values, column, names, bool, consistency, level, false, true, printfdfndtypesndfdtypes, sign, api, multiindextoframe, allowduplicates, conversions, pandas, projects, issue, johnzangwill, nan, raise, navigation, open, pull, requests, actions, security, cases, missing, number, leveln, duplicated, suggest, printnresetindex, pddataframeindexindexresetindex, valueerror, kwargs, return, cusersjohnonedrivedocumentsgithubpandasjohnzangwillpandascoreframepy, insert, exists, mentioned, labels, added,
Topics {βοΈ}
users\john\onedrive\documents\github\pandas_johnzangwill\pandas\util\_decorators users\john\onedrive\documents\github\pandas_johnzangwill\pandas\core\frame ~\appdata\local\temp/ipykernel_21224/810260565 personal information api bool missing column comment metadata assignees import pandas silently skips reset_index duplicated column names additional parameter allow_duplicates type projects github bool dtype projects milestone int64 dtype object dtype 'b'] dataframe consistency column number nan to_frame 'a'] dataframe bool to_frame default false index=false insert {column} as_index=false object to_frame bool values object reset_index object reset_index create dataframes behave differently current situation index=index recent call index = new_index milestone relationships index = pd add allow_duplicates object values {df}\ndtypes df = index df = pd dataframe ] dataframe level columns=names names=names column exists
Payment Methods {π}
- Braintree
Questions {β}
- 4434 # Should this be a different kind of error?
- Already have an account?
Schema {πΊοΈ}
DiscussionForumPosting:
context:https://schema.org
headline:API: Consistency between DataFrame, MultiIndex.to_frame and reset_index
articleBody:DataFrame, MultiIndex.to_frame, Series.reset_index and DataFrame.reset_index all create DataFrames. In most cases they are the same. But in the following cases they behave differently:
- bool values:
- DataFrame: bool
- to_frame: object
- reset_index: bool
- Missing column name:
- DataFrame: NaN
- to_frame: n (where n is the column number)
- reset_index: level_n (where n is the column number)
- Duplicated column names:
- DataFrame: creates them
- to_frame: silently skips
- reset_index: raises
I suggest the following changes:
- bool values: to_frame should restore bool dtype
- Missing level name: to_frame should use level_n, as do many other Pandas methods
- Duplicated level name: to_frame should raise
I would also suggest that both to_frame and reset_index have an additional parameter `allow_duplicates`, default False, but this seems controversial (#44755)...
This illustrates the current situation:
```
import pandas as pd
for (values, names) in [
([(1, 2),(3, 4)],["a", "b"]),
([(1, True),(3, False)],["a", "b"]),
([(1, 2),(3, 4)],["a", None]),
([(1, 2),(3, 4)],["a", "a"]),
]:
print(f"\nvalues: {values}, names: {names}")
print("\nDataFrame")
df = pd.DataFrame(values, columns=names)
print(f"{df}\nDtypes:\n{df.dtypes}")
print("\nto_frame")
index = pd.MultiIndex.from_tuples(values, names=names)
df = index.to_frame(index=False)
print(f"{df}\nDtypes:\n{df.dtypes}")
print("\nreset_index")
df = pd.DataFrame(index=index).reset_index()
print(f"{df}\nDtypes:\n{df.dtypes}")
values: [(1, 2), (3, 4)], names: ['a', 'b']
DataFrame
a b
0 1 2
1 3 4
Dtypes:
a int64
b int64
dtype: object
to_frame
a b
0 1 2
1 3 4
Dtypes:
a int64
b int64
dtype: object
reset_index
a b
0 1 2
1 3 4
Dtypes:
a int64
b int64
dtype: object
values: [(1, True), (3, False)], names: ['a', 'b']
DataFrame
a b
0 1 True
1 3 False
Dtypes:
a int64
b bool
dtype: object
to_frame
a b
0 1 True
1 3 False
Dtypes:
a int64
b object
dtype: object
reset_index
a b
0 1 True
1 3 False
Dtypes:
a int64
b bool
dtype: object
values: [(1, 2), (3, 4)], names: ['a', None]
DataFrame
a NaN
0 1 2
1 3 4
Dtypes:
a int64
NaN int64
dtype: object
to_frame
a 1
0 1 2
1 3 4
Dtypes:
a int64
1 int64
dtype: object
reset_index
a level_1
0 1 2
1 3 4
Dtypes:
a int64
level_1 int64
dtype: object
values: [(1, 2), (3, 4)], names: ['a', 'a']
DataFrame
a a
0 1 2
1 3 4
Dtypes:
a int64
a int64
dtype: object
to_frame
a
0 2
1 4
Dtypes:
a int64
dtype: object
reset_index
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_21224/810260565.py in <module>
14 print(f"{df}\nDtypes:\n{df.dtypes}")
15 print("\nreset_index")
---> 16 df = pd.DataFrame(index=index).reset_index()
17 print(f"{df}\nDtypes:\n{df.dtypes}")
c:\users\john\onedrive\documents\github\pandas_johnzangwill\pandas\util\_decorators.py in wrapper(*args, **kwargs)
309 stacklevel=stacklevel,
310 )
--> 311 return func(*args, **kwargs)
312
313 return wrapper
c:\users\john\onedrive\documents\github\pandas_johnzangwill\pandas\core\frame.py in reset_index(self, level, drop, inplace, col_level, col_fill)
5832 )
5833
-> 5834 new_obj.insert(0, name, level_values)
5835
5836 new_obj.index = new_index
c:\users\john\onedrive\documents\github\pandas_johnzangwill\pandas\core\frame.py in insert(self, loc, column, value, allow_duplicates)
4433 if not allow_duplicates and column in self.columns:
4434 # Should this be a different kind of error??
-> 4435 raise ValueError(f"cannot insert {column}, already exists")
4436 if not isinstance(loc, int):
4437 raise TypeError("loc must be int")
ValueError: cannot insert a, already exists
```
author:
url:https://github.com/johnzangwill
type:Person
name:johnzangwill
datePublished:2022-01-07T12:23:23.000Z
interactionStatistic:
type:InteractionCounter
interactionType:https://schema.org/CommentAction
userInteractionCount:0
url:https://github.com/45245/pandas/issues/45245
context:https://schema.org
headline:API: Consistency between DataFrame, MultiIndex.to_frame and reset_index
articleBody:DataFrame, MultiIndex.to_frame, Series.reset_index and DataFrame.reset_index all create DataFrames. In most cases they are the same. But in the following cases they behave differently:
- bool values:
- DataFrame: bool
- to_frame: object
- reset_index: bool
- Missing column name:
- DataFrame: NaN
- to_frame: n (where n is the column number)
- reset_index: level_n (where n is the column number)
- Duplicated column names:
- DataFrame: creates them
- to_frame: silently skips
- reset_index: raises
I suggest the following changes:
- bool values: to_frame should restore bool dtype
- Missing level name: to_frame should use level_n, as do many other Pandas methods
- Duplicated level name: to_frame should raise
I would also suggest that both to_frame and reset_index have an additional parameter `allow_duplicates`, default False, but this seems controversial (#44755)...
This illustrates the current situation:
```
import pandas as pd
for (values, names) in [
([(1, 2),(3, 4)],["a", "b"]),
([(1, True),(3, False)],["a", "b"]),
([(1, 2),(3, 4)],["a", None]),
([(1, 2),(3, 4)],["a", "a"]),
]:
print(f"\nvalues: {values}, names: {names}")
print("\nDataFrame")
df = pd.DataFrame(values, columns=names)
print(f"{df}\nDtypes:\n{df.dtypes}")
print("\nto_frame")
index = pd.MultiIndex.from_tuples(values, names=names)
df = index.to_frame(index=False)
print(f"{df}\nDtypes:\n{df.dtypes}")
print("\nreset_index")
df = pd.DataFrame(index=index).reset_index()
print(f"{df}\nDtypes:\n{df.dtypes}")
values: [(1, 2), (3, 4)], names: ['a', 'b']
DataFrame
a b
0 1 2
1 3 4
Dtypes:
a int64
b int64
dtype: object
to_frame
a b
0 1 2
1 3 4
Dtypes:
a int64
b int64
dtype: object
reset_index
a b
0 1 2
1 3 4
Dtypes:
a int64
b int64
dtype: object
values: [(1, True), (3, False)], names: ['a', 'b']
DataFrame
a b
0 1 True
1 3 False
Dtypes:
a int64
b bool
dtype: object
to_frame
a b
0 1 True
1 3 False
Dtypes:
a int64
b object
dtype: object
reset_index
a b
0 1 True
1 3 False
Dtypes:
a int64
b bool
dtype: object
values: [(1, 2), (3, 4)], names: ['a', None]
DataFrame
a NaN
0 1 2
1 3 4
Dtypes:
a int64
NaN int64
dtype: object
to_frame
a 1
0 1 2
1 3 4
Dtypes:
a int64
1 int64
dtype: object
reset_index
a level_1
0 1 2
1 3 4
Dtypes:
a int64
level_1 int64
dtype: object
values: [(1, 2), (3, 4)], names: ['a', 'a']
DataFrame
a a
0 1 2
1 3 4
Dtypes:
a int64
a int64
dtype: object
to_frame
a
0 2
1 4
Dtypes:
a int64
dtype: object
reset_index
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_21224/810260565.py in <module>
14 print(f"{df}\nDtypes:\n{df.dtypes}")
15 print("\nreset_index")
---> 16 df = pd.DataFrame(index=index).reset_index()
17 print(f"{df}\nDtypes:\n{df.dtypes}")
c:\users\john\onedrive\documents\github\pandas_johnzangwill\pandas\util\_decorators.py in wrapper(*args, **kwargs)
309 stacklevel=stacklevel,
310 )
--> 311 return func(*args, **kwargs)
312
313 return wrapper
c:\users\john\onedrive\documents\github\pandas_johnzangwill\pandas\core\frame.py in reset_index(self, level, drop, inplace, col_level, col_fill)
5832 )
5833
-> 5834 new_obj.insert(0, name, level_values)
5835
5836 new_obj.index = new_index
c:\users\john\onedrive\documents\github\pandas_johnzangwill\pandas\core\frame.py in insert(self, loc, column, value, allow_duplicates)
4433 if not allow_duplicates and column in self.columns:
4434 # Should this be a different kind of error??
-> 4435 raise ValueError(f"cannot insert {column}, already exists")
4436 if not isinstance(loc, int):
4437 raise TypeError("loc must be int")
ValueError: cannot insert a, already exists
```
author:
url:https://github.com/johnzangwill
type:Person
name:johnzangwill
datePublished:2022-01-07T12:23:23.000Z
interactionStatistic:
type:InteractionCounter
interactionType:https://schema.org/CommentAction
userInteractionCount:0
url:https://github.com/45245/pandas/issues/45245
Person:
url:https://github.com/johnzangwill
name:johnzangwill
url:https://github.com/johnzangwill
name:johnzangwill
InteractionCounter:
interactionType:https://schema.org/CommentAction
userInteractionCount:0
interactionType:https://schema.org/CommentAction
userInteractionCount:0
External Links {π}(2)
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