import pandas as pd
# always use when .json or using data
df = pd.read_json('files/init.json')
# reading
print(df)
   Number  License Plate  Phone Number
0       1        1234567    858.234234
1       2        8901234    858.238346
2       3        1234567    908.234234
3       4        2345678    909.465728
4       5        4567890    490.234758
5       6        1357924    294.868329
print(df[['Number']])

print()

#try two columns and remove the index from print statement
print(df[['License Plate','Phone Number']].to_string(index=False))
   Number
0       1
1       2
2       3
3       4
4       5
5       6

 License Plate  Phone Number
       1234567    858.234234
       8901234    858.238346
       1234567    908.234234
       2345678    909.465728
       4567890    490.234758
       1357924    294.868329
print(df.sort_values(by=['License Plate']))

print()

#sort the values in reverse order
print(df.sort_values(by=['Phone Number'], ascending=False))
   Number  License Plate  Phone Number
0       1        1234567    858.234234
2       3        1234567    908.234234
5       6        1357924    294.868329
3       4        2345678    909.465728
4       5        4567890    490.234758
1       2        8901234    858.238346

   Number  License Plate  Phone Number
3       4        2345678    909.465728
2       3        1234567    908.234234
1       2        8901234    858.238346
0       1        1234567    858.234234
4       5        4567890    490.234758
5       6        1357924    294.868329
print(df[df.Number > 3.00])
   Number  License Plate  Phone Number
3       4        2345678    909.465728
4       5        4567890    490.234758
5       6        1357924    294.868329
print(df[df.Number == df.Number.max()])
print()
print(df[df.Number == df.Number.min()])
   Number  License Plate  Phone Number
5       6        1357924    294.868329

   Number  License Plate  Phone Number
0       1        1234567    858.234234

import pandas as pd

#the data can be stored as a python dictionary
dict = {
  "number": [0,1,2],
  "phone": [1234567, 8901234, 1234567]
}
#stores the data in a data frame
print("-------------Dict_to_DF------------------")
df = pd.DataFrame(dict)
print(df)

print("----------Dict_to_DF_labels--------------")

#or with the index argument, you can label rows.
df = pd.DataFrame(dict, index = ["user1", "user2", "user3"])
print(df)
-------------Dict_to_DF------------------
   number    phone
0       0  1234567
1       1  8901234
2       2  1234567
----------Dict_to_DF_labels--------------
       number    phone
user1       0  1234567
user2       1  8901234
user3       2  1234567
print("-------Examine Selected Rows---------")
#use a list for multiple labels:
print(df.loc[["user1", "user3"]])

#refer to the row index:
print("--------Examine Single Row-----------")
print(df.loc["user1"])
-------Examine Selected Rows---------
       number    phone
user1       0  1234567
user3       2  1234567
--------Examine Single Row-----------
number          0
phone     1234567
Name: user1, dtype: int64
print(df.info())
<class 'pandas.core.frame.DataFrame'>
Index: 3 entries, user1 to user3
Data columns (total 2 columns):
 #   Column  Non-Null Count  Dtype
---  ------  --------------  -----
 0   number  3 non-null      int64
 1   phone   3 non-null      int64
dtypes: int64(2)
memory usage: 180.0+ bytes
None
import pandas as pd

#read csv and sort 'Duration' largest to smallest
df = pd.read_csv('files/initials.csv').sort_values(by=['number'], ascending=False)

print("--Users---------")
print(df.head(10))
--Users---------
   number  license       phone
5       5  1357924  294.868329
4       4  4567890  909.465728
3       3  1234567  908.234234
2       2  8901234  858.238346
1       1  1234567  858.234234
0       0  4567890  490.234758