Last active
January 7, 2019 10:06
-
-
Save zinyosrim/978dd312e9d540acd6ed3a8d44495d2a to your computer and use it in GitHub Desktop.
Couple of Dataframes for Stackoverflow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pd.DataFrame({'order_id': ['A', 'B'], | |
'items': [[{'item': 1, 'color': 'blue' }, | |
{'item': 2, 'color': 'red' }], | |
[{'item': 3, 'color': 'green'}, | |
{'item': 2, 'color': 'pink' }]]}, | |
columns= ['order_id', 'items']) | |
pd.DataFrame({'order_id': ['A', 'A', 'B', 'B'], | |
'product_id': [1, 2, 3, 2], | |
'product_color': ['blue', 'red', 'green', 'pink'] }, | |
columns= ['order_id', 'product_id', 'product_color']) | |
pd.DataFrame({'order_id': ['A', 'B'], | |
'address': [{'city': "NY", 'latitude': 2.12, 'longitude' : 3.12,'country_code' : "US"}, | |
{'city': "KL", 'latitude': 12.12, 'longitude' : 23.12,'country_code' : "MY"}]}, | |
columns= ['order_id', 'address']) | |
pd.DataFrame([ | |
{'id': 1, 'nested': {'a': 1, 'b': 2} }, | |
{'id': 2, 'nested': {'a': 2, 'b': 4} }, | |
{'id': 3, 'nested': {'a': 3, 'b': 6} }, | |
{'id': 4, 'nested': {'a': 4}}, | |
]) | |
pd.DataFrame([ | |
{'col1': 1, 'col2': 11}, | |
{'col1': 1, 'col2': 11}, | |
{'col1': 2, 'col2': 22}, | |
{'col1': 2, 'col2': 22}, | |
{'col1': 2, 'col2': 22}, | |
{'col1': 3, 'col2': 33}, | |
{'col1': 4, 'col2': 44}, | |
{'col1': 4, 'col2': 44}, | |
{'col1': 4, 'col2': 44}, | |
{'col1': 4, 'col2': 44}, | |
]) | |
df = pd.DataFrame([ | |
{'col1': 1, 'col2': 11, 'col3': [1, 2] }, | |
{'col1': 2, 'col2': 22, 'col3': [1, 2, 3] }, | |
{'col1': 3, 'col2': 33, 'col3': [1] }, | |
{'col1': 4, 'col2': 44, 'col3': [1, 2, 3, 4] }, | |
]) | |
N = 20 | |
df = pd.DataFrame({"value":np.random.randn(N)}, | |
index=pd.date_range(start='2015-01-01', periods=N)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment