Dataframe size is null?String Values in a dataframe in PandasSplitting Data in scikit-learnConsistently...

Possible issue with my W4 and tax return

Why didn't Tom Riddle take the presence of Fawkes and the Sorting Hat as more of a threat?

What species should be used for storage of human minds?

Partitioning the positive integers into finitely many arithmetic progressions

Concatenating two int[]

A starship is travelling at 0.9c and collides with a small rock. Will it leave a clean hole through, or will more happen?

Apex CPU Time Limit Exceeded error for DateMethods.Year()

Stuck on a Geometry Puzzle

What can I do to encourage my players to use their consumables?

How big is a framed opening for a door relative to the finished door opening width?

What is the industry term for house wiring diagrams?

I have trouble understanding this fallacy: "If A, then B. Therefore if not-B, then not-A."

Prevent Nautilus / Nemo from creating .Trash-1000 folder in mounted devices

Subsurf on a crown. How can I smooth some edges and keep others sharp?

Is `Object` a function in javascript?

Does diversity provide anything that meritocracy does not?

Need help with a circuit diagram where the motor does not seem to have any connection to ground. Error with diagram? Or am i missing something?

Do authors have to be politically correct in article-writing?

How are the system health extended events files rolling over?

Eww, those bytes are gross

How do you get out of your own psychology to write characters?

Boss asked me to sign a resignation paper without a date on it along with my new contract

Closed set in topological space generated by sets of the form [a, b).

Non-Cancer terminal illness that can affect young (age 10-13) girls?



Dataframe size is null?


String Values in a dataframe in PandasSplitting Data in scikit-learnConsistently inconsistent cross-validation results that are wildly different from original model accuracySame input size but cannot fit the model in kerasMy Neural network in Tensorflow does a bad job in comparison to the same Neural network in KerasKeras- LSTM answers different sizeMachine learning - 'train_test_split' function in scikit-learn: should I repeat it several times?YOLO layers sizeSwap memory size increases when running multiple Keras modelsConfusion about Entity Embeddings of Categorical Variables - Working Example!













1












$begingroup$


I have a function in which I want to represent my data like this:



Input is a column:[ 123 125 11 122 ...]
Output: 123 125
125 11
11 122


The function in python is like that:



def create_dataset(dataset, look_back=1):
dataX, dataY = [], []
for i in range(len(dataset)-look_back-1):
a = dataset[i:(i+look_back), 0]
dataX.append(a)
dataY.append(dataset[i + look_back, 0])
return np.array(dataX), np.array(dataY)


My dataset is represented as 1-grams of integers in a csv file, so I was obliged to use the transpose () of the dataframe to use this function. The problem is that I find the dataframe size null, and the train and test data (after spliting) also empty.



the code is:



dataframe = pd.read_csv("train2.csv")

print(dataframe.shape) # (0,150)
print("--------n")
#dataframe= np.asarray(dataframe)
dataframe = dataframe.transpose()
print(dataframe.shape) #(150,0)
print(dataframe.size) # 0

dataset = dataframe.values
dataset = dataset.astype('float32')

# split into train and test sets
train_size = int(len(dataset) * 0.67)
print(len(dataset))
#print (train_size)
test_size = len(dataset) - train_size
train, test = dataset[0:train_size,:], dataset[train_size:len(dataset),:]
print(len(train), len(test))

print(dataset[0:train_size,:]) #[]
print(train) # []
print(test) # []

# reshape into X=t and Y=t+1
look_back = 1
trainX, trainY = create_dataset(train, look_back)
testX, testY = create_dataset(test, look_back)


Any solution please?










share|improve this question









$endgroup$

















    1












    $begingroup$


    I have a function in which I want to represent my data like this:



    Input is a column:[ 123 125 11 122 ...]
    Output: 123 125
    125 11
    11 122


    The function in python is like that:



    def create_dataset(dataset, look_back=1):
    dataX, dataY = [], []
    for i in range(len(dataset)-look_back-1):
    a = dataset[i:(i+look_back), 0]
    dataX.append(a)
    dataY.append(dataset[i + look_back, 0])
    return np.array(dataX), np.array(dataY)


    My dataset is represented as 1-grams of integers in a csv file, so I was obliged to use the transpose () of the dataframe to use this function. The problem is that I find the dataframe size null, and the train and test data (after spliting) also empty.



    the code is:



    dataframe = pd.read_csv("train2.csv")

    print(dataframe.shape) # (0,150)
    print("--------n")
    #dataframe= np.asarray(dataframe)
    dataframe = dataframe.transpose()
    print(dataframe.shape) #(150,0)
    print(dataframe.size) # 0

    dataset = dataframe.values
    dataset = dataset.astype('float32')

    # split into train and test sets
    train_size = int(len(dataset) * 0.67)
    print(len(dataset))
    #print (train_size)
    test_size = len(dataset) - train_size
    train, test = dataset[0:train_size,:], dataset[train_size:len(dataset),:]
    print(len(train), len(test))

    print(dataset[0:train_size,:]) #[]
    print(train) # []
    print(test) # []

    # reshape into X=t and Y=t+1
    look_back = 1
    trainX, trainY = create_dataset(train, look_back)
    testX, testY = create_dataset(test, look_back)


    Any solution please?










    share|improve this question









    $endgroup$















      1












      1








      1





      $begingroup$


      I have a function in which I want to represent my data like this:



      Input is a column:[ 123 125 11 122 ...]
      Output: 123 125
      125 11
      11 122


      The function in python is like that:



      def create_dataset(dataset, look_back=1):
      dataX, dataY = [], []
      for i in range(len(dataset)-look_back-1):
      a = dataset[i:(i+look_back), 0]
      dataX.append(a)
      dataY.append(dataset[i + look_back, 0])
      return np.array(dataX), np.array(dataY)


      My dataset is represented as 1-grams of integers in a csv file, so I was obliged to use the transpose () of the dataframe to use this function. The problem is that I find the dataframe size null, and the train and test data (after spliting) also empty.



      the code is:



      dataframe = pd.read_csv("train2.csv")

      print(dataframe.shape) # (0,150)
      print("--------n")
      #dataframe= np.asarray(dataframe)
      dataframe = dataframe.transpose()
      print(dataframe.shape) #(150,0)
      print(dataframe.size) # 0

      dataset = dataframe.values
      dataset = dataset.astype('float32')

      # split into train and test sets
      train_size = int(len(dataset) * 0.67)
      print(len(dataset))
      #print (train_size)
      test_size = len(dataset) - train_size
      train, test = dataset[0:train_size,:], dataset[train_size:len(dataset),:]
      print(len(train), len(test))

      print(dataset[0:train_size,:]) #[]
      print(train) # []
      print(test) # []

      # reshape into X=t and Y=t+1
      look_back = 1
      trainX, trainY = create_dataset(train, look_back)
      testX, testY = create_dataset(test, look_back)


      Any solution please?










      share|improve this question









      $endgroup$




      I have a function in which I want to represent my data like this:



      Input is a column:[ 123 125 11 122 ...]
      Output: 123 125
      125 11
      11 122


      The function in python is like that:



      def create_dataset(dataset, look_back=1):
      dataX, dataY = [], []
      for i in range(len(dataset)-look_back-1):
      a = dataset[i:(i+look_back), 0]
      dataX.append(a)
      dataY.append(dataset[i + look_back, 0])
      return np.array(dataX), np.array(dataY)


      My dataset is represented as 1-grams of integers in a csv file, so I was obliged to use the transpose () of the dataframe to use this function. The problem is that I find the dataframe size null, and the train and test data (after spliting) also empty.



      the code is:



      dataframe = pd.read_csv("train2.csv")

      print(dataframe.shape) # (0,150)
      print("--------n")
      #dataframe= np.asarray(dataframe)
      dataframe = dataframe.transpose()
      print(dataframe.shape) #(150,0)
      print(dataframe.size) # 0

      dataset = dataframe.values
      dataset = dataset.astype('float32')

      # split into train and test sets
      train_size = int(len(dataset) * 0.67)
      print(len(dataset))
      #print (train_size)
      test_size = len(dataset) - train_size
      train, test = dataset[0:train_size,:], dataset[train_size:len(dataset),:]
      print(len(train), len(test))

      print(dataset[0:train_size,:]) #[]
      print(train) # []
      print(test) # []

      # reshape into X=t and Y=t+1
      look_back = 1
      trainX, trainY = create_dataset(train, look_back)
      testX, testY = create_dataset(test, look_back)


      Any solution please?







      python keras






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 10 hours ago









      KikioKikio

      324




      324






















          0






          active

          oldest

          votes











          Your Answer





          StackExchange.ifUsing("editor", function () {
          return StackExchange.using("mathjaxEditing", function () {
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
          });
          });
          }, "mathjax-editing");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "557"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f46187%2fdataframe-size-is-null%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Data Science Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f46187%2fdataframe-size-is-null%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          is 'sed' thread safeWhat should someone know about using Python scripts in the shell?Nexenta bash script uses...

          How do i solve the “ No module named 'mlxtend' ” issue on Jupyter?

          Pilgersdorf Inhaltsverzeichnis Geografie | Geschichte | Bevölkerungsentwicklung | Politik | Kultur...