Skip to content

Instantly share code, notes, and snippets.

@Nagasaki45
Created July 10, 2020 12:18
Show Gist options
  • Save Nagasaki45/aaf6927c416f276bc2c05ec1488d6cd1 to your computer and use it in GitHub Desktop.
Save Nagasaki45/aaf6927c416f276bc2c05ec1488d6cd1 to your computer and use it in GitHub Desktop.
import pandas as pd
original_data = [
{'globalTime': 1795, 'istTime': [0, 23, 39], 'coordinates': [(173, 289), (171, 289), (170, 289)]},
{'globalTime': 1714, 'istTime': [0, 18, 36], 'coordinates': [(137, 429), (133, 433), (130, 436)]},
]
transformed_data = [
{'globalTime': row['globalTime'], 'istTime': it, 'x': x, 'y': y}
for row in original_data
for it, (x, y) in zip(row['istTime'], row['coordinates'])
]
df = pd.DataFrame(transformed_data)
print(df)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment