Skip to content

Instantly share code, notes, and snippets.

@zinyosrim
Last active January 7, 2019 10:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zinyosrim/978dd312e9d540acd6ed3a8d44495d2a to your computer and use it in GitHub Desktop.
Save zinyosrim/978dd312e9d540acd6ed3a8d44495d2a to your computer and use it in GitHub Desktop.
Couple of Dataframes for Stackoverflow
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