import pandas as pd
import numpy as np

# This case is handled identically to a dict of arrays.
data = np.zeros(shape=(2,), dtype=[('A', 'i4'), ('B', 'f4'), ('C', 'a10')])
data[:] = [(1, 2, 'Hello'), (3., 4., "World")]
df = pd.DataFrame(data=data)
print("DataFrame from Structured array : ")
# we get third column output as byte
print(df)
df = pd.DataFrame(data=data, index=['first', 'second'])
print("DataFrame from Structured array with index : ")
print(df)
pd.DataFrame(data, index=['first', 'second'], columns=['C', 'A', 'B'])
print("DataFrame from Structured array with index and columns : ")
# DataFrame is not intended to work exactly like a 2-dimensional NumPy ndarray.
print(df)
13b471ef22ea6c3ddfeb93c1a7dd813fcd9f1626
<mask token>

<mask token>
print('DataFrame from Structured array : ')
print(df)
<mask token>
print('DataFrame from Structured array with index : ')
print(df)
pd.DataFrame(data, index=['first', 'second'], columns=['C', 'A', 'B'])
print('DataFrame from Structured array with index and columns : ')
print(df)

<mask token>
data = np.zeros(shape=(2,), dtype=[('A', 'i4'), ('B', 'f4'), ('C', 'a10')])
data[:] = [(1, 2, 'Hello'), (3.0, 4.0, 'World')]
df = pd.DataFrame(data=data)
print('DataFrame from Structured array : ')
print(df)
df = pd.DataFrame(data=data, index=['first', 'second'])
print('DataFrame from Structured array with index : ')
print(df)
pd.DataFrame(data, index=['first', 'second'], columns=['C', 'A', 'B'])
print('DataFrame from Structured array with index and columns : ')
print(df)

import pandas as pd
import numpy as np
data = np.zeros(shape=(2,), dtype=[('A', 'i4'), ('B', 'f4'), ('C', 'a10')])
data[:] = [(1, 2, 'Hello'), (3.0, 4.0, 'World')]
df = pd.DataFrame(data=data)
print('DataFrame from Structured array : ')
print(df)
df = pd.DataFrame(data=data, index=['first', 'second'])
print('DataFrame from Structured array with index : ')
print(df)
pd.DataFrame(data, index=['first', 'second'], columns=['C', 'A', 'B'])
print('DataFrame from Structured array with index and columns : ')
print(df)

import pandas as pd
import numpy as np

# This case is handled identically to a dict of arrays.
data = np.zeros(shape=(2,), dtype=[('A', 'i4'), ('B', 'f4'), ('C', 'a10')])
data[:] = [(1, 2, 'Hello'), (3., 4., "World")]
df = pd.DataFrame(data=data)
print("DataFrame from Structured array : ")
# we get third column output as byte
print(df)
df = pd.DataFrame(data=data, index=['first', 'second'])
print("DataFrame from Structured array with index : ")
print(df)
pd.DataFrame(data, index=['first', 'second'], columns=['C', 'A', 'B'])
print("DataFrame from Structured array with index and columns : ")
# DataFrame is not intended to work exactly like a 2-dimensional NumPy ndarray.
print(df)